/* Restore Desk. One stylesheet, no framework. Light and dark: the operator's choice, or the system's. */

:root {
  --bg: #f3f4f7; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef0f4;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e3e6ec; --line-2: #cfd4dd;
  --nav: #0b1220; --nav-ink: #e6eaf2; --nav-muted: #8b96ab; --nav-line: #1c2740;
  --accent: #2f55d4; --accent-hover: #2546b4; --accent-soft: #e8edfc; --accent-ink: #ffffff;
  --red: #c2281d; --red-soft: #fdecea; --orange: #b4540b; --orange-soft: #fdf0e1;
  --amber: #8f6400; --amber-soft: #fcf3d7; --blue: #1d5fc4; --blue-soft: #e6effc;
  --green: #17734b; --green-soft: #e2f4ea; --gray: #55607a; --gray-soft: #eceef3;
  --c-compromised: #d93a2b; --c-locked_out: #e8782a; --c-in_recovery: #e0aa1d; --c-recovered: #3d7fe0; --c-secured: #25a268; --c-closed: #9aa3b5; --c-abandoned: #c3c9d6;
  --radius: 12px; --radius-s: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-l: 0 12px 32px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
/* js/theme.js sets data-theme before the first paint: the saved choice, or else the system's. */
:root[data-theme="dark"] {
  --bg: #0a0f1a; --surface: #111827; --surface-2: #151d2e; --surface-3: #1b2538;
  --ink: #e8ecf4; --ink-2: #c3cbda; --muted: #8e99ae; --faint: #5f6b82;
  --line: #212c42; --line-2: #2d3a55;
  --nav: #070b14; --nav-line: #182238;
  --accent: #7c9bff; --accent-hover: #96afff; --accent-soft: #18244a; --accent-ink: #0a0f1a;
  --red: #ff8b80; --red-soft: #3a1614; --orange: #ffab66; --orange-soft: #3a2210;
  --amber: #f2c94c; --amber-soft: #33290c; --blue: #8cb8ff; --blue-soft: #13254a;
  --green: #5fd699; --green-soft: #0f2e20; --gray: #a5aec2; --gray-soft: #1c2536;
  --shadow: none; --shadow-l: 0 16px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 15.5px; margin: 0; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 11.5px; margin: 0; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
p { margin: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.hide { display: none !important; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 54px; background: var(--nav); color: var(--nav-ink); border-bottom: 1px solid var(--nav-line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); font-weight: 700; letter-spacing: -.01em; font-size: 15.5px; }
.brand:hover { text-decoration: none; }
.brand svg { color: #7c9bff; }
.top nav { display: flex; gap: 2px; }
.top nav a { color: var(--nav-muted); padding: 6px 10px; border-radius: 7px; font-weight: 500; font-size: 13.5px; }
.top nav a:hover { color: var(--nav-ink); text-decoration: none; background: rgba(255, 255, 255, .06); }
.top nav a.on { color: var(--nav-ink); background: rgba(255, 255, 255, .1); }
.top .spacer { flex: 1; min-width: 0; }
.top .who { color: var(--nav-muted); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .icon-btn { color: var(--nav-muted); background: transparent; border: 0; padding: 7px; border-radius: 7px; display: inline-flex; cursor: pointer; }
.top .icon-btn:hover { color: var(--nav-ink); background: rgba(255, 255, 255, .08); }
.top .icon-btn.on { color: #ffd166; }
.timer-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 11px; border-radius: 999px; background: rgba(37, 162, 104, .16); color: #7ee2ae; border: 1px solid rgba(37, 162, 104, .4); font-size: 13px; font-weight: 600; }
.timer-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc91; animation: pulse 1.6s ease-in-out infinite; }
.timer-chip button { border: 0; background: #25a268; color: #04130c; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; }
@keyframes pulse { 50% { opacity: .35; } }
/* A screen that takes a moment to load says so: a line runs under the top bar. */
body.busy .top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: linear-gradient(90deg, transparent, #7c9bff, transparent) no-repeat; background-size: 40% 100%; animation: slide 1s linear infinite; }
@keyframes slide { from { background-position: -70% 0; } to { background-position: 170% 0; } }
/* The screen being left takes no input while the next one loads (main.js route), and looks it. */
#app[inert] { opacity: .55; transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) { .timer-chip .dot, body.busy .top::after { animation: none; } }

@media (max-width: 720px) {
  .top { gap: 6px; padding: 0 10px; }
  .brand span, .top .who { display: none; }
  .top nav a { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
  .timer-chip .small { display: none; }
  /* With a timer running the bar has more than fits on one line: the timer takes a line of its own. */
  .top.timing { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .top.timing .timer-chip { order: 9; flex: 1 1 100%; justify-content: center; }
}

main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 80px; outline: none; overflow-wrap: break-word; }
@media (max-width: 720px) { main { padding: 16px 12px 72px; } h1 { font-size: 21px; } }

/* ---- layout ---- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.top-align { align-items: flex-start; }
.row.nowrap { flex-wrap: nowrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack-l > * + * { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cols-eq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width: 960px) { .cols-2, .cols-eq { grid-template-columns: minmax(0, 1fr); } .cards { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > .hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel > .bd { padding: 16px; }
.panel > .bd.flush { padding: 0; }
.panel > .ft { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
a.panel { display: block; color: inherit; transition: border-color .12s, transform .12s; }
a.panel:hover { text-decoration: none; border-color: var(--accent); }

.page-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.sub { color: var(--muted); font-size: 13px; }

/* ---- stat tiles ---- */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile.warn .v { color: var(--red); }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--gray); line-height: 1.7; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-compromised { background: var(--red-soft); color: var(--red); }
.s-locked_out { background: var(--orange-soft); color: var(--orange); }
.s-in_recovery { background: var(--amber-soft); color: var(--amber); }
.s-recovered { background: var(--blue-soft); color: var(--blue); }
.s-secured { background: var(--green-soft); color: var(--green); }
.p-critical { background: var(--red-soft); color: var(--red); }
.p-high { background: var(--orange-soft); color: var(--orange); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }

/* ---- progress ---- */
.ring { position: relative; width: 76px; height: 76px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke: var(--c-secured); transition: stroke-dashoffset .5s ease; }
.ring .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.ring.big { width: 104px; height: 104px; }
.ring.big .label { font-size: 22px; }
.pipeline { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.pipeline > span { min-width: 3px; }
.pipeline .compromised { background: var(--c-compromised); } .pipeline .locked_out { background: var(--c-locked_out); }
.pipeline .in_recovery { background: var(--c-in_recovery); } .pipeline .recovered { background: var(--c-recovered); }
.pipeline .secured { background: var(--c-secured); } .pipeline .closed { background: var(--c-closed); } .pipeline .abandoned { background: var(--c-abandoned); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: visible; }
.meter > .fill { display: block; height: 100%; border-radius: 999px; background: var(--c-secured); max-width: 100%; }
.meter.warn > .fill { background: var(--c-in_recovery); }
.meter.bad > .fill { background: var(--c-compromised); }
.meter > .tick { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--line-2); border-radius: 1px; }
.meter > .tick.hit { background: var(--ink-2); }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 13px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 13.5px; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }
.tabs a .n { font-weight: 500; color: var(--faint); margin-left: 5px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); white-space: nowrap; }
tr:last-child > td { border-bottom: 0; }
thead th:first-child { border-top-left-radius: var(--radius); } thead th:last-child { border-top-right-radius: var(--radius); }
tr.click { cursor: pointer; }
tr.click:hover > td { background: var(--surface-2); }
td.actions { white-space: nowrap; text-align: right; }
th.pick, td.pick { width: 1%; padding-right: 0; }
input.pick { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
/* The bar above a list while rows are ticked: the count and the actions that take many rows. */
.selbar { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
th.right { text-align: right; }
.tag { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; margin-right: 6px; }
@media (max-width: 760px) {
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.resp td { border: 0; padding: 3px 0; }
  table.resp td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
  table.resp td.actions { text-align: left; padding-top: 8px; }
  table.resp td:empty { display: none; }
}

/* ---- forms ---- */
label.f { display: grid; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 600; min-width: 0; }
label.f .hint { font-weight: 400; color: var(--muted); }
label.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink); font-weight: 500; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 7px 10px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); flex: 0 0 auto; }
input[type=file] { padding: 6px; background: var(--surface-2); }
textarea { min-height: 78px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
select.inline { width: auto; padding: 3px 26px 3px 8px; font-size: 12.5px; font-weight: 600; border-radius: 999px; }
form.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; }
form.fields .wide { grid-column: 1 / -1; }
form.fields .two { grid-column: span 2; }
@media (max-width: 520px) { form.fields .two { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1 1 180px; width: auto; }

button, .btn { font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-s); padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; line-height: 1.35; }
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
button.ghost, .btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: var(--faint); }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 5px 8px; }
button.quiet:hover { background: var(--surface-3); color: var(--ink); }
button.danger { background: var(--surface); color: var(--red); border-color: var(--line-2); }
button.danger:hover { background: var(--red-soft); border-color: var(--red); }
button.sm, .btn.sm { padding: 4px 10px; font-size: 12.5px; }
button.go { background: var(--c-secured); border-color: var(--c-secured); color: #04130c; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 220px; max-width: 340px; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--surface-2); border-color: var(--faint); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-s); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; background: var(--surface); color: var(--ink-2); padding: 7px 12px; border-right: 1px solid var(--line-2); font-size: 13px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--ink); color: var(--surface); }

/* ---- pieces ---- */
.notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-s); font-size: 13px; color: var(--ink-2); }
.notice svg { flex: 0 0 auto; margin-top: 2px; }
.notice > span { min-width: 0; overflow-wrap: anywhere; }
.notice a { color: inherit; text-decoration: underline; }
.notice.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.notice.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }
.notice.good { background: var(--green-soft); border-color: transparent; color: var(--green); }
.notice.info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.empty { color: var(--muted); padding: 22px 16px; text-align: center; font-size: 13.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 11px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list a.item { color: inherit; display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.list a.item:hover { text-decoration: none; }
.list a.item:hover .t { color: var(--accent); }
.list .t { font-weight: 600; }
/* The case setup guide: a done item is ticked and muted, one still to do leads to its tab. */
.setup-items .ico { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; margin-top: 1px; background: var(--surface-3); color: var(--ink-2); }
.setup-items .ico.done { background: var(--green-soft); color: var(--green); }
.setup-items li.done .t { color: var(--muted); font-weight: 500; }
.rank { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex: 0 0 auto; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed > li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.feed > li:last-child { border-bottom: 0; }
.feed .ico { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--ink-2); }
.feed .ico.incident { background: var(--red-soft); color: var(--red); } .feed .ico.action { background: var(--green-soft); color: var(--green); }
.feed .ico.contact { background: var(--blue-soft); color: var(--blue); } .feed .ico.decision { background: var(--accent-soft); color: var(--accent); }
.feed .ico.status { background: var(--amber-soft); color: var(--amber); }
.feed .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.checkrow { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.checkrow:last-child { border-bottom: 0; }
.checkrow.done .title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.checkrow input[type=checkbox] { margin-top: 3px; }
.sect { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.sect:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.item-row { display: grid; grid-template-columns: 104px 1fr auto; gap: 12px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row.done .title { color: var(--muted); }
.item-row .extra { margin-top: 8px; display: grid; gap: 8px; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; }
@media (max-width: 640px) { .item-row { grid-template-columns: 1fr; } .item-row .extra { grid-template-columns: 1fr; } }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--line); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.person { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.person:last-child { border-bottom: 0; }
.person > .stack { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .person { flex-wrap: wrap; } }
.playbook a { font-weight: 600; }
.playbook ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.playbook li { margin: 3px 0; }

/* discreet mode: identifying text is blurred until it is pointed at or focused */
body.discreet .sens { filter: blur(5.5px); transition: filter .12s; }
body.discreet .sens:hover, body.discreet .sens:focus, body.discreet .sens:focus-within, body.discreet input.sens:focus { filter: none; }

/* ---- dialogs and toasts ---- */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-l); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 12, 22, .55); backdrop-filter: blur(2px); }
dialog .dlg-hd { padding: 16px 18px 0; }
dialog .dlg-bd { padding: 14px 18px; overflow: auto; }
dialog .dlg-ft { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; max-width: min(440px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-l); font-size: 13.5px; }
.toast.bad { background: var(--c-compromised); color: #fff; }
.curtain { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.curtain .panel { max-width: 420px; text-align: center; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---- printable report and statement ---- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 40px; max-width: 900px; margin: 0 auto; box-shadow: var(--shadow); }
.sheet h1 { font-size: 22px; }
.sheet .doc-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); margin-bottom: 20px; }
.sheet h2 { margin: 22px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.sheet h2 + p { margin-bottom: 10px; }
.sheet table th { background: transparent; border-bottom: 1px solid var(--ink); }
.sheet table th, .sheet table td { padding: 7px 8px; }
.sheet .totals td { font-weight: 600; border-top: 1px solid var(--ink); }
@media (max-width: 640px) { .sheet { padding: 20px 16px; } }

/* The case record: a long dated table, then the summary, what is open, the statements and the
   audit footer. A hash or a reference number breaks anywhere, so a phone never scrolls sideways. */
.record .lede { font-size: 13px; color: var(--ink-2); margin: 0 0 4px; }
.record h3 { margin: 14px 0 6px; }
.record h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
/* A listing's address or a platform link shown in full is one long word: where one can appear it
   breaks anywhere. Only there, so the table does not squeeze a short word such as a category. */
.record td.what, .record td.ref, .record ul.plain li, .record .sens, .record td .small { overflow-wrap: anywhere; }
.record td.nowrap { white-space: nowrap; }
.record td.ref, .record .hash { word-break: break-all; font-variant-numeric: tabular-nums; }
.record ul.plain { margin: 0; padding-left: 18px; }
.record ul.plain li { margin: 2px 0; }
.record .statement + .statement { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line); }
.record .record-foot { margin-top: 26px; padding-top: 12px; border-top: 2px solid var(--ink); font-size: 13px; }
.record .record-foot p { margin: 0 0 4px; }
@media (max-width: 640px) {
  .record .doc-hd { flex-direction: column; gap: 8px; }
  .record .doc-hd .right { text-align: left; }
  .record table th, .record table td { padding: 6px 4px; font-size: 12.5px; }
  /* Six count columns fit a phone only when their headings may wrap. */
  .record table th { white-space: normal; letter-spacing: .02em; }
}

/* Printed, the record is on its own named page, so the report and the statements print as before:
   letter size, the case code at the top of every page (the text is --record-head, set by
   public/js/views/record.js, since a stylesheet cannot know the case) and "Page n of N" at the foot.
   Browsers without page margin boxes print the record without them. */
@page record {
  size: letter;
  margin: 18mm 16mm 16mm;
  @top-left { content: var(--record-head, "Case record"); font: 9pt system-ui, sans-serif; color: #444; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt system-ui, sans-serif; color: #444; }
}

@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #eee; --ink: #000; --ink-2: #222; --muted: #444; --line: #bbb; --line-2: #999; color-scheme: light; }
  .top, .tabs, .no-print, .toasts, .page-hd { display: none !important; }
  main { padding: 0; max-width: none; }
  .sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  body.discreet .sens { filter: none; }
  .badge { border: 1px solid #999; background: transparent !important; color: #000 !important; }
  a { color: inherit; }
  tr, .avoid-break { break-inside: avoid; }
  .record { page: record; }
  /* A table that runs onto the next page repeats its column headings there. */
  .record thead { display: table-header-group; }
  .record h2, .record h3, .record h4 { break-after: avoid; }
}

/* On a phone the badges of a list row go under its text instead of squeezing it. */
@media (max-width: 720px) {
  .list a.item { flex-wrap: wrap; }
  .list a.item > .row.tight { width: 100%; padding-left: 34px; }
  .page-hd { align-items: flex-start; }
}

/* Playbooks: a provider's own way to file, shown under a removal and in the kit reference. */
details.playbook { margin-top: 6px; }
details.playbook > summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600; }
details.playbook[open] > summary { margin-bottom: 6px; }
/* A scan's findings: one per listing the agent proposed, ticked to be added as a removal. */
.findings { margin-top: 6px; max-width: 46ch; }
.finding { padding: 6px 0; border-top: 1px solid var(--line); }
.finding a { overflow-wrap: anywhere; }
.progress-live { margin-top: 6px; max-width: 46ch; }
.progress-events { list-style: none; margin: 0; padding: 0; max-height: 14em; overflow-y: auto; }
.progress-events li { padding: 2px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.progress-kind { font-weight: 600; }
/* A scan searched by the operator: the links to each source, as narrow as its findings would be. */
.search-yourself { margin-top: 6px; max-width: 46ch; }
ol.steps { margin: 0; padding-left: 18px; }
ol.steps li + li { margin-top: 2px; }

/* Guided intake: one dialog, its steps on a numbered rail that wraps on a phone. */
.rail { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rail li { display: inline-flex; align-items: center; gap: 6px; }
.rail .n { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: 0 0 auto; }
.rail li.done .n { background: var(--green-soft); color: var(--green); }
.rail li[aria-current] { color: var(--ink); }
.rail li[aria-current] .n { background: var(--accent); color: var(--accent-ink); }
form.fields fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin: 0; min-width: 0; display: grid; gap: 8px; }
form.fields legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
form.fields fieldset .about { font-weight: 400; color: var(--muted); font-size: 12.5px; }
form.fields fieldset label.check { align-items: flex-start; }
form.fields fieldset label.check input { margin-top: 2px; }

/* ---- client status page (public/status.html): the desk's tokens on one narrow column, phone first ---- */
.status-page main { max-width: 760px; padding-top: 20px; }
.status-page .narrow { max-width: 480px; }
.status-page .page-hd { align-items: flex-start; }
/* Where a client's questions go, under every client page whatever it shows. */
.client-foot { max-width: 760px; margin: 0 auto; padding: 0 20px 24px; }
.status-page .kv { grid-template-columns: 1fr max-content; }
/* Three counts side by side even on a phone, so the table follows on the first screen. */
.status-page .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.status-page .tile { padding: 10px 12px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x table { width: 100%; border-collapse: collapse; font-size: 13px; }
.scroll-x th, .scroll-x td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.scroll-x th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.scroll-x td:first-child { white-space: normal; min-width: 140px; }
/* The link, shown once: long, and never broken in the middle of a character the owner cannot see. */
.link-once { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; user-select: all; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
/* The client intake form (public/intake.html): the same column, its rows as the desk's field grids. */
.status-page fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; margin: 0; min-width: 0; }
.status-page legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.status-page div.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; }
.status-page div.fields .wide { grid-column: 1 / -1; }
.status-page .fields + .fields { border-top: 1px dashed var(--line); padding-top: 10px; }
.intake-received ul.plain { list-style: none; margin: 0; padding: 0; }

/* Today on the dashboard: rows with a link on the right, and the count beside Cases in the top bar. */
.today .list > li { align-items: center; }
.today .list .grow { min-width: 0; }
.nav-count { margin-left: 6px; font-size: 11px; padding: 1px 7px; vertical-align: 1px; }

/* Ask about the case: the question, the model switch, one or two streamed answers. */
.ask-q textarea { min-height: 72px; }
.ask-answers { display: grid; gap: 14px; }
.ask-answers.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .ask-answers.two { grid-template-columns: 1fr; } }
.ask-answer .pre { font-size: 14px; }
.ask-answer .pre a { font-family: var(--mono); font-size: 12.5px; padding: 0 4px; border-radius: 4px; background: var(--accent-soft); }
.ask-answer.busy .pre::after { content: '\258F'; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { to { visibility: hidden; } }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chips button { font-weight: 500; }
.ask-turn { border-left: 3px solid var(--line-2); padding-left: 10px; }

/* Reading images into the case (public/js/views/extract.js). */
.dropzone { display: flex; gap: 12px; align-items: center; margin: 12px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: var(--radius-s); color: var(--ink-2); cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { flex: 0 0 auto; }
.extract-list .extract-row { align-items: flex-start; gap: 10px; }
.extract-row input[type=checkbox] { margin-top: 3px; }
.extract-row label { cursor: pointer; display: block; }
.extract-row.done { opacity: .55; }
