:root {
  color-scheme: dark;
  --canvas: #0a111b;
  --nav: #0d1723;
  --paper: #121e2c;
  --paper-raised: #19283a;
  --ink: #f1f5fa;
  --muted: #aab9c9;
  --line: #2c3d50;
  --accent: #63d8c4;
  --focus: #9bdeff;
  --warning: #ffd47e;
  --danger: #ffada8;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 "Segoe UI", Arial, sans-serif; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #a3f5e6; }
button, input, textarea { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 13px; border: 1px solid #465c73; border-radius: 8px; background: #1b2a3b; color: var(--ink); text-decoration: none; font-weight: 650; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { background: #30465e; border-color: var(--accent); color: #fff; }
button:active, .button:active { background: #1b3b40; }
button.primary { background: var(--accent); border-color: var(--accent); color: #08221e; }
button.primary:hover { background: #94eedf; border-color: #94eedf; color: #08221e; }
input, textarea { display: block; width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px; border: 1px solid #465a70; border-radius: 8px; background: #0d1723; color: var(--ink); }
input::placeholder, textarea::placeholder { color: #a7b8c9; opacity: 1; }
input[type="checkbox"] { display: inline-block; width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; color: #dce8f4; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(25px, 2vw, 32px); line-height: 1.2; letter-spacing: -.025em; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
h3 { margin-bottom: 12px; font-size: 16px; line-height: 1.35; }
small { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Liberation Mono", monospace; overflow-wrap: anywhere; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: -60px; left: 16px; padding: 9px 14px; border-radius: 7px; background: var(--accent); color: #08221e; }
.skip-link:focus { top: 12px; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 248px; padding: 22px 14px 16px; background: var(--nav); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 14px; color: #fff; text-decoration: none; font-weight: 750; letter-spacing: .08em; }
.brand:hover { color: #fff; }
.brand small { margin-top: 3px; color: #a7bccd; font-size: 10px; letter-spacing: .08em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border: 1px solid #4f9d90; border-radius: 11px; background: #153b36; color: #b9f8ec; font-size: 18px; font-weight: 800; letter-spacing: -.05em; }
.nav-label { margin: 22px 10px 7px; color: #8398ad; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; justify-content: space-between; align-items: center; min-height: 39px; padding: 8px 10px; border-radius: 7px; color: #c6d2df; font-size: 12px; text-decoration: none; }
.sidebar nav a:hover { background: #23384a; color: #fff; }
.sidebar nav a.active { background: #1d403b; color: #fff; box-shadow: inset 3px 0 var(--accent); }
.sidebar nav span { min-width: 23px; padding: 0 5px; border-radius: 5px; background: #355568; text-align: center; }
.side-bottom { margin-top: auto; padding: 18px 10px 0; color: var(--muted); font-size: 12px; }
.side-bottom p { margin-bottom: 15px; }
.logout { width: 100%; background: transparent; }

.workspace { width: min(1720px, calc(100vw - 248px)); max-width: 1720px; margin-left: max(248px, calc((100vw - 1720px + 248px)/2)); padding: 28px clamp(22px, 2.2vw, 38px) 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.topbar .muted { margin: 7px 0 0; font-size: 14px; }
.toolbar, .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar .button { font-size: 13px; }
.alert { margin: 0 0 16px; padding: 12px 15px; border: 1px solid; border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.error { background: #45272b; border-color: #9c555b; color: #ffd1cc; }
.success { background: #193a32; border-color: #4e927b; color: #b8f3d5; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.stats>div { min-height: 98px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, #152333, var(--paper) 72%); }
.stats span { display: block; color: var(--muted); font-size: 13px; }
.stats strong { display: block; margin-top: 3px; font-size: 29px; line-height: 1.2; letter-spacing: -.03em; }
.stats>div:nth-child(2) strong { color: var(--warning); }
.stats>div:nth-child(3) strong { color: var(--accent); }

.split { display: grid; grid-template-columns: minmax(390px, .94fr) minmax(0,1.06fr); align-items: start; gap: 14px; scroll-margin-top: 20px; }
.inbox, .detail, .operations-panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 10px 28px rgba(0,0,0,.13); }
.inbox .table-scroll { max-height: min(62vh, 680px); overflow: auto; overscroll-behavior: contain; }
.inbox .table-scroll th { position: sticky; top: 0; z-index: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; }
.count { display: inline-block; min-width: 24px; padding: 1px 7px; border-radius: 5px; background: #294153; color: #dce9f3; font-size: 12px; font-weight: 650; text-align: center; vertical-align: middle; }
.search { display: flex; gap: 8px; padding: 0 18px 16px; }
.search input { font-size: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 13px; border-block: 1px solid var(--line); background: var(--paper-raised); color: #b9c9d9; font-size: 10px; font-weight: 750; letter-spacing: .075em; text-align: left; text-transform: uppercase; }
td { padding: 12px 13px; border-bottom: 1px solid #263749; vertical-align: top; }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover { background-color: rgba(99,216,196,.045); }
td:first-child { max-width: 290px; }
td small { overflow-wrap: anywhere; }
.report-title { color: #f3f7fc; font-size: 14px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.report-title:hover { color: var(--accent); }
.report-title span { color: var(--accent); }
.selected { background: #1b3739; box-shadow: inset 3px 0 var(--accent); }
.badge { display: inline-block; padding: 4px 8px; border-radius: 6px; background: #2c4358; color: #eaf4fd; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: normal; }
.badge.new { background: #554222; color: #ffe5ab; }
.badge.reviewing { background: #244766; color: #cee8ff; }
.badge.confirmed { background: #572f34; color: #ffd0c8; }
.badge.dismissed { background: #1f4939; color: #b7f1d0; }
time { color: var(--muted); font-size: 12px; }
.list-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; color: var(--muted); font-size: 12px; }
.list-footer a { margin-left: 10px; }
.import { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-top: 1px solid var(--line); }
.import small { max-width: 55ch; }

.detail { padding: 0 20px 21px; }
.detail>.section-head { padding: 18px 0 13px; }
.detail .section-head button { font-size: 12px; }
.signal { margin: 14px 0 18px; font-size: 14px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: 135px minmax(0,1fr); gap: 10px 18px; margin: 18px 0; padding: 17px 0; border-block: 1px solid var(--line); font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.caution { margin: 16px 0; padding: 12px 14px; border-left: 3px solid var(--warning); border-radius: 0 7px 7px 0; background: #39311f; color: #ffe7b6; font-size: 13px; }
.decision, .evidence, .history, .var { margin-top: 23px; padding-top: 21px; border-top: 1px solid var(--line); }
.decision label { font-size: 13px; }
.actions { margin: 12px 0; }
.actions button { font-size: 12px; }
.gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.gallery figure { min-width: 0; margin: 0; }
.gallery img { display: block; width: 100%; aspect-ratio: 16/10; border: 1px solid var(--line); border-radius: 8px; background: #0b141f; object-fit: contain; }
.gallery figcaption { padding: 7px 0; font-size: 12px; overflow-wrap: anywhere; }
.gallery figcaption small { font-size: 11px; }
.gallery button { width: 100%; font-size: 12px; }
.var summary, .policy-details summary { min-height: 32px; color: #dce9f4; font-size: 13px; font-weight: 700; cursor: pointer; }
.history ol { margin: 0; padding: 0; list-style: none; }
.history li { margin-left: 3px; padding: 0 0 15px 15px; border-left: 2px solid #4a9788; }
.history strong { font-size: 13px; }
.history time { display: block; }
.history p { margin: 5px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.empty { padding: 38px 24px; color: var(--muted); font-size: 13px; text-align: center; }
.empty strong { color: var(--ink); font-size: 16px; }
.empty p { margin: 10px 0; }

.operations-panel { margin: 14px 0; padding: 20px; scroll-margin-top: 20px; }
.operations-panel>h2 { margin-bottom: 7px; }
.operations-panel>.muted, .panel-lede { margin-bottom: 18px; color: var(--muted); font-size: 14px; }
#launcher-update .section-head { padding: 0 0 12px; }
#launcher-update .facts { margin: 0 0 16px; padding: 14px 0; }
.operations-panel .table-scroll { border: 1px solid var(--line); border-radius: 8px; }
.capture-client-table { max-height: min(58vh, 560px); overflow: auto; margin: 0 0 16px; }
.capture-client-table table { min-width: 920px; }
.capture-client-table th { position: sticky; top: 0; z-index: 1; }
.capture-client-table td:first-child small { display: block; margin-top: 4px; }
.capture-client-table td:last-child { min-width: 210px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.row-actions :is(button, .button) { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.hash-table { max-height: 430px; overflow: auto; }
.hash-table th { position: sticky; top: 0; z-index: 1; }
.inline-form { display: inline; }
.operations-panel .gallery { grid-template-columns: repeat(3,minmax(0,1fr)); }
.operations-panel>h3 { margin: 24px 0 14px; }
.policy-details { max-width: 100ch; margin: -5px 0 18px; color: var(--muted); font-size: 13px; }
.policy-details p { margin: 8px 0 0; }
.form-grid { display: grid; align-items: end; gap: 13px; margin: 0 0 18px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #0f1a27; }
.form-grid--capture { grid-template-columns: minmax(180px,2fr) minmax(125px,1fr) minmax(125px,1fr) auto auto; }
.form-grid--allow { grid-template-columns: minmax(240px,1.2fr) minmax(240px,1fr) auto; }
.form-grid--metadata { grid-template-columns: repeat(2,minmax(0,1fr)); }
.hash-history { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.form-grid .field { min-width: 0; }
.form-grid label { margin-bottom: 6px; }
.form-grid button { width: 100%; }
.operations-panel>button { margin-bottom: 18px; }
.terms-preview { max-height: 100px; overflow: auto; margin: 0 0 16px; color: var(--ink); font-size: 13px; }
.admin-dialog { width: min(760px, calc(100vw - 28px)); max-height: min(90vh, 900px); padding: 24px; overflow: auto; border: 1px solid #59718a; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.admin-dialog--small { width: min(480px, calc(100vw - 28px)); }
.admin-dialog::backdrop { background: rgba(2,8,15,.78); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.modal-head button { min-width: 44px; padding: 5px; font-size: 24px; }
.admin-dialog .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); margin: 0; padding: 0; border: 0; background: transparent; }
.admin-dialog textarea { margin-bottom: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.admin-dialog .form-grid .modal-actions { grid-column: 1/-1; }
.admin-dialog .form-grid .modal-actions button { width: auto; }
.admin-dialog>h3 { margin-top: 24px; }
.checkbox-field { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; white-space: nowrap; cursor: pointer; }
.checkbox-field input { flex: none; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; color: #9fb5c8; font-size: 11px; letter-spacing: .08em; }
.page-footer span { letter-spacing: 0; }

.login { max-width: 450px; margin: min(12vh,100px) auto 40px; padding: 36px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: 0 30px 85px rgba(0,0,0,.25); }
.login .brand-mark { margin-bottom: 23px; }
.login h1 { font-size: 28px; }
.login form { margin-top: 27px; }
.login input { margin-bottom: 16px; }
.full { width: 100%; }
.footnote { margin: 23px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 1350px) {
  .form-grid--capture { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .form-grid--capture .checkbox-field { grid-column: 1/3; }
}
@media (max-width: 1120px) {
  .workspace { width: auto; margin-left: 248px; }
  .split { grid-template-columns: minmax(0,1fr); }
  .operations-panel .gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topbar { align-items: flex-start; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 13px 14px 10px; overflow: visible; }
  .brand { padding: 0 0 9px; }
  .nav-label, .side-bottom p { display: none; }
  .sidebar nav { flex-direction: row; gap: 5px; overflow-x: auto; padding: 3px 0; }
  .sidebar nav a { flex: none; white-space: nowrap; min-height: 39px; }
  .filter-nav { margin-top: 3px; }
  .side-bottom { margin: 8px 0 0; padding: 0; }
  .logout { width: auto; min-height: 38px; }
  .workspace { width: auto; max-width: none; margin: 0; padding: 22px 14px 30px; }
  .topbar { display: block; }
  .toolbar { margin-top: 17px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid--capture, .form-grid--allow, .form-grid--metadata { grid-template-columns: 1fr 1fr; }
  .form-grid--capture .field:first-of-type, .form-grid--allow .field:first-of-type { grid-column: 1/-1; }
  .form-grid--capture .checkbox-field { grid-column: auto; }
}
@media (max-width: 520px) {
  .admin-dialog { padding: 17px; }
  .admin-dialog .form-grid { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stats>div { min-height: 90px; padding: 13px; }
  .stats strong { font-size: 24px; }
  .section-head { padding: 16px; }
  .search { padding: 0 16px 16px; }
  .detail { padding: 0 16px 18px; }
  .facts { grid-template-columns: 110px minmax(0,1fr); }
  .form-grid--capture, .form-grid--allow, .form-grid--metadata { grid-template-columns: 1fr; }
  .form-grid--capture .field:first-of-type, .form-grid--allow .field:first-of-type { grid-column: auto; }
  .operations-panel { padding: 17px; }
  .operations-panel .gallery, .gallery { grid-template-columns: 1fr; }
  .import, .list-footer, .page-footer { display: block; }
  .import small, .page-footer span { margin-top: 9px; }
  .login { margin: 5vh 12px; padding: 26px; }
}
@media (max-width: 390px) {
  .workspace { padding-inline: 11px; }
  .stats>div { padding: 11px; }
  .stats span { font-size: 11px; }
  .toolbar .button { flex: 1 1 100%; }
  .facts { grid-template-columns: 1fr; gap: 4px; }
  .facts dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (prefers-reduced-motion: no-preference) { button, .button, .sidebar nav a { transition: background-color .16s ease, border-color .16s ease, color .16s ease; } }
