/* Catalog Scanner — proofreading marks for music metadata.
   Red marks what is wrong; blue pencil writes the correction. */
:root {
  --ink: #1e2b5c;          /* brand ink, top bar, primary actions */
  --ink-2: #33458f;
  --pencil: #2444c4;       /* corrections ("blue pencil") */
  --pencil-wash: #e9eefc;
  --paper: #ffffff;
  --canvas: #f1f3f8;
  --text: #1b2130;
  --muted: #5d6577;
  --rule: #d9deea;
  --rule-2: #c5ccdc;
  --red: #c22f2a;          /* wrong / missing */
  --red-wash: #fcecea;
  --amber: #9a6200;
  --amber-wash: #fff3db;
  --slate: #4b5a78;
  --slate-wash: #edf0f6;
  --green: #1f6e4c;
  --green-wash: #e3f2ea;
  --focus: #2444c4;
  /* priorities */
  --p-critical: #b3261e; --p-critical-wash: #fbe7e5;
  --p-high: #b8470b;     --p-high-wash: #fdeee3;
  --p-medium: #8a6100;   --p-medium-wash: #fff4d6;
  --p-low: #4b5a78;      --p-low-wash: #edf0f6;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "DejaVu Sans Mono", monospace;
  --r-sm: 5px;
  --r-md: 8px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --t-xs: 12.5px; --t-sm: 13.5px; --t-md: 15px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 28px;
  --shadow: 0 10px 40px rgba(18, 26, 56, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #9fb0f2; --ink-2: #b9c6fa; --pencil: #8ea6ff; --pencil-wash: #1d2547;
    --paper: #161a24; --canvas: #0f121a; --text: #e6e9f2; --muted: #9aa2b6; --rule: #2a3142; --rule-2: #39425a;
    --red: #ff7b72; --red-wash: #3a1d1f; --amber: #f0b64c; --amber-wash: #3a2c12; --slate: #a9b5d1;
    --slate-wash: #1e2433; --green: #6fd3a3; --green-wash: #14301f; --focus: #8ea6ff;
    --p-critical: #ff8a80; --p-critical-wash: #3d1a1a; --p-high: #ffab70; --p-high-wash: #3a2414;
    --p-medium: #f2c25b; --p-medium-wash: #352a10; --p-low: #aab6d3; --p-low-wash: #1e2433;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--t-md)/1.45 var(--font); color: var(--text); background: var(--canvas); }
a { color: var(--ink-2); text-underline-offset: 2px; }
a:hover { color: var(--pencil); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p { margin: 0 0 var(--s3); }
code, .mono, kbd, pre { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { font-size: 0.92em; background: var(--slate-wash); padding: 0 4px; border-radius: 3px; overflow-wrap: anywhere; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--slate-wash); padding: var(--s3); border-radius: var(--r-sm); font-size: var(--t-xs); max-height: 360px; overflow: auto; }
.muted { color: var(--muted); }
.small { font-size: var(--t-xs); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.stack { display: grid; gap: var(--s3); }
.stack > .btn, .stack > button { justify-self: start; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s3); top: var(--s3); z-index: 99; background: var(--paper); padding: var(--s2) var(--s3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.ok-text { color: var(--green); font-weight: 600; }
.sev-error-text { color: var(--red); font-weight: 600; }
.sev-warning-text { color: var(--amber); font-weight: 600; }

/* ---- top bar ---------------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: var(--s5); height: 54px; padding: 0 var(--s4); background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
@media (prefers-color-scheme: dark) { .topbar { background: #1b2342; } }
.brand { display: flex; align-items: center; gap: var(--s2); color: #fff; text-decoration: none; font-weight: 700; font-size: var(--t-md); white-space: nowrap; }
.brand svg { width: 26px; height: 26px; color: #fff; }
.brand:hover { color: #fff; }
.topnav { display: flex; align-items: stretch; gap: var(--s1); height: 100%; overflow-x: auto; scrollbar-width: none; }
.topnav a { display: flex; align-items: center; gap: 6px; padding: 0 var(--s3); color: #d6dcf8; text-decoration: none; font-size: var(--t-sm); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; border-bottom-color: #f07a72; }
.badge { background: #f07a72; color: #1b1f33; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.usermenu { margin-left: auto; }
.who { display: flex; align-items: center; gap: var(--s2); color: #fff; cursor: pointer; list-style: none; font-size: var(--t-sm); }
.who::-webkit-details-marker { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-weight: 700; }
.role-tag { font-size: 11px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 4px; padding: 0 5px; color: #dfe4fb; }

/* ---- menus (⋯ and user) ------------------------------------------------------------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; top: calc(100% + 6px); min-width: 190px; background: var(--paper); color: var(--text); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 4px; z-index: 40; display: grid; }
details.menu.right .menu-list { right: 0; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; font: 600 var(--t-sm) var(--font); color: var(--text); text-decoration: none; border-radius: var(--r-sm); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list button:focus-visible { background: var(--pencil-wash); color: var(--pencil); }
.menu-list form { margin: 0; }

/* ---- generic page ------------------------------------------------------------------ */
.page { max-width: 1120px; margin: 0 auto; padding: var(--s5) var(--s4) 80px; }
.page.wide { max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin: var(--s2) 0 var(--s5); flex-wrap: wrap; }
.page-head h1 { margin-bottom: var(--s2); }
.page-head p { margin: 0; max-width: 78ch; }
.head-tools { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.head-tools select { width: auto; max-width: 340px; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s5); margin-bottom: var(--s4); }
.panel.narrow { max-width: 640px; }
.panel h2 { margin-bottom: var(--s3); }
.empty { background: var(--paper); border: 1px dashed var(--rule-2); border-radius: var(--r-md); padding: var(--s6); max-width: 640px; }
.empty h2 { margin-bottom: var(--s2); }
.alert { background: var(--amber-wash); border-left: 3px solid var(--amber); padding: var(--s3) var(--s4); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.alert.error { background: var(--red-wash); border-left-color: var(--red); }
.alert.ok { background: var(--green-wash); border-left-color: var(--green); }
.alert.small { font-size: var(--t-xs); padding: var(--s2) var(--s3); }
.flash { max-width: 1320px; margin: var(--s3) auto 0; padding: 0 var(--s4); }
.flash span { display: block; background: var(--green-wash); border-left: 3px solid var(--green); padding: var(--s3) var(--s4); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--t-sm); }
.flash.error span { background: var(--red-wash); border-left-color: var(--red); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--pencil); background: var(--pencil-wash); border-radius: 4px; padding: 1px 6px; vertical-align: 2px; }
.pill { display: inline-block; font-size: var(--t-xs); font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--slate-wash); color: var(--slate); white-space: nowrap; }
.pill.ok { background: var(--green-wash); color: var(--green); }
.pill.running { background: var(--pencil-wash); color: var(--pencil); }
.pill.sev-error { background: var(--red-wash); color: var(--red); }

/* ---- controls -------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 var(--t-sm)/1 var(--font); padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--rule-2); background: var(--paper); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #0f121a; } }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--slate-wash); }
.btn.small { padding: 6px 10px; font-size: var(--t-xs); }
.btn.wide { width: 100%; padding: 12px; }
.btn.huge { font-size: var(--t-lg); padding: 18px 28px; border-radius: var(--r-md); gap: 10px; }
.btn.huge svg { width: 24px; height: 24px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.busy { cursor: progress; opacity: .7; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkish.danger { color: var(--red); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--slate-wash); color: var(--text); border-color: var(--rule); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn svg path { fill: none; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
label { display: grid; gap: 6px; font-weight: 600; font-size: var(--t-sm); }
label .hint, .hint { font-weight: 400; font-size: var(--t-xs); color: var(--muted); }
input, select, textarea { font: 400 var(--t-md)/1.3 var(--font); color: var(--text); background: var(--paper); border: 1px solid var(--rule-2); border-radius: var(--r-sm); padding: 8px 10px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ink); }
.row input, .row select { width: auto; }
.row label.grow, label.grow { flex: 1 1 220px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
fieldset { border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s3) var(--s4) var(--s4); margin: 0; display: grid; gap: var(--s3); }
legend { font-weight: 700; font-size: var(--t-sm); padding: 0 6px; }
label.check { display: flex; gap: var(--s3); align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 3px; }
label.check strong { display: block; font-size: var(--t-sm); }
label.check span .muted { display: block; }
label.check.disabled { opacity: .6; }
details > summary { cursor: pointer; font-weight: 600; font-size: var(--t-sm); }
progress { width: 100%; height: 8px; accent-color: var(--ink); }

/* ---- tables ---------------------------------------------------------------------- */
.grid { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.grid th, .grid td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.grid thead th { font-size: var(--t-xs); color: var(--muted); font-weight: 600; background: var(--canvas); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid.compact th, .grid.compact td { padding: 7px 10px; font-size: var(--t-sm); }
.table-scroll { overflow-x: auto; }

/* ---- proof marks: the core visual language ---------------------------------------- */
del { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 1.5px; overflow-wrap: anywhere; }
ins { text-decoration: none; color: var(--pencil); font-weight: 600; overflow-wrap: anywhere; }
ins .caret { color: var(--pencil); font-weight: 700; margin-right: 1px; position: relative; top: .25em; }
.proof { overflow-wrap: anywhere; }

/* ---- priorities -------------------------------------------------------------------- */
.pri-badge { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 4px; white-space: nowrap; background: var(--green-wash); color: var(--green); }
.pri-badge.pri-critical { background: var(--p-critical); color: #fff; }
.pri-badge.pri-high { background: var(--p-high-wash); color: var(--p-high); box-shadow: inset 0 0 0 1px var(--p-high); }
.pri-badge.pri-medium { background: var(--p-medium-wash); color: var(--p-medium); }
.pri-badge.pri-low { background: var(--p-low-wash); color: var(--p-low); }
@media (prefers-color-scheme: dark) { .pri-badge.pri-critical { color: #1b0d0c; } }
.pri-counts { display: inline-flex; flex-wrap: wrap; gap: 4px var(--s2); }
.pc { font-weight: 600; white-space: nowrap; }
.pc.pri-critical { color: var(--p-critical); }
.pc.pri-high { color: var(--p-high); }
.pc.pri-medium { color: var(--p-medium); }
.pc.pri-low { color: var(--p-low); }
.pri-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: 1px; background: var(--p-low); }
.pri-dot.pri-critical { background: var(--p-critical); }
.pri-dot.pri-high { background: var(--p-high); }
.pri-dot.pri-medium { background: var(--p-medium); }

/* ---- login ----------------------------------------------------------------------- */
.login-body { background: var(--canvas); }
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login-card { width: min(430px, 100%); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s6) var(--s5); }
.login-card h1 { font-size: var(--t-xl); margin-bottom: var(--s2); }
.login-card .lede { color: var(--muted); }
.login-card .stack { margin: var(--s4) 0 var(--s3); }
.login-links { margin: var(--s3) 0 0; }
.code-input { font: 600 26px/1 var(--mono); letter-spacing: .3em; text-align: center; padding: 12px; }
.resend { margin: 0; }
.consent-list { padding-left: 18px; display: grid; gap: 4px; }

/* ---- scan page -------------------------------------------------------------------- */
.scan-hero { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s5); margin-bottom: var(--s4); box-shadow: inset 4px 0 0 var(--ink); }
.scan-hero.off { box-shadow: inset 4px 0 0 var(--rule-2); }
.scan-form { display: grid; gap: var(--s4); }
.hero-main { display: flex; justify-content: space-between; gap: var(--s5); align-items: center; flex-wrap: wrap; }
.hero-main h2 { font-size: var(--t-xl); margin-bottom: var(--s2); }
.hero-main p { margin: 0; max-width: 60ch; }
.src-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s3) var(--s5); }
details.options { border-top: 1px solid var(--rule); padding-top: var(--s3); }
details.options[open] > summary { margin-bottom: var(--s3); }
details.options > div, details.options > label { margin-bottom: var(--s3); }
.demo-card { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.demo-card h2 { margin-bottom: var(--s2); }
.demo-card p { margin: 0; max-width: 64ch; }
.scan-running .phase { font-weight: 600; margin: var(--s2) 0; }
.history { margin-top: var(--s5); }
.history h2 { margin-bottom: var(--s3); }
details.why summary { color: var(--red); }

/* ---- issues page -------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.tile { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); text-decoration: none; color: var(--text); border-top: 4px solid var(--p-low); }
.tile .t-n { font-size: var(--t-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .t-l { font-weight: 600; color: var(--muted); }
.tile.pri-critical { border-top-color: var(--p-critical); }
.tile.pri-critical .t-n { color: var(--p-critical); }
.tile.pri-high { border-top-color: var(--p-high); }
.tile.pri-high .t-n { color: var(--p-high); }
.tile.pri-medium { border-top-color: var(--p-medium); }
.tile.pri-medium .t-n { color: var(--p-medium); }
.tile:hover { border-color: var(--ink-2); color: var(--text); }
.tile.on { background: var(--pencil-wash); border-color: var(--pencil); }
.tile.on .t-l { color: var(--pencil); }
.tile.on .t-l::after { content: " ✓"; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin-bottom: var(--s3); }
.filters label { flex: 0 1 230px; }
.filters label.grow { flex: 1 1 240px; }
.list-count { margin: var(--s2) 0; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.prow { display: grid; grid-template-columns: 82px minmax(0, 1.25fr) minmax(0, 1.2fr) minmax(130px, .55fr) auto; gap: var(--s3); align-items: center; background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--green); border-radius: var(--r-md); padding: 10px var(--s3) 10px var(--s3); }
.prow.pri-critical { border-left-color: var(--p-critical); }
.prow.pri-high { border-left-color: var(--p-high); }
.prow.pri-medium { border-left-color: var(--p-medium); }
.prow.pri-low { border-left-color: var(--p-low); }
.prow.active { outline: 2px solid var(--pencil); outline-offset: -1px; }
.prow-main { all: unset; cursor: pointer; display: grid; gap: 2px; min-width: 0; }
.prow-main:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.p-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-main:hover .p-title { color: var(--pencil); text-decoration: underline; text-underline-offset: 2px; }
.p-sub { color: var(--muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-problems { font-size: var(--t-sm); min-width: 0; display: flex; flex-wrap: wrap; gap: 2px var(--s2); align-items: baseline; }
.p-issue { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.p-issue + .p-issue::before { content: "· "; color: var(--muted); }
.p-problems .pri-counts { flex-basis: 100%; }
.p-state { display: grid; gap: 3px; justify-items: start; font-size: var(--t-xs); }
.state-tag { font-weight: 700; font-size: var(--t-xs); padding: 2px 8px; border-radius: 999px; text-decoration: none; white-space: nowrap; background: var(--slate-wash); color: var(--slate); }
.state-tag.st-awaiting { background: var(--amber-wash); color: var(--amber); }
.state-tag.st-approved, .state-tag.st-applying { background: var(--pencil-wash); color: var(--pencil); }
.state-tag.st-applied { background: var(--green-wash); color: var(--green); }
.state-tag.st-applied_unverified, .state-tag.st-failed { background: var(--red-wash); color: var(--red); }
.state-tag.st-rejected, .state-tag.st-withdrawn { background: var(--slate-wash); color: var(--muted); }
.needs { color: var(--p-high); font-weight: 600; white-space: nowrap; }
.p-actions { display: flex; gap: 2px; align-items: center; }
.pager { display: flex; gap: var(--s2); justify-content: center; margin-top: var(--s4); }

/* ---- the drawer ------------------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(15, 20, 40, .35); opacity: 0; transition: opacity .18s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(780px, 100%); background: var(--canvas); box-shadow: var(--shadow); transform: translateX(102%); transition: transform .2s ease; overflow-y: auto; overscroll-behavior: contain; }
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-body { padding: var(--s4) var(--s5) 80px; }
.dr-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: start; margin-bottom: var(--s3); }
.dr-id h2 { font-size: var(--t-xl); margin: var(--s2) 0 2px; overflow-wrap: anywhere; }
.dr-id .ver { color: var(--muted); font-weight: 400; }
.dr-artist { margin: 0 0 var(--s2); }
.facts { display: flex; flex-wrap: wrap; gap: 2px var(--s5); margin: 0; font-size: var(--t-sm); }
.facts div { display: flex; gap: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.dr-tools { display: grid; justify-items: end; gap: var(--s2); }
.dr-tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--rule); margin: var(--s3) 0 var(--s4); position: sticky; top: calc(-1 * var(--s4)); background: var(--canvas); z-index: 2; padding-top: var(--s2); }
.dr-tabs button { font: 600 var(--t-sm) var(--font); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 2px; cursor: pointer; }
.dr-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--ink); }
.count { margin-left: 4px; background: var(--pencil-wash); color: var(--pencil); border-radius: 999px; padding: 0 7px; font-size: var(--t-xs); }
.dr-h3 { margin: var(--s5) 0 var(--s2); }
.job-line { display: flex; gap: var(--s2); align-items: center; background: var(--pencil-wash); color: var(--pencil); padding: var(--s2) var(--s3); border-radius: var(--r-sm); font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s3); }
.job-line[hidden] { display: none; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.claude-summary { border-left: 3px solid var(--ink-2); background: var(--slate-wash); padding: var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--t-sm); }
.by-claude { color: var(--ink-2); font-weight: 700; margin-right: 4px; }
.all-clear { background: var(--green-wash); color: var(--green); padding: var(--s3); border-radius: var(--r-sm); font-weight: 600; }
.ilist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.icard { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--p-low); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.icard.pri-critical { border-left-color: var(--p-critical); }
.icard.pri-high { border-left-color: var(--p-high); }
.icard.pri-medium { border-left-color: var(--p-medium); }
.i-top { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.i-where { color: var(--muted); font-size: var(--t-xs); margin: 4px 0 var(--s2); }
.i-msg { font-size: var(--t-sm); margin-bottom: var(--s2); }
.i-why { font-size: var(--t-xs); color: var(--muted); margin-bottom: var(--s2); }
.i-why span { font-weight: 700; color: var(--text); margin-right: 4px; }
.i-values { display: grid; gap: 4px; font-size: var(--t-sm); margin-bottom: var(--s2); background: var(--canvas); border-radius: var(--r-sm); padding: var(--s2) var(--s3); }
.i-values > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--s2); align-items: baseline; }
.i-values .lbl { color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.conf { font-size: 11px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.conf-low { color: var(--amber); }
.claude { font-size: var(--t-xs); background: var(--slate-wash); padding: 6px var(--s2); border-radius: var(--r-sm); margin-bottom: var(--s2); }
.claude.v-false_positive { background: var(--green-wash); }
.claude.v-uncertain { background: var(--amber-wash); }
.evidence { font-size: var(--t-xs); margin-bottom: var(--s2); }
.evidence summary { color: var(--muted); font-size: var(--t-xs); }
.evidence ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.src { font-size: 11px; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; white-space: nowrap; }
.notes { margin: 0 0 var(--s2); padding-left: 18px; font-size: var(--t-xs); color: var(--muted); }
details.dismiss > summary { list-style: none; display: inline; }
details.dismiss > summary::-webkit-details-marker { display: none; }
details.dismiss form { margin-top: var(--s2); }
details.dismiss input { flex: 1 1 240px; }
.closed-list { margin-top: var(--s3); font-size: var(--t-sm); }
.closed-list ul { padding-left: 18px; }
table.ab, table.tracks, table.changes { width: 100%; border-collapse: collapse; font-size: var(--t-sm); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); }
table.ab th, table.ab td, table.tracks th, table.tracks td, table.changes th, table.changes td { padding: 7px var(--s3); border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
table.ab thead th, table.tracks thead th, table.changes thead th { font-size: var(--t-xs); color: var(--muted); font-weight: 600; }
table.ab tbody th { color: var(--muted); font-weight: 600; width: 24%; white-space: nowrap; }
table.ab { margin-bottom: var(--s3); }
.live { display: block; overflow-wrap: anywhere; }
.live.same { color: var(--muted); }
.live .tick { color: var(--green); margin-right: 4px; }
table.tracks td.n, table.tracks th.n { width: 44px; text-align: right; color: var(--muted); }
table.tracks .sub { color: var(--muted); font-size: var(--t-xs); margin-top: 2px; }
.live-diff { color: var(--red); font-weight: 600; }
tr.missing td { background: repeating-linear-gradient(-45deg, var(--red-wash), var(--red-wash) 6px, var(--paper) 6px, var(--paper) 12px); }
.missing-tag { color: var(--red); font-weight: 700; }
.fix-form .lede { font-weight: 600; }
table.changes td input.to { min-width: 180px; font-size: var(--t-sm); padding: 6px 8px; }
table.changes tr.off td { opacity: .45; }
table.changes td:first-child { width: 30px; }
.unres { list-style: none; padding: 0; margin: 0 0 var(--s3); display: grid; gap: var(--s2); }
.unres li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); gap: var(--s3); align-items: center; background: var(--paper); border: 1px dashed var(--rule-2); border-radius: var(--r-md); padding: var(--s2) var(--s3); font-size: var(--t-sm); }
.seal-box { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4); margin-top: var(--s4); display: grid; gap: var(--s3); box-shadow: inset 0 3px 0 var(--ink); }
.seal-box.flash-it { animation: pulse 1.2s ease 1; }
@keyframes pulse { 0% { box-shadow: inset 0 3px 0 var(--ink), 0 0 0 0 rgba(36, 68, 196, .45); } 100% { box-shadow: inset 0 3px 0 var(--ink), 0 0 0 14px rgba(36, 68, 196, 0); } }
.seal-pri { display: flex; gap: var(--s2); align-items: baseline; margin: 0; font-weight: 600; }
.seal-box p { margin: 0; }

/* ---- fix cards (approvals) ------------------------------------------------------------ */
.tabs-bar { display: flex; gap: var(--s5); border-bottom: 1px solid var(--rule); margin-bottom: var(--s4); overflow-x: auto; }
.tabs-bar a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: var(--t-sm); padding: 10px 2px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs-bar a[aria-current="page"] { color: var(--text); border-bottom-color: var(--ink); }
.fix-list { display: grid; gap: var(--s3); }
.list-h { font-size: var(--t-md); margin: var(--s3) 0 0; color: var(--muted); }
.fix-card { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--p-low); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin-bottom: var(--s2); }
.fix-card.pri-critical { border-left-color: var(--p-critical); }
.fix-card.pri-high { border-left-color: var(--p-high); }
.fix-card.pri-medium { border-left-color: var(--p-medium); }
.fc-head { display: flex; flex-wrap: wrap; gap: 4px var(--s2); align-items: baseline; margin-bottom: var(--s2); }
.fc-head h3 { flex-basis: 100%; font-size: var(--t-md); margin-top: 4px; }
.fc-head h3 a { text-decoration: none; }
.fix-changes { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: 4px; font-size: var(--t-sm); }
.fix-changes li { display: grid; grid-template-columns: minmax(110px, 200px) 130px minmax(0, 1fr); gap: var(--s2); align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--rule); }
.fix-changes .where { color: var(--muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fix-changes .fld { font-weight: 600; }
.fix-changes .arrow { color: var(--muted); margin: 0 4px; }
.meta { color: var(--muted); margin: 0 0 4px; }
.note { font-style: italic; margin: 0 0 4px; }
.fc-history { margin: 0 0 var(--s2); padding-left: 18px; color: var(--muted); }
.verify { list-style: none; padding: 0; margin: 0 0 var(--s2); display: grid; gap: 2px; }
.fc-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); }
details.reject > summary, details.upload > summary { list-style: none; }
details.reject > summary::-webkit-details-marker, details.upload > summary::-webkit-details-marker { display: none; }
details.reject[open] { flex-basis: 100%; }
details.reject form { margin-top: var(--s2); }
details.reject input { flex: 1 1 260px; }
.howto { margin-top: var(--s2); }
.copyable { background: var(--slate-wash); padding: 1px 6px; border-radius: 4px; cursor: copy; }

/* ---- connectors ----------------------------------------------------------------------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--s4); align-items: start; }
.conn-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4) var(--s5) var(--s5); }
.conn-card.is-ready { box-shadow: inset 0 3px 0 var(--green); }
.conn-card.via-claude { box-shadow: inset 0 3px 0 var(--pencil); }
.conn-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; margin-bottom: var(--s3); }
.conn-head h2 { font-size: var(--t-lg); }
.conn-head p { margin: 2px 0 0; }
.conn-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--ink); font-size: 18px; }
.logo-audiosalad { background: #e2533c; }
.logo-spotify { background: #1db954; color: #0b2b16; }
.logo-chartmetric { background: #3b5bdb; }
.logo-viberate { background: #6c3df4; }
.logo-claude { background: #d97757; }
.logo-public { background: #4b5a78; }
.logo-mcp { background: #1e2b5c; }
.conn-form { display: grid; gap: var(--s3); margin-top: var(--s3); }
details.advanced { border-top: 1px solid var(--rule); padding-top: var(--s2); }
.adv-grid { display: grid; gap: var(--s3); margin-top: var(--s3); }
.test-result { background: var(--canvas); border-radius: var(--r-sm); padding: var(--s2) var(--s3); margin: var(--s2) 0; }
.test-steps { padding-left: 20px; margin: var(--s2) 0; display: grid; gap: 4px; }
.test-steps .detail { font-weight: 400; color: var(--text); overflow-wrap: anywhere; }
.lists { border-top: 1px solid var(--rule); margin-top: var(--s4); padding-top: var(--s4); display: grid; gap: var(--s3); }
.lists p { margin: 0; }
.steps { padding-left: 20px; display: grid; gap: 6px; }
.websession { scroll-margin-top: 72px; background: var(--canvas); border-radius: var(--r-sm); padding: var(--s3) var(--s4) var(--s4); margin: 0 0 var(--s4); display: grid; gap: var(--s2); }
.websession p { margin: 0; }
.ws-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.ws-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s2); align-items: end; margin-top: var(--s1); }
.ws-open label { display: grid; gap: 4px; font-size: var(--t-sm); font-weight: 600; }
.ws-open .ws-more { grid-column: 1 / -1; }
.ws-open .ws-more label { font-weight: 400; margin-top: var(--s2); }
.conn-sub { margin: var(--s2) 0 var(--s2); }

/* ---- Catalog Scanner's own browser (a window over the Connectors page) -------------------- */
.lb { position: fixed; inset: 0; z-index: 55; background: rgba(12, 16, 32, .6); display: grid; place-items: center; padding: var(--s4); }
.lb[hidden] { display: none; }
.lb-panel { width: min(1200px, 100%); max-height: 100%; overflow: auto; background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow); }
.lb-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); flex-wrap: wrap; }
.lb-title { display: grid; gap: 2px; min-width: 0; }
.lb-title h2 { font-size: var(--t-md); }
.lb-status { font-size: var(--t-xs); color: var(--muted); }
.lb-status[data-kind=ok] { color: var(--green); }
.lb-status[data-kind=error], .lb-status[data-kind=end] { color: var(--red); font-weight: 600; }
.lb-actions { margin-left: auto; display: flex; gap: var(--s2); }
.lb-nav { display: flex; align-items: center; gap: 2px; padding: 6px var(--s3); background: var(--canvas); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.lb-url { flex: 1; min-width: 0; font-size: var(--t-xs); color: var(--muted); background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 12px; margin-left: var(--s2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-screen { position: relative; aspect-ratio: 1280 / 800; background: #10142a; overflow: hidden; touch-action: none; }
.lb-screen img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.lb-screen img:not([src]) { display: none; }
.lb-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #c9d1ea; font-size: var(--t-sm); }
.lb-wait[hidden] { display: none; }
.lb-keys { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; resize: none; border: 0; padding: 0; margin: 0; background: transparent; color: transparent; caret-color: transparent; cursor: default; font-size: 16px; }
.lb-screen:focus-within { box-shadow: inset 0 0 0 2px var(--focus); }
.lb.ended .lb-screen img { opacity: .35; filter: grayscale(1); }
.lb-foot { padding: var(--s2) var(--s4) var(--s3); margin: 0; }
@media (max-width: 760px) {
  .lb { padding: 0; }
  .lb-panel { border-radius: 0; height: 100%; }
  .lb-actions { margin-left: 0; width: 100%; }
  .lb-actions .btn { flex: 1; }
  .ws-open { grid-template-columns: 1fr; }
}

/* ---- team ------------------------------------------------------------------------------ */
.roles { display: grid; gap: var(--s2); margin: 0; }
.roles div { display: grid; grid-template-columns: 100px 1fr; gap: var(--s3); }
.roles dt { font-weight: 700; }
.roles dd { margin: 0; color: var(--muted); }
.kv { display: grid; gap: var(--s2); margin: 0 0 var(--s3); }
.kv div { display: grid; grid-template-columns: 160px 1fr; gap: var(--s3); }
.kv dt { color: var(--muted); font-size: var(--t-sm); }
.kv dd { margin: 0; }
.add-user { margin-top: var(--s4); }
.add-user input { flex: 1 1 180px; }

/* ---- toast ------------------------------------------------------------------------------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--paper); padding: 10px 16px; border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); color: #fff; }

/* ---- responsive ------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .prow { grid-template-columns: 76px minmax(0, 1fr) auto; }
  .p-problems { grid-column: 2 / 3; }
  .p-state { grid-column: 2 / 3; display: flex; flex-wrap: wrap; gap: var(--s2); }
  .p-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 760px) {
  .topbar { gap: var(--s2); padding: 0 var(--s3); }
  .brand span, .who-name, .role-tag { display: none; }
  .topnav a { padding: 0 var(--s2); }
  .page { padding: var(--s4) var(--s4) 60px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prow { grid-template-columns: minmax(0, 1fr) auto; }
  .prow .pri-badge { grid-column: 1; justify-self: start; }
  .prow-main, .p-problems, .p-state { grid-column: 1 / -1; }
  .p-actions { grid-column: 2; grid-row: 1; }
  .drawer-body { padding: var(--s3) var(--s4) 60px; }
  .dr-head { grid-template-columns: 1fr; }
  .dr-tools { justify-items: start; grid-row: 1; display: flex; flex-wrap: wrap; }
  .i-values > div { grid-template-columns: 1fr; gap: 0; }
  .unres li { grid-template-columns: 1fr; }
  .fix-changes li { grid-template-columns: 1fr; gap: 0; }
  table.changes thead { display: none; }
  table.changes, table.changes tbody, table.changes tr, table.changes td { display: block; width: 100%; }
  table.changes tr { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); }
  table.changes td { border: 0; padding: 0; }
  table.changes td:first-child { grid-row: 1 / span 4; width: auto; }
  table.changes td:nth-child(4)::before { content: "Now: "; color: var(--muted); font-size: var(--t-xs); }
  table.changes td:nth-child(5) input.to { width: 100%; min-width: 0; }
  .kv div, .roles div { grid-template-columns: 1fr; gap: 0; }
  .grid { display: block; overflow-x: auto; }
  .btn.huge { width: 100%; }
}
