/* Layout: ruby sidebar beside a white content column (max 1200px); each page = header, KPI strip, filters, panels.
   Palette: white is the primary surface, a dark ruby (close to maroon) is the secondary/brand colour. Single light theme by design. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #faf5f5;
  --ink: #22161a;
  --muted: #6e5f63;
  --line: #ece3e4;
  --accent: #8b1a2b;          /* ruby */
  --accent-deep: #6e1222;     /* maroon */
  --accent-ink: #ffffff;
  --accent-soft: #f8ebed;
  --side-bg: #741526;
  --side-ink: #ffffff;
  --side-muted: rgba(255, 255, 255, .72);
  --side-hover: rgba(255, 255, 255, .10);
  --side-line: rgba(255, 255, 255, .16);
  --st-extracted: #2f7d4f;
  --st-reviewed: #4b6584;
  --st-pending: #9b9093;
  --st-skipped: #b7791f;
  --st-other: #7b5ea7;
  --shadow: 0 1px 2px rgba(60, 20, 28, .05), 0 4px 14px rgba(60, 20, 28, .05);
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }

/* sidebar shell */
.shell { display: grid; grid-template-columns: auto 1fr; min-height: 100vh; }
.content { min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 248px; background: linear-gradient(180deg, var(--side-bg), var(--accent-deep)); color: var(--side-ink);
  display: flex; flex-direction: column; gap: 8px; padding: 16px 12px; transition: width .2s ease; overflow: hidden; z-index: 30; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 14px; border-bottom: 1px solid var(--side-line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--side-ink); font-family: var(--font-head); font-size: 16px; line-height: 1.15; min-width: 0; }
.brand-logo { flex: 0 0 auto; width: 52px; height: 44px; border-radius: 9px; background: #ffffff; display: grid; place-items: center; padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-logo.sm { width: 40px; height: 34px; padding: 3px; border-radius: 7px; }
.brand-text { font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: .02em; white-space: nowrap; }
.side-toggle, .menu-btn { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--side-line); background: transparent; color: var(--side-muted); display: grid; place-items: center; cursor: pointer; }
.side-toggle:hover, .menu-btn:hover { color: var(--side-ink); background: var(--side-hover); }
.side-toggle svg { transition: transform .2s ease; }
.side-nav { display: grid; gap: 4px; margin-top: 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--side-muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.side-nav a svg { flex: 0 0 20px; }
.side-nav a:hover { background: var(--side-hover); color: var(--side-ink); }
.side-nav a.on { background: #ffffff; color: var(--accent); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.side-foot { margin: auto 4px 0; font-size: 12px; color: var(--side-muted); }
.sidebar :focus-visible { outline-color: #ffffff; }
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .side-nav span, .sidebar.collapsed .side-foot { display: none; }
.sidebar.collapsed .side-head { flex-direction: column; padding-inline: 0; }
.sidebar.collapsed .side-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .brand-logo { width: 44px; height: 38px; padding: 3px; }
.sidebar.collapsed .side-nav a { justify-content: center; padding: 10px 0; }
.mobilebar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 22, .45); z-index: 25; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; width: 260px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  .sidebar.open { transform: none; }
  .sidebar.collapsed { width: 260px; }
  .sidebar.collapsed .brand-text, .sidebar.collapsed .side-nav span, .sidebar.collapsed .side-foot { display: revert; }
  .side-toggle { display: none; }
  .mobilebar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--side-bg); color: var(--side-ink);
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); font-family: var(--font-head); font-size: 17px; }
}

/* page head */
.page { padding-block: 28px 48px; display: grid; gap: 22px; }
.eyebrow { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: clamp(28px, 4vw, 38px); line-height: 1.1; margin: 4px 0 6px; text-wrap: balance; }
h2 { font-family: var(--font-head); font-weight: 600; font-size: 21px; margin: 0; }
h3 { font-family: var(--font-head); font-weight: 600; font-size: 16px; margin: 0 0 10px; }
.lede { margin: 0; color: var(--muted); max-width: 70ch; }
.lede b { color: var(--ink); font-weight: 600; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-family: var(--font-head); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.kpi .n { font-size: 13px; color: var(--muted); }
.kpi.accent { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border-color: var(--accent-deep); color: var(--accent-ink); }
.kpi.accent .k, .kpi.accent .n { color: inherit; opacity: .85; }

/* dashboard */
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--font-body); font-weight: 600; margin: 4px 0 -10px; }
.linkcard { text-decoration: none; color: inherit; display: block; min-width: 0; font: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.linkcard .kpi { position: relative; height: 100%; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.linkcard:hover .kpi { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60, 20, 28, .08), 0 10px 24px rgba(60, 20, 28, .12); }
.linkcard .go { position: absolute; right: 14px; top: 12px; color: var(--accent); opacity: 0; transition: opacity .15s ease; }
.linkcard .kpi.accent .go { color: var(--accent-ink); }
.linkcard:hover .go, .linkcard:focus-visible .go, .linkcard.is-open .go { opacity: 1; }
.linkcard .go { transition: opacity .15s ease, transform .2s ease; }
.linkcard.is-open .go { transform: rotate(180deg); }
.linkcard.is-open .kpi { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.home-grid .panel-head { margin-bottom: 10px; }
.home-grid .hint { margin: -4px 0 10px; }
.more-link { font-size: 14px; font-weight: 500; text-decoration: none; }
.more-link:hover { text-decoration: underline; }
.barlist { display: grid; gap: 2px; }
.barrow { display: grid; grid-template-columns: minmax(0, 13rem) 1fr auto; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--ink);
  font: inherit; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.barrow:hover, .barrow.is-open { background: var(--accent-soft); }
.barrow.static { cursor: default; }
.barrow.static:hover { background: none; }
.barrow .bl { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .bt { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; display: flex; }
.barrow .bf { display: block; height: 100%; background: var(--accent); flex: 0 0 auto; }
.barrow .bf:first-child { border-radius: 5px 0 0 5px; }
.barrow .bf:last-child { border-radius: 0 5px 5px 0; }
.barrow .bf:only-child { border-radius: 5px; }
.barrow .bv { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.barrow:hover .bv { color: var(--accent); }
.stack.big { height: 18px; border-radius: 9px; margin-bottom: 10px; }
.stack.big a { display: block; min-width: 3px; }
.stack.big a:hover { filter: brightness(1.12); }
.recent { display: grid; gap: 2px; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.recent-row:hover { background: var(--accent-soft); }
.recent-date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent-row .go { color: var(--accent); }
@media (max-width: 480px) { .barrow { grid-template-columns: minmax(0, 8rem) 1fr auto; gap: 8px; } }

/* charts */
.chart-panel { display: flex; flex-direction: column; }
.chart-panel.wide { grid-column: 1 / -1; }
.chart { min-height: 120px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; }
.chart-svg .val { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-svg .area { fill: var(--accent); opacity: .1; }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart-svg .line.thin { stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart-svg .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart-svg .col { fill: var(--accent); cursor: pointer; transition: opacity .15s ease; }
.chart-svg .col:hover, .chart-svg .col.is-open, .chart-svg .col:focus-visible { opacity: .8; outline: none; stroke: var(--accent-deep); stroke-width: 2; }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, 200px) 1fr; gap: 18px; align-items: center; }
.donut { width: 100%; height: auto; }
.donut .seg { cursor: pointer; stroke: var(--surface); stroke-width: 2; transition: opacity .15s ease; }
.donut .seg:hover, .donut .seg:focus-visible { opacity: .82; outline: none; }
.donut-num { font-family: var(--font-head); font-size: 30px; font-weight: 700; fill: var(--ink); }
.donut-lbl { font-size: 12px; fill: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.donut-legend { display: grid; gap: 2px; }
.leg { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; border-radius: 8px; padding: 7px 8px; text-align: left; cursor: pointer; }
.leg:hover, .leg.is-open { background: var(--accent-soft); }
.leg-v { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.is-open { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }

/* inline detail panels */
.detail { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 16px 18px; box-shadow: 0 8px 28px rgba(60, 20, 28, .1); display: grid; gap: 12px; animation: drop .18s ease-out; }
.detail.inpanel { margin-top: 14px; box-shadow: none; background: var(--surface-2); border-color: var(--line); }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-head h3 { margin: 0; font-size: 18px; }
.detail-actions { display: flex; align-items: center; gap: 14px; }
.detail-x { font-size: 22px; line-height: 1; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.detail-x:hover { color: var(--accent); border-color: var(--accent); }
.mini { display: grid; gap: 8px; min-width: 0; }
.mini-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mini-search { flex: 0 1 300px; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--surface); color: var(--ink); }
.mini-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.mini .tbl { font-size: 13px; }
.mini .tbl th, .mini .tbl td { padding: 7px 10px; }
.mini .tbl tbody tr { cursor: default; }
.mini .tbl tbody tr.go-row { cursor: pointer; }
.mini .tbl td.wrapcell { white-space: normal; min-width: 200px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-card { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--ink); max-width: 100%; }
.mini-card:hover { border-color: var(--accent); }
.cat-mini { display: grid; gap: 10px; }
.cat-mini .stats { margin: 0; }
.barlist.two-col { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); column-gap: 18px; }
@media (max-width: 640px) { .donut-wrap { grid-template-columns: 1fr; } .donut { max-width: 220px; margin: 0 auto; } }

/* status bar */
.statusbar { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.stack span { display: block; min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters.tight { margin-bottom: 4px; }
.search { flex: 1 1 260px; min-width: 0; }
.search input, .filters select, .big-select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; min-height: 40px;
}
.filters select { width: auto; max-width: 100%; }
.big-select { font-size: 16px; font-weight: 500; max-width: 560px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.on b { color: inherit; opacity: .8; }
.count { margin: 0; font-size: 13px; color: var(--muted); }

/* file cards */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; text-align: left; font: inherit; color: inherit; padding: 0; }
.fcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60, 20, 28, .08), 0 10px 24px rgba(60, 20, 28, .12); }
.cover { aspect-ratio: 3 / 4; background: var(--surface-2); border-bottom: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; position: relative; }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.cover .ph { font-family: var(--font-head); font-size: 22px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.cover .pill { position: absolute; left: 8px; top: 8px; }
.fbody { padding: 10px 12px 12px; display: grid; gap: 4px; min-width: 0; }
.fname { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.fman { font-size: 13px; color: var(--accent); font-weight: 500; }
.fmeta { font-size: 12px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.s-extracted { color: var(--st-extracted); }
.pill.s-reviewed { color: var(--st-reviewed); }
.pill.s-pending { color: var(--st-pending); }
.pill.s-skipped { color: var(--st-skipped); }
.pill.s-other { color: var(--st-other); }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* catalog picker */
.picker { position: relative; width: min(560px, 100%); }
.picker-btn { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 8px 8px; cursor: pointer; box-shadow: var(--shadow); }
.picker-btn:hover, .picker-btn[aria-expanded="true"] { border-color: var(--accent); }
.picker-thumb { flex: 0 0 36px; width: 36px; height: 48px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.picker-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.picker-text { display: grid; min-width: 0; flex: 1; }
.picker-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-caret { color: var(--accent); font-size: 14px; }
.picker-pop { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(60, 20, 28, .16); overflow: hidden; }
.picker-search { padding: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.picker-search input { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); color: var(--ink); }
.picker-list { max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.picker-gname { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; padding: 10px 10px 4px; }
.picker-opt { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.picker-opt.active { background: var(--accent-soft); }
.picker-opt.selected .picker-title { color: var(--accent); }
.picker-check { color: var(--accent); font-weight: 700; }
.picker-empty { margin: 0; padding: 16px; color: var(--muted); font-size: 14px; }

/* filter dropdowns */
.dd { position: relative; }
.dd-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; min-height: 40px; cursor: pointer; max-width: 100%; }
.dd-btn:hover, .dd-btn[aria-expanded="true"] { border-color: var(--accent); }
.dd-btn.set { border-color: var(--accent); background: var(--accent-soft); }
.dd-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dd-value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.dd-btn.set .dd-value { color: var(--accent); }
.dd-pop { position: absolute; z-index: 15; left: 0; top: calc(100% + 6px); width: max(100%, 300px); max-width: calc(100vw - 32px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(60, 20, 28, .16); overflow: hidden; }
.dd-list { max-height: min(360px, 55vh); overflow-y: auto; padding: 6px; outline: none; }
.dd-opt { display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.dd-opt.active { background: var(--accent-soft); }
.dd-opt.selected .dd-text { color: var(--accent); font-weight: 600; }
.dd-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* catalog detail */
.cat-detail { display: grid; grid-template-columns: 170px 1fr; gap: 22px; }
.cat-detail .cover { border: 1px solid var(--line); border-radius: 8px; }
.cat-title { font-family: var(--font-head); font-size: 24px; font-weight: 600; margin: 0; line-height: 1.2; }
.cat-sub { color: var(--muted); margin: 4px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--font-head); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.why { margin: 0 0 8px; }
.why b { font-weight: 600; }
.notes { color: var(--muted); font-size: 14px; margin: 0; }
.coverage { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.coverage .bar { flex: 0 0 140px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.coverage .bar span { display: block; height: 100%; background: var(--st-extracted); }

/* browse */
.browse { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
.cats ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 620px; overflow-y: auto; }
.cats button { width: 100%; font: inherit; font-size: 14px; text-align: left; background: none; border: 0; color: var(--ink); padding: 7px 10px; border-radius: 6px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.cats button:hover { background: var(--surface-2); }
.cats button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cats button span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.products { min-width: 0; display: grid; gap: 12px; align-content: start; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 0; display: flex; flex-direction: column; transition: border-color .15s ease; }
.pcard:hover { border-color: var(--accent); }
.pimg { aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.pimg img { max-width: 92%; max-height: 92%; object-fit: contain; }
.pimg .ph { color: #9aa4af; font-size: 12px; }
.pbody { padding: 10px 12px; display: grid; gap: 3px; }
.pname { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.pcat { font-size: 12px; color: var(--muted); }
.ppn { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.more { text-align: center; }
.btn { font: inherit; font-weight: 500; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; cursor: pointer; user-select: none; }
.tbl th.sorted::after { content: " ▾"; }
.tbl th.sorted.asc::after { content: " ▴"; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.on td { background: var(--accent-soft); }
.tbl .mono { font-family: var(--font-mono); font-size: 13px; }
.tbl td.wrap { white-space: normal; min-width: 260px; }

/* manufacturer report */
.man-list { display: grid; gap: 14px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mcard > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; }
.mcard > summary::-webkit-details-marker { display: none; }
.mname { font-family: var(--font-head); font-size: 19px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mfacts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.mfacts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chev { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); transition: transform .2s ease; }
.mcard[open] .chev { transform: rotate(180deg); }
.mbody { border-top: 1px solid var(--line); padding: 14px 20px 18px; display: grid; gap: 14px; }
.chosen { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }
.chosen .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.mfile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mfile:last-child { border-bottom: 0; }
.mfile .t { font-weight: 500; overflow-wrap: anywhere; }
.mfile .d { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.mfile .k { font-size: 12px; color: var(--muted); }
.match { font-size: 12px; font-weight: 600; color: var(--st-skipped); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 16, 22, .55); }
.modal-card { position: relative; background: var(--surface); border-radius: 12px; width: min(900px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-x { position: absolute; right: 12px; top: 10px; font-size: 26px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; }
.m-grid { display: grid; grid-template-columns: 280px 1fr; gap: 22px; }
.gallery { display: grid; gap: 8px; align-content: start; }
.gallery .main { background: #fff; border: 1px solid var(--line); border-radius: 8px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.gallery .main img { max-width: 94%; max-height: 94%; object-fit: contain; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs button { width: 54px; height: 54px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; display: grid; place-items: center; overflow: hidden; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { max-width: 90%; max-height: 90%; }
.m-title { font-family: var(--font-head); font-size: 24px; font-weight: 600; margin: 0 30px 4px 0; line-height: 1.2; }
.m-sub { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.m-desc { margin: 0 0 10px; }
.m-feat { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.m-sec { margin-top: 18px; }

/* footer */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding-block: 18px 28px; }

@media (max-width: 820px) {
  .browse { grid-template-columns: 1fr; }
  .cats ul { max-height: 220px; }
  .cat-detail { grid-template-columns: 110px 1fr; }
  .m-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-detail { grid-template-columns: 1fr; }
  .cat-detail .cover { max-width: 160px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* access-key gate (lock.js) */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--side-bg), var(--accent-deep)); }
.gate-card { width: min(100%, 400px); background: var(--surface); border-radius: 14px; padding: 32px 28px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: grid; gap: 6px; }
.gate-logo { width: 72px; height: 60px; margin-bottom: 10px; box-shadow: none; border: 1px solid var(--line); }
.gate-card h1 { font-family: var(--font-head); font-size: 26px; line-height: 1.15; margin: 0; }
.gate-lede { margin: 0 0 14px; color: var(--muted); }
.gate-label { font-weight: 600; font-size: 13px; }
.gate-field { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.gate-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-field input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 11px 12px; font: 15px var(--font-mono); background: transparent; color: var(--ink); }
.gate-show { border: 0; border-left: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 500 13px var(--font-body); padding: 0 14px; cursor: pointer; }
.gate-show:hover { color: var(--accent); }
.gate-remember { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-top: 8px; cursor: pointer; }
.gate-remember input { accent-color: var(--accent); width: 16px; height: 16px; }
.gate-msg { margin: 6px 0 0; padding: 9px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-deep); font-size: 14px; }
.gate-submit { margin-top: 14px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 11px 16px; }
.gate-submit:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--accent-ink); }
.gate-submit:disabled { opacity: .7; cursor: progress; }
.side-lock { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--side-line); background: transparent; color: var(--side-muted); font: 500 14px var(--font-body); cursor: pointer; white-space: nowrap; }
.side-lock:hover { background: var(--side-hover); color: var(--side-ink); }
.side-lock svg { flex: 0 0 18px; }
.sidebar.collapsed .side-lock { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .side-lock span { display: none; }
@media (max-width: 900px) { .sidebar.collapsed .side-lock span { display: revert; } .sidebar.collapsed .side-lock { justify-content: flex-start; padding: 9px 12px; } }
