:root {
  color-scheme: light;
  --canvas: #eee7da;
  --nav: #38302a;
  --paper: #fffaf1;
  --paper-raised: #f3e8d5;
  --ink: #382b20;
  --muted: #79634d;
  --line: #d9c7a9;
  --accent: #a97735;
  --focus: #76501f;
  --warning: #9c691e;
  --danger: #a33b30;
  --success: #39714d;
  --shadow: 0 14px 34px rgba(57, 40, 23, .10), inset 0 1px rgba(255,255,255,.8);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 18px; }
body { margin: 0; background: radial-gradient(ellipse at 50% 0, #fbf5e9, var(--canvas) 72%); color: var(--ink); font: 14px/1.55 "Segoe UI", Arial, sans-serif; }
a { color: #805727; text-underline-offset: 3px; }
a:hover { color: #4b321b; }
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 #b99a6d; border-radius: 8px; background: linear-gradient(135deg, #fffaf0, #ead8b8); color: #503820; text-decoration: none; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: inset 0 1px rgba(255,255,255,.8); }
button:hover, .button:hover { border-color: #95672e; background: linear-gradient(135deg, #fff8e8, #dfc496); color: #392516; }
button:active, .button:active { transform: translateY(1px); }
button.primary { border-color: #a77b42; background: linear-gradient(135deg, #e8cb97, #c69b5e); color: #392719; }
button.primary:hover { background: linear-gradient(135deg, #f1d9ad, #d0a76a); }
button.danger { border-color: #d5a8a0; background: #fff5f1; color: #87332c; }
input, textarea { display: block; width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px; border: 1px solid #cbb58f; border-radius: 8px; background: rgba(255,255,255,.82); color: var(--ink); }
input::placeholder, textarea::placeholder { color: #8d7963; 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; color: #5b432c; font-size: 13px; font-weight: 700; }
:focus-visible { outline: 3px solid #a77b42; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; color: #473326; font: 700 clamp(25px, 2vw, 32px)/1.2 Georgia, "Times New Roman", serif; letter-spacing: .01em; }
h2 { margin-bottom: 0; color: #4d3726; font: 700 19px/1.3 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
h3 { margin-bottom: 12px; color: #5b422c; font: 700 16px/1.35 Georgia, "Times New Roman", serif; }
small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Liberation Mono", monospace; overflow-wrap: anywhere; }
.eyebrow { margin-bottom: 8px; color: #9a6d35; font-size: 10px; font-weight: 800; letter-spacing: .16em; 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: #e6c88f; color: #392719; }
.skip-link:focus { top: 12px; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 252px; padding: 22px 14px 16px; background: linear-gradient(180deg, #3e352e, #302923); color: #f8eddd; border-right: 1px solid #5d4b3b; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 15px; color: #fff5e3; text-decoration: none; font-weight: 800; letter-spacing: .07em; }
.brand:hover { color: #fff; }
.brand small { margin-top: 3px; color: #d5bd95; font-size: 9px; letter-spacing: .09em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border: 1px solid #c6a26e; border-radius: 10px; background: linear-gradient(145deg, #f3dfb9, #c59b5d); color: #49331e; font: 700 17px Georgia, serif; letter-spacing: -.04em; box-shadow: inset 0 1px rgba(255,255,255,.75), 0 4px 12px rgba(0,0,0,.16); }
.nav-label { margin: 21px 10px 7px; color: #c6ad86; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a { display: flex; justify-content: space-between; align-items: center; min-height: 39px; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; color: #eee1cd; font-size: 12px; font-weight: 600; text-decoration: none; }
.sidebar nav a:hover { border-color: rgba(219,190,145,.22); background: rgba(255,245,226,.08); color: #fff8ed; }
.sidebar nav a.active { border-color: #8d7048; background: linear-gradient(100deg, rgba(208,174,119,.25), rgba(208,174,119,.08)); color: #ffe4b7; box-shadow: inset 3px 0 #d7b476; }
.sidebar nav span { min-width: 23px; padding: 0 5px; border-radius: 5px; background: #66513a; color: #fff0d5; text-align: center; }
.side-bottom { margin-top: auto; padding: 18px 10px 0; color: #d6c3a7; font-size: 12px; }
.side-bottom p { margin-bottom: 15px; }
.logout { width: 100%; border-color: #756049; background: transparent; color: #f4e6d0; box-shadow: none; }
.logout:hover { background: rgba(255,255,255,.08); color: #fff; }

.workspace { width: min(1720px, calc(100vw - 252px)); max-width: 1720px; margin-left: max(252px, calc((100vw - 1720px + 252px)/2)); padding: 28px clamp(22px, 2.2vw, 38px) 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 0 0 18px; border-bottom: 1px solid #d7c6a9; }
.topbar .muted { margin: 7px 0 0; font-size: 13px; }
.toolbar, .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar .button { font-size: 12px; }
.alert { margin: 0 0 16px; padding: 12px 15px; border: 1px solid; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.error { border-color: #d6aaa2; background: #fff0ec; color: #832e27; }
.success { border-color: #b2ceb4; background: #edf7eb; color: #315d3b; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.stats>div { min-height: 96px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, #fffdf8, #f2e6d1); box-shadow: var(--shadow); }
.stats span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stats strong { display: block; margin-top: 4px; color: #4b3522; font-size: 28px; 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); }
.stats>div:nth-child(4) strong { color: var(--danger); }
.split { display: grid; grid-template-columns: minmax(390px,.94fr) minmax(0,1.06fr); align-items: stretch; gap: 14px; scroll-margin-top: 20px; }
.inbox, .detail, .operations-panel { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: var(--shadow); }
.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: 16px 18px; }
.count { display: inline-block; min-width: 24px; padding: 1px 7px; border: 1px solid #d9c5a2; border-radius: 5px; background: #f2e5cf; color: #6e4c27; font-size: 12px; font-weight: 700; text-align: center; vertical-align: middle; }
.search { display: flex; gap: 8px; padding: 0 18px 15px; }
.search input { font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; border-block: 1px solid #ddceb4; background: #efe2cc; color: #6d5135; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 11px 12px; border-bottom: 1px solid #eee5d7; vertical-align: top; }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover { background: rgba(188,146,84,.08); }
td:first-child { max-width: 290px; }
td small { overflow-wrap: anywhere; }
.report-title { color: #4d3827; font-size: 13px; font-weight: 750; text-decoration: none; overflow-wrap: anywhere; }
.report-title:hover { color: #9a672b; }
.report-title span { color: #9a672b; }
.selected { background: #f5e8d0; box-shadow: inset 3px 0 #b2854a; }
.badge { display: inline-block; padding: 4px 8px; border: 1px solid #ddceb5; border-radius: 6px; background: #f2e8d9; color: #5f4b35; font-size: 10px; font-weight: 750; line-height: 1.4; white-space: normal; }
.badge.new { border-color: #e2c48e; background: #fff2d6; color: #795317; }
.badge.reviewing { border-color: #c4d2df; background: #edf3f8; color: #39566d; }
.badge.confirmed { border-color: #e1b8ad; background: #fff0ec; color: #8e382e; }
.badge.dismissed { border-color: #bad1b9; background: #edf6eb; color: #3d6844; }
time { color: var(--muted); font-size: 11px; }
.list-footer { display: flex; justify-content: space-between; gap: 12px; padding: 13px 18px; color: var(--muted); font-size: 11px; }
.list-footer a { margin-left: 10px; }
.import { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-top: 1px solid #e6dac7; }
.import small { max-width: 55ch; }
.detail { padding: 0 20px 20px; }
.detail>.section-head { padding: 17px 0 12px; }
.detail .section-head button { font-size: 11px; }
.signal { margin: 14px 0 18px; font-size: 13px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: 135px minmax(0,1fr); gap: 10px 18px; margin: 18px 0; padding: 16px 0; border-block: 1px solid #e7dccb; font-size: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.caution { margin: 16px 0; padding: 12px 14px; border-left: 3px solid #c4944b; border-radius: 0 7px 7px 0; background: #fff3db; color: #684b21; font-size: 12px; }
.decision, .evidence, .history, .var { margin-top: 21px; padding-top: 19px; border-top: 1px solid #e7dccb; }
.decision label { font-size: 12px; }
.actions { margin: 12px 0; }
.actions button { font-size: 11px; }
.gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.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: #eee5d8; object-fit: contain; }
.gallery figcaption { padding: 7px 0; font-size: 11px; overflow-wrap: anywhere; }
.gallery figcaption small { font-size: 10px; }
.gallery button { width: 100%; font-size: 11px; }
.var summary, .policy-details summary { min-height: 32px; color: #5a4028; font-size: 12px; font-weight: 750; 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 #c5a16b; }
.history strong { font-size: 12px; }
.history time { display: block; }
.history p { margin: 5px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.empty { padding: 35px 22px; color: var(--muted); font-size: 12px; text-align: center; }
.empty strong { color: var(--ink); font-size: 15px; }
.empty p { margin: 9px 0; }
.operations-panel { margin: 14px 0; padding: 19px; scroll-margin-top: 20px; }
.operations-panel>h2 { margin-bottom: 7px; }
.operations-panel>.muted, .panel-lede { margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.operations-panel .table-scroll { border: 1px solid #e0d2bc; border-radius: 8px; }
.capture-client-table { max-height: min(58vh,560px); overflow: auto; margin: 0 0 16px; }
.capture-client-table table { min-width: 790px; }
.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:first-child { width: 26%; }
.capture-client-table td:nth-child(2) { width: 30%; }
.capture-client-table td:nth-child(3) { width: 17%; }
.capture-client-table td:last-child { width: 27%; min-width: 230px; }
.capture-panel>h2 { margin-bottom: 7px; font-size: 21px; }
.capture-panel>.panel-lede { max-width: 86ch; margin: 0 0 14px; padding: 11px 14px; border-left: 3px solid #b58a50; border-radius: 0 7px 7px 0; background: #f8eedf; }
.capture-panel>.policy-details { max-width: none; margin: 0 0 20px; padding: 11px 14px; border: 1px solid #e4d8c6; border-radius: 8px; background: #faf4e9; }
.capture-panel>.policy-details[open] { padding-bottom: 14px; }
.capture-subhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 10px; }
.capture-subhead h3 { margin: 0; font-size: 15px; }
.capture-subhead p { margin: 3px 0 0; font-size: 11px; }
.capture-subhead .count { flex: none; padding: 5px 10px; }
.capture-ip { color: #66513a; }
.capture-last-image { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-top: 7px; padding-top: 6px; border-top: 1px solid #e8dece; }
.capture-last-image span { color: var(--muted); font-size: 10px; }
.capture-last-image small { display: inline; }
.capture-empty { margin: 0 0 18px; padding: 22px 18px; border: 1px dashed #d3c2a5; border-radius: 8px; background: #faf5eb; color: var(--muted); font-size: 12px; text-align: center; }
.capture-legacy { max-width: none; margin: 18px 0 22px; padding: 12px 14px; border: 1px solid #e4d8c6; border-radius: 9px; background: #faf4e9; }
.capture-legacy[open] { padding-bottom: 15px; }
.capture-legacy>button { margin: 3px 0 13px; }
.capture-ip-table { margin: 10px 0; }
.capture-gallery-title { display: flex; align-items: center; gap: 9px; margin: 0 0 13px !important; padding-top: 19px; border-top: 1px solid #e5d9c6; }
.capture-group { margin: 8px 0; overflow: hidden; border: 1px solid #dfd0b8; border-radius: 9px; background: #fcf8f0; }
.capture-group-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 14px; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
.capture-group-summary::-webkit-details-marker { display: none; }
.capture-group-summary::after { content: ""; width: 8px; height: 8px; margin-left: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .16s ease; }
.capture-group[open]>.capture-group-summary { border-bottom: 1px solid #e7dccb; }
.capture-group[open]>.capture-group-summary::after { transform: rotate(225deg); }
.capture-group-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.capture-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.capture-group-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.capture-group-actions label { margin: 0; color: var(--muted); font-size: 11px; }
.capture-group>.gallery { padding: 0 12px 12px; }
.capture-panel .gallery figure { display: flex; flex-direction: column; min-height: 100%; padding: 10px; border: 1px solid #e5d8c4; border-radius: 9px; background: #fffdf8; }
.capture-panel .gallery figure>a { display: block; }
.capture-panel .gallery figcaption { flex: 1; padding: 9px 2px; }
.capture-panel .gallery button { margin-top: auto; }
.capture-panel .gallery img { background: #f2ecdf; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.row-actions :is(button,.button) { min-height: 35px; padding: 6px 10px; font-size: 11px; }
.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: 23px 0 13px; }
.policy-details { max-width: 100ch; margin: -5px 0 18px; color: var(--muted); font-size: 12px; }
.policy-details p { margin: 8px 0 0; }
.form-grid { display: grid; align-items: end; gap: 13px; margin: 0 0 18px; padding: 15px; border: 1px solid #e1d3bd; border-radius: 9px; background: #faf5eb; }
.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: 12px; 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: 12px; }
.admin-dialog { width: min(760px,calc(100vw - 28px)); max-height: min(90vh,900px); padding: 24px; overflow: auto; border: 1px solid #c6a779; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px rgba(50,35,20,.34); }
.admin-dialog--small { width: min(480px,calc(100vw - 28px)); }
.admin-dialog::backdrop { background: rgba(37,28,21,.62); }
.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: #725c43; font-size: 10px; letter-spacing: .08em; }
.page-footer span { letter-spacing: 0; }
.login { max-width: 450px; margin: min(12vh,100px) auto 40px; padding: 34px; border: 1px solid #c8a776; border-radius: 16px; background: rgba(255,250,241,.94); box-shadow: 0 24px 60px rgba(69,49,28,.19), inset 0 1px rgba(255,255,255,.9); }
.login .brand-mark { margin-bottom: 22px; }
.login h1 { font-size: 28px; }
.login form { margin-top: 26px; }
.login input { margin-bottom: 16px; }
.full { width: 100%; }
.footnote { margin: 22px 0 0; color: var(--muted); font-size: 11px; }

@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: 252px; } .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: 16px; }
  .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: 88px; padding: 12px; }
  .stats strong { font-size: 24px; }
  .section-head { padding: 15px; }
  .search { padding: 0 15px 15px; }
  .detail { padding: 0 15px 17px; }
  .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: 16px; }
  .operations-panel .gallery, .gallery { grid-template-columns: 1fr; }
  .import, .list-footer, .page-footer { display: block; }
  .import small, .page-footer span { margin-top: 8px; }
  .login { margin: 5vh 12px; padding: 25px; }
}
@media (max-width: 390px) {
  .workspace { padding-inline: 11px; }
  .stats>div { padding: 10px; }
  .stats span { font-size: 10px; }
  .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,transform .16s ease; } }
