/* Casefile: a calm work tool for sellers handling money at risk.
   Layout: light sidebar + main area; board of dispute stages, case page with a side column. */
:root {
  --bg: #f3f4f1;          /* page, slightly green-biased off-white */
  --surface: #ffffff;     /* cards */
  --surface-2: #f8f9f7;   /* inset areas */
  --ink: #16201c;
  --muted: #5f6a65;
  --faint: #8a948f;
  --line: #e1e4df;
  --line-strong: #cdd2cc;
  --accent: #1d5b47;      /* deep green: primary actions, brand */
  --accent-hover: #164a39;
  --accent-soft: #e4efe9;
  --on-accent: #ffffff;
  --good: #1d6b4a;   --good-bg: #e2f1e8;
  --warn: #8a5208;   --warn-bg: #f8ecd8;
  --info: #24548f;   --info-bg: #e3ebf6;
  --bad: #a3271b;    --bad-bg: #f9e4e1;
  --shadow: 0 1px 2px rgba(22, 32, 28, 0.05), 0 1px 1px rgba(22, 32, 28, 0.03);
  /* chart series: the first three slots of the validated categorical palette, in fixed order */
  --s1: #3b78cf; --s2: #e8873f; --s3: #0f7a57; --s-vol: #7d8883;
  --radius: 8px;
  --radius-sm: 5px;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1a1f1d; --surface-2: #161b19;
    --ink: #e9ece8; --muted: #a2aba6; --faint: #78827d;
    --line: #2a312d; --line-strong: #3a423e;
    --accent: #4aa883; --accent-hover: #5bb994; --accent-soft: #1c2f27; --on-accent: #0d1512;
    --good: #7fd0a8; --good-bg: #1b2e25;
    --warn: #e8b46a; --warn-bg: #33291a;
    --info: #94b9ec; --info-bg: #1c2635;
    --bad: #f29d92; --bad-bg: #3a201d;
    --shadow: none;
    --s1: #4a8ae0; --s2: #d07636; --s3: #107a56; --s-vol: #8f9993;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a1f1d; --surface-2: #161b19;
  --ink: #e9ece8; --muted: #a2aba6; --faint: #78827d;
  --line: #2a312d; --line-strong: #3a423e;
  --accent: #4aa883; --accent-hover: #5bb994; --accent-soft: #1c2f27; --on-accent: #0d1512;
  --good: #7fd0a8; --good-bg: #1b2e25;
  --warn: #e8b46a; --warn-bg: #33291a;
  --info: #94b9ec; --info-bg: #1c2635;
  --bad: #f29d92; --bad-bg: #3a201d;
  --shadow: none;
  --s1: #4a8ae0; --s2: #d07636; --s3: #107a56; --s-vol: #8f9993;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Anything marked hidden stays hidden, whatever display a component sets. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.empty { color: var(--faint); }

/* ---------- shell: sidebar + content (top bar and pages) ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.shell.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { width: 42px; height: 27px; color: var(--accent); }
.brand-name { font-family: var(--font-display); font-size: 1.55rem; line-height: 1; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-groups { display: grid; gap: 4px; }
.nav-heading { margin: 14px 10px 4px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted); font-weight: 500; font-size: 0.93rem; text-decoration: none; text-align: left;
  cursor: pointer; white-space: nowrap;
}
.nav-item svg, .side-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-count { margin-left: auto; font-size: 0.74rem; color: var(--faint); }
.nav-count.urgent:not(:empty) { color: var(--bad); font-weight: 600; }
.soon { margin-left: auto; font-size: 0.8rem; font-weight: 600; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.side-status { display: grid; gap: 4px; padding: 0 10px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; }
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.conn { display: flex; align-items: center; gap: 8px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.conn.on::before { background: var(--good); }
.profile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.profile:hover { background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 0.85rem; text-decoration: none;
}
.profile-text { display: grid; min-width: 0; }
.profile-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sub { font-size: 0.75rem; color: var(--muted); }

/* collapsed sidebar: icons only */
.shell.collapsed .side { padding-inline: 10px; }
.shell.collapsed .brand-name, .shell.collapsed .nav-text, .shell.collapsed .nav-count, .shell.collapsed .soon,
.shell.collapsed .nav-heading, .shell.collapsed .profile-text { display: none; }
.shell.collapsed .side-top { flex-direction: column; }
.shell.collapsed .nav-item, .shell.collapsed .side-link, .shell.collapsed .profile { justify-content: center; padding-inline: 0; }
.shell.collapsed .collapse-btn svg { transform: rotate(180deg); }
.shell.collapsed .side-status { padding: 0; justify-items: center; }
.shell.collapsed .nav-groups { gap: 10px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar-app {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px clamp(16px, 3vw, 40px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.menu-btn, .topbar-brand { display: none; }
.topbar-brand { font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.dataset-seg button { padding: 5px 10px; font-size: 0.8rem; white-space: nowrap; }
@media (max-width: 520px) { .dataset-seg button { padding: 5px 7px; font-size: 0.74rem; } }
.avatar-top { width: 32px; height: 32px; }
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 13, 0.4); z-index: 39; }

.main {
  min-width: 0;
  padding-block: 24px 64px;
  padding-left: max(clamp(16px, 3vw, 40px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 3vw, 40px), env(safe-area-inset-right, 0px));
}
/* Keep lines and columns readable on very wide monitors. */
.main > .page, #inbox-warning { max-width: 1480px; margin-inline: auto; }
.main:focus { outline: none; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.3rem; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); margin-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.92rem; line-height: 1.2;
  cursor: pointer; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); padding: 6px 8px; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-lg { padding: 11px 20px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.74rem; font-weight: 600; line-height: 1.5;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* ---------- notices ---------- */
.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; }
.notice-warn { background: var(--warn-bg); color: var(--ink); }
.notice-info { background: var(--info-bg); color: var(--ink); }
.result { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.result.ok { background: var(--good-bg); border: 1px solid var(--good); }
.result.bad { background: var(--bad-bg); border: 1px solid var(--bad); }

/* ---------- dashboard ---------- */
#dash-view > .box { margin-bottom: 16px; }
.box-head-note { font-size: 0.8rem; color: var(--muted); }

/* deadline radar: each open deadline placed on a timeline, nearest on the left */
.radar-scroll { overflow-x: auto; padding-bottom: 2px; }
.radar-track { position: relative; min-width: 480px; margin-top: 4px; }
.radar-axis { position: absolute; left: 0; right: 0; bottom: 28px; height: 2px; background: var(--line-strong); }
.radar-overdue {
  position: absolute; left: 0; width: 7%; top: 0; bottom: 28px;
  background: var(--bad-bg); border-radius: 4px;
  display: grid; place-items: center;
}
.radar-overdue span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bad); }
.radar-week { position: absolute; top: 0; bottom: 28px; background: var(--surface-2); border-radius: 4px; }
.radar-tick { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.radar-tick::before { content: ""; position: absolute; left: 50%; bottom: 22px; width: 1px; height: 8px; background: var(--line-strong); }
.radar-mark {
  position: absolute; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 4px;
  padding: 2px 4px; border: 0; background: none; color: var(--ink);
  cursor: pointer; border-radius: 6px;
}
.radar-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); transition: transform 0.15s; }
.radar-mark.md .radar-dot { width: 16px; height: 16px; }
.radar-mark.lg .radar-dot { width: 20px; height: 20px; }
.radar-mark.bad .radar-dot { background: var(--bad); }
.radar-mark.warn .radar-dot { background: var(--warn); }
.radar-mark:hover .radar-dot { transform: scale(1.15); }
.radar-label { font-size: 0.72rem; font-weight: 600; background: var(--surface); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.radar-summary { margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.radar-summary strong { color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .radar-dot { transition: none; } }

/* priority queue */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue-empty { padding: 14px 4px; color: var(--faint); }
.q-row {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
}
.q-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.q-row.q-first { border-color: var(--accent); background: var(--accent-soft); }
.q-rank {
  width: 30px; height: 30px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 600; font-size: 0.85rem;
}
.q-first .q-rank { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.q-main { display: grid; gap: 6px; min-width: 0; }
.q-title { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-weight: 600; }
.q-buyer { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.q-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.q-side { display: grid; justify-items: end; gap: 4px; }
.q-amount { font-weight: 600; font-size: 1.05rem; }
.q-level { font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.q-level.high { color: var(--bad); }
.q-level.medium { color: var(--warn); }
.q-cta { grid-column: 2 / -1; font-size: 0.8rem; font-weight: 600; color: var(--accent); }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; font-weight: 600; font-size: 0.88rem; }
.col-head .count { color: var(--faint); font-weight: 500; }
.col-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--faint); }
.col-dot.bad { background: var(--bad); }
.col-dot.info { background: var(--info); }
.col-dot.warn { background: var(--warn); }
.col-dot.good { background: var(--good); }
.col-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.col-empty { padding: 14px 6px; font-size: 0.84rem; color: var(--faint); }

.card {
  width: 100%; text-align: left;
  display: grid; gap: 8px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.card:hover { border-color: var(--line-strong); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-reason { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.card-amount { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.card-buyer { font-size: 0.88rem; color: var(--muted); margin-top: -4px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.card-id { font-size: 0.72rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- case page ---------- */
.back { margin: -6px 0 14px -8px; }
.case-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 22px; }
.case-title { display: grid; gap: 8px; }
.case-title h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.3rem; }
.case-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.case-money { text-align: right; }
.case-money .amount { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.case-money .sub { color: var(--muted); font-size: 0.88rem; }

.case-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.case-main { display: grid; gap: 16px; min-width: 0; }
.case-side { display: grid; gap: 16px; position: sticky; top: 20px; }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.box-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; letter-spacing: -0.005em; }
/* Large figures: the body face with equal-width digits, so numbers line up without looking like code. */
.figure { font-family: var(--font-body); font-variant-numeric: tabular-nums lining-nums; }
.box-hint { color: var(--muted); font-size: 0.88rem; margin: -4px 0 12px; }

.quote { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 14px; }
.quote + .quote { margin-top: 12px; }
.quote-who { font-size: 0.78rem; color: var(--faint); margin-bottom: 2px; }

.records {
  margin: 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 260px; overflow: auto;
}
textarea, input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field-label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.char-count { font-size: 0.76rem; color: var(--faint); text-align: right; margin-top: 4px; }
.char-count.over { color: var(--bad); font-weight: 600; }

/* details list */
.details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 0.88rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* progress timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding-bottom: 14px; font-size: 0.88rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done::after { background: var(--accent); }
.t-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); margin-top: 1px; display: grid; place-items: center; }
.timeline li.done .t-dot { border-color: var(--accent); background: var(--accent); }
.timeline li.done .t-dot::after { content: ""; width: 6px; height: 3px; border: solid var(--on-accent); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.timeline li.current .t-dot { border-color: var(--accent); }
.t-title { font-weight: 600; }
.timeline li.upcoming .t-title { color: var(--faint); font-weight: 500; }
.t-sub { color: var(--muted); font-size: 0.8rem; }

/* investigation feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 7px 0; font-size: 0.9rem; align-items: start; }
.feed-icon { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.feed-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feed li.tool .feed-icon { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.feed li.error .feed-icon { background: var(--bad-bg); color: var(--bad); }
.feed li.thought { color: var(--muted); font-size: 0.86rem; }
.feed-src { font-weight: 600; margin-right: 6px; color: var(--ink); }
.feed li.working .feed-icon { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .feed li.working .feed-icon { animation: none; } }

/* split view: dispute list beside the open case */
.split { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 22px; align-items: start; }
.split-main { min-width: 0; }
.case-body { display: grid; min-width: 0; }
.case-list {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.case-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.case-list-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; font-weight: 600; font-size: 0.86rem; }
.case-list-head .count { color: var(--faint); font-weight: 500; font-size: 0.8rem; }
.row {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px;
  padding: 10px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer;
}
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--accent-soft); }
.row-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amount { font-size: 0.86rem; font-weight: 600; }
.row-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.78rem; color: var(--muted); }

/* step bar across the top of a case */
.stepper {
  list-style: none; margin: 0 0 16px; padding: 18px 12px 14px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stepper li { position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center; padding: 0 6px; }
.stepper li::before {
  content: ""; position: absolute; top: 13px; height: 2px;
  left: calc(-50% + 20px); right: calc(50% + 20px);
  background: var(--line-strong);
}
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: var(--accent); }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--line-strong); background: var(--surface);
  font-size: 0.8rem; font-weight: 600; color: var(--faint);
}
.step-dot svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.stepper li.done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper li.current .step-dot { border-color: var(--accent); color: var(--accent); }
.step-label { font-weight: 600; font-size: 0.88rem; }
.stepper li.upcoming .step-label { color: var(--faint); }
.step-sub { font-size: 0.76rem; color: var(--muted); }

/* case details as a strip */
.details-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 0; }
.details-strip div { display: grid; gap: 2px; min-width: 0; align-content: start; }
.details-strip dt { font-size: 0.78rem; color: var(--muted); }
.details-strip dd { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }

/* approval before sending */
.approve {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.approve:has(input:checked) { border-color: var(--good); background: var(--good-bg); }
.approve input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.approve strong { display: block; font-size: 0.92rem; }
.approve-sub { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

/* case file: the agent's sources fill in as it works */
.run-status { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.run-status .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.box-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.casefile { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.slot {
  display: grid; gap: 6px; align-content: start;
  padding: 12px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  min-height: 112px;
  transition: background-color 0.3s, border-color 0.3s;
}
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.86rem; color: var(--faint); }
.slot-label .feed-icon { width: 24px; height: 24px; }
.slot-text { font-size: 0.82rem; color: var(--faint); }
.slot-mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }
.slot-mark svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.slot.waiting .slot-text::after { content: "..."; }
.slot.done { border-style: solid; border-color: var(--line); background: var(--surface); }
.slot.done .slot-label { color: var(--ink); }
.slot.done .slot-label .feed-icon { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.slot.done .slot-text { color: var(--ink); }
.slot.done .slot-mark { background: var(--accent); color: var(--on-accent); }
.slot.error { border-style: solid; border-color: var(--bad); background: var(--bad-bg); }
.slot.error .slot-text { color: var(--ink); }
.slot.verdict-slot.done.FIGHT { border-color: var(--good); background: var(--good-bg); }
.slot.verdict-slot.done.REFUND { border-color: var(--warn); background: var(--warn-bg); }
.slot.verdict-slot.done.OFFER { border-color: var(--info); background: var(--info-bg); }
.slot.just-done { animation: land 0.45s ease-out; }
@keyframes land { from { transform: translateY(4px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.notes-head { font-size: 0.78rem; font-weight: 600; color: var(--faint); margin: 16px 0 4px; }
@media (prefers-reduced-motion: reduce) {
  .slot.just-done, .run-status .live-dot { animation: none; }
}

/* buyer says vs evidence shows */
.claims { display: grid; gap: 0; }
.claims-head, .claim { display: grid; grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1.25fr); gap: 16px; align-items: start; }
.claims-head { font-size: 0.8rem; font-weight: 600; color: var(--faint); padding-bottom: 8px; }
.claim { padding: 14px 0; border-top: 1px solid var(--line); }
.claim-text { font-weight: 500; }
.claim-text.quoted::before { content: "\201C"; }
.claim-text.quoted::after { content: "\201D"; }
.finding { justify-self: start; }
.claim-evidence { font-size: 0.92rem; display: grid; gap: 6px; }
.claim-evidence .badge { justify-self: start; }

/* packet preview in the confirm dialog */
.modal.modal-wide { width: min(680px, calc(100vw - 32px)); }
.packet { display: grid; gap: 10px; max-height: min(52vh, 460px); overflow: auto; padding: 2px; }
.packet-meta { font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.packet-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 12px 14px; display: grid; gap: 6px; }
.packet-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 600; font-size: 0.9rem; }
.packet-notes { white-space: pre-wrap; font-size: 0.86rem; color: var(--ink); overflow-wrap: anywhere; }
.packet-tracking { font-size: 0.78rem; color: var(--muted); }
.packet-foot { font-size: 0.8rem; color: var(--muted); }

/* verdict */
.verdict { border-radius: var(--radius); padding: 20px 22px; border: 1px solid transparent; display: grid; gap: 10px; }
.verdict.FIGHT { background: var(--good-bg); border-color: var(--good); }
.verdict.REFUND { background: var(--warn-bg); border-color: var(--warn); }
.verdict.OFFER { background: var(--info-bg); border-color: var(--info); }
.verdict-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.verdict-label { font-size: 0.8rem; font-weight: 600; }
.verdict.FIGHT .verdict-label { color: var(--good); }
.verdict.REFUND .verdict-label { color: var(--warn); }
.verdict.OFFER .verdict-label { color: var(--info); }
.verdict-call { font-family: var(--font-display); font-size: 2.1rem; line-height: 1.1; }
.verdict-headline { font-weight: 600; }
.verdict-reasoning { color: var(--ink); font-size: 0.94rem; max-width: 68ch; }
.verdict-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; }
.meter-bars { display: flex; gap: 3px; }
.meter-bars span { width: 18px; height: 6px; border-radius: 2px; background: var(--line-strong); }
.meter-bars span.on { background: currentColor; }
.verdict.FIGHT .meter { color: var(--good); }
.verdict.REFUND .meter { color: var(--warn); }
.verdict.OFFER .meter { color: var(--info); }

/* facts */
.facts { list-style: none; margin: 0; padding: 0; }
.facts li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.facts li:first-child { border-top: 0; padding-top: 0; }
.facts .badge { justify-self: start; }

/* evidence checklist */
.evidence { display: grid; gap: 8px; }
.ev {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.ev:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ev input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.ev-type { font-weight: 600; font-size: 0.92rem; }
.ev-summary { grid-column: 2; font-size: 0.88rem; color: var(--ink); }
.ev-tracking { grid-column: 2; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.gaps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; display: grid; gap: 4px; }
.offer-row { display: flex; align-items: center; gap: 10px; max-width: 220px; }
.offer-row input { font-family: var(--font-mono); }
.decide { display: flex; flex-wrap: wrap; gap: 10px; }
.sandbox-tools { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.sandbox-tools p { font-size: 0.84rem; color: var(--muted); margin-bottom: 8px; }

/* ---------- modals ---------- */
.modal {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 22px 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 40px rgba(10, 16, 13, 0.18);
}
.modal::backdrop { background: rgba(10, 16, 13, 0.45); }
.modal h2 { font-size: 1.1rem; margin-bottom: 8px; }
.modal > form > p { color: var(--muted); font-size: 0.92rem; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.form-error { color: var(--bad) !important; margin: 8px 0 0 !important; }

/* ---------- demo store (shop.html) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand-sub { display: block; font-size: 0.78rem; color: var(--muted); }
.shop { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }
.shop-intro h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 4vw, 2.5rem); margin-bottom: 8px; }
.shop-intro p { max-width: 64ch; color: var(--muted); }
.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; margin-top: 26px; align-items: start; }
.shop-h { font-size: 0.98rem; margin: 18px 0 10px; }
.products, .cart-lines { list-style: none; margin: 0; padding: 0; }
.product {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.product-name { font-weight: 600; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty .btn { padding: 4px 12px; }
.cart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 18px; }
.cart-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 0.92rem; }
.totals, .receipt { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 16px; }
.totals dt, .receipt dt { color: var(--muted); }
.totals dd, .receipt dd { margin: 0; text-align: right; }
.receipt dd { text-align: left; overflow-wrap: anywhere; }
#paypal-buttons { min-height: 50px; }
.panel { margin-top: 28px; }
.panel > h2 { font-size: 1.1rem; margin-bottom: 10px; }
.panel-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.steps { margin: 10px 0; padding-left: 20px; max-width: 62ch; display: grid; gap: 6px; }
.track-form { display: grid; grid-template-columns: auto minmax(0, 320px); gap: 10px 14px; align-items: center; max-width: 520px; }
.track-form button { grid-column: 2; justify-self: start; }
.status { display: flex; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 0.8rem; color: var(--muted); }
.tag.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }

/* ---------- shared bits for the Phase 1 pages ---------- */
.muted { color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 0.84rem; }
.box + .box, .page > .box, .overview-grid { margin-top: 16px; }
.box-link { font-size: 0.86rem; font-weight: 600; text-decoration: none; }
.box-link:hover { text-decoration: underline; }
.sample-tag { display: inline-block; margin-left: 6px; font-size: 0.76rem; font-weight: 600; color: var(--faint); border: 1px dashed var(--line-strong); border-radius: 4px; padding: 0 5px; vertical-align: middle; }
.empty-state { color: var(--muted); padding: 10px 0; }
.empty-box { display: grid; justify-items: start; gap: 10px; padding: 28px; }
.empty-title { font-weight: 600; font-size: 1.05rem; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 0.84rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.countdown { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.mini-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ---------- overview dashboard ---------- */
/* top bar: search and theme */
.topsearch {
  position: relative; flex: 0 1 420px; min-width: 0;
  display: flex; align-items: center;
}
.topsearch > svg { position: absolute; left: 11px; width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.topsearch input {
  width: 100%; min-width: 0; padding: 8px 64px 8px 34px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.topsearch input::placeholder { color: var(--faint); }
.topsearch input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.kbd {
  position: absolute; right: 8px;
  padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px;
  font: 600 0.7rem/1.5 var(--font-body); color: var(--muted); background: var(--surface-2);
  pointer-events: none;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* sidebar card: demo store (sandbox only) */
.side-card {
  display: grid; gap: 6px; justify-items: start;
  padding: 14px; margin-bottom: 4px;
  background: #16302a; color: #e7efe9; border-radius: var(--radius);
}
.side-card-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: rgba(159, 217, 191, 0.16); color: #9fd9bf; }
.side-card-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-card-title { font-weight: 600; font-size: 0.88rem; color: #ffffff; }
.side-card-text { font-size: 0.78rem; line-height: 1.45; color: #b9c7bf; }
.side-card-btn { margin-top: 4px; background: #9fd9bf; color: #16302a; }
.side-card-btn:hover { background: #b6e4cf; }
.shell.collapsed .side-card { display: none; }

/* page head controls */
.date-pill, .period-select {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--ink);
}
.date-pill svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; }
.period-select { width: auto; padding-right: 8px; font-weight: 600; cursor: pointer; }
.head-actions .btn { height: 38px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.dash-summary { margin: -6px 0 18px; font-family: var(--font-display); font-size: 1.45rem; line-height: 1.3; color: var(--ink); text-wrap: balance; }
.history-money { margin-bottom: 16px; }
.kpi {
  display: grid; gap: 8px; align-content: start;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.kpi-alert { border-color: var(--bad); }
.kpi-label { font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: 2.1rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.8rem; color: var(--muted); }
.kpi-sub { min-width: 0; }
.chip-delta {
  display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px;
  font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.chip-delta.good { background: var(--good-bg); color: var(--good); }
.chip-delta.bad { background: var(--bad-bg); color: var(--bad); }
.chip-delta.info { background: var(--info-bg); color: var(--info); }

/* rows of boxes */
.dash-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-row > .box, .dash-side > .box { margin-top: 0; }
.dash-queue { align-self: start; }
.q-table .cell-strong { white-space: nowrap; }
.q-table .cell-sub { white-space: normal; }
.q-table .cell-sub .mono { white-space: nowrap; }
.q-table .cell-action { width: 1%; white-space: nowrap; }
.week-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.week-list .wl-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer; }
.week-list .wl-row:hover { background: var(--surface-2); }
.wl-who { display: grid; min-width: 0; }
.wl-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-sub { font-size: 0.76rem; color: var(--muted); }
.wl-head { font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 0 6px 4px; }
.dash-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.dash-side .box + .box { margin-top: 0; }

/* money disputed */
.money-top { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.money-figure { display: grid; gap: 8px; align-content: start; }
.money-big { font-size: 2.4rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.money-figure .chart-legend { display: grid; gap: 6px; margin: 8px 0 0; }
.money-chart { min-width: 0; display: grid; gap: 6px; }
.chart-toggle { justify-self: end; }
.chart .area.s1 { fill: var(--s1); fill-opacity: 0.08; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--s1); } .chart .line.s2 { stroke: var(--s2); } .chart .line.s3 { stroke: var(--s3); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.s1 { fill: var(--s1); } .chart .dot.s2 { fill: var(--s2); } .chart .dot.s3 { fill: var(--s3); }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.outcomes { margin-top: 14px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.outcomes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.9rem; }
.outcomes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.out { display: grid; gap: 4px; min-width: 0; }
.out-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.out-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.out-dot.good, .out-bar.good { background: var(--good); }
.out-dot.bad, .out-bar.bad { background: var(--bad); }
.out-dot.warn, .out-bar.warn { background: var(--warn); }
.out-num { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.out-track { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.out-bar { display: block; height: 100%; width: 0; border-radius: 2px; }

/* deadlines this week */
.week-chart { max-width: 440px; margin-inline: auto; }
.week-chart .wbar { fill: var(--accent-soft); }
.week-chart .wbar.hi { fill: var(--accent); }
.week-chart .wbar.empty { fill: var(--line); }
.week-chart .wcol { cursor: pointer; outline: none; }
.week-chart .wcol:hover .wbar:not(.hi) { fill: var(--line-strong); }
.week-chart .wcol:focus-visible .wbar { stroke: var(--accent); stroke-width: 2; }
.week-chart .wval { fill: var(--ink); font: 600 12px var(--font-mono); }
.week-chart .tick.today { fill: var(--ink); font-weight: 600; }
.week-sum { margin-top: 10px; font-size: 0.86rem; color: var(--muted); }
.week-sum b { color: var(--ink); font-weight: 600; }
.overdue-note { color: var(--bad); font-weight: 600; }

/* cases that need attention */
.q-table td { font-size: 0.88rem; }
.cell-stack { display: grid; gap: 1px; min-width: 0; }
.cell-sub { font-size: 0.78rem; color: var(--muted); }
.q-next { color: var(--muted); min-width: 160px; }
.q-foot { margin-top: 10px; }

/* win rate gauge */
#gauge { display: grid; justify-items: center; text-align: center; gap: 4px; }
.gauge { width: 100%; max-width: 240px; height: auto; display: block; }
.gauge .gtick { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.gauge .gtick.on { stroke: var(--accent); }
.gauge .gval { fill: var(--ink); font: 600 32px var(--font-body); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.gauge-sub { font-size: 0.88rem; }
.gauge-btn { margin-top: 8px; }

/* AI investigations */
.ai-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.ai-stats > div { display: grid; gap: 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ai-num { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.ai-label { font-size: 0.78rem; color: var(--muted); }
.ai-next { display: grid; gap: 4px; justify-items: start; padding-top: 12px; border-top: 1px solid var(--line); }
.ai-next-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.ai-next-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.ai-next .btn { margin-top: 6px; }

/* financial charts */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 0.84rem; color: var(--muted); margin-bottom: 8px; }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.leg b { color: var(--ink); font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.swatch.s1 { background: var(--s1); } .swatch.s2 { background: var(--s2); } .swatch.s3 { background: var(--s3); } .swatch.s-vol { background: var(--s-vol); }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .bar.s1 { fill: var(--s1); } .chart .bar.s2 { fill: var(--s2); } .chart .bar.s3 { fill: var(--s3); } .chart .bar.s-vol { fill: var(--s-vol); }
.chart .hit { fill: var(--ink); fill-opacity: 0; cursor: crosshair; outline: none; }
.chart .hit.on { fill-opacity: 0.05; }
.chart .hit:focus-visible { fill-opacity: 0.08; stroke: var(--accent); stroke-width: 2; }
.chart-sub { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin: 10px 0 2px; }
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  display: grid; gap: 3px; min-width: 180px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(10, 16, 13, 0.16); font-size: 0.82rem;
}
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.tip-row b { color: var(--ink); margin-left: auto; padding-left: 10px; font-family: var(--font-mono); font-weight: 600; }

/* tables */
.table-box { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table thead th { font-size: 0.8rem; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.data-table tbody tr:last-child td, .data-table tbody tr:last-child th { border-bottom: 0; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table td.mono { white-space: nowrap; font-size: 0.84rem; }
.data-table.compact th, .data-table.compact td { padding: 7px 10px; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--surface-2); }
.cell-strong { font-weight: 600; margin-right: 6px; }
.cell-date { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 3px; white-space: nowrap; }
.cell-action { text-align: right; }

/* all disputes toolbar */
.toolbar { display: grid; gap: 10px; margin-bottom: 14px; }
.tb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { position: relative; flex: 1 1 280px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; }
.search input { padding-left: 34px; }
.tb-field { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--muted); }
.tb-field select { width: auto; }
.tb-filters select { width: auto; min-width: 150px; }
.tb-filters input[type="number"] { width: 110px; }
.tb-filters input[type="date"] { width: auto; }
.tb-pair { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; }
.tb-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--muted); }
.tb-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.84rem; font-weight: 500; color: var(--muted); cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip-count { font-size: 0.74rem; color: var(--faint); }

/* deadline radar page */
.legend-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.radar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.radar-layout > .box { margin-top: 0; }
.cal-head { flex-wrap: wrap; }
.cal-title { font-size: 1.05rem; }
.cal-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal-wd { background: var(--surface-2); padding: 6px 8px; font-size: 0.8rem; font-weight: 600; color: var(--faint); }
.cal-cell { background: var(--surface); min-height: 92px; padding: 6px; display: grid; align-content: start; gap: 4px; min-width: 0; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-day { color: var(--faint); }
.cal-day { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cal-cell.today .cal-day { color: var(--on-accent); background: var(--accent); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cal-chip {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px;
  width: 100%; padding: 3px 6px; border-radius: 4px; text-align: left; cursor: pointer;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink); font-size: 0.74rem; line-height: 1.3; min-width: 0;
}
.cal-chip.critical { background: var(--bad-bg); border-color: var(--bad); }
.cal-chip.warning { background: var(--warn-bg); border-color: var(--warn); }
.cal-chip.upcoming { background: var(--accent-soft); border-color: transparent; }
.cal-chip.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cal-amt, .cal-time { color: var(--muted); }
.cal-more { border: 0; background: none; color: var(--accent); font-size: 0.74rem; font-weight: 600; cursor: pointer; text-align: left; padding: 0 4px; }
.cal-grid.week .cal-col { background: var(--surface); min-height: 220px; padding: 8px; display: grid; align-content: start; gap: 6px; min-width: 0; }
.cal-col.today { background: var(--accent-soft); }
.cal-col-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.78rem; color: var(--muted); }
.cal-col-head b { font-size: 1rem; color: var(--ink); }
.cal-col-list { display: grid; gap: 6px; }
.cal-none { font-size: 0.76rem; color: var(--faint); }
.radar-detail { position: sticky; top: 76px; display: grid; gap: 10px; }
.rd-title { font-size: 1.1rem; }
.rd-sub { font-size: 0.84rem; color: var(--muted); }
.rd-list { margin: 0; display: grid; gap: 8px; }
.rd-list div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; font-size: 0.88rem; align-items: center; }
.rd-list dt { color: var(--muted); }
.rd-list dd { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* integrations, preferences */
.integ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.integ-grid > .box { margin-top: 0; display: grid; gap: 10px; align-content: start; }
.integ .btn { justify-self: start; }
.pref-field { max-width: 360px; }
.history-counts { margin-bottom: 12px; }

/* case page additions */
.case-meta { font-size: 0.9rem; color: var(--muted); }
.case-money { display: grid; justify-items: end; gap: 6px; }
.complaint { margin-bottom: 14px; }
.details-strip dd .line { display: block; }
.ev-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ev-fig { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.ev-num { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.ev-fig.good .ev-num { color: var(--good); }
.ev-fig.warn .ev-num { color: var(--warn); }
.ev-label { font-weight: 600; font-size: 0.86rem; }
.ev-sub { font-size: 0.76rem; color: var(--muted); }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 12px; padding: 0 0 14px; align-items: start; font-size: 0.88rem; }
.activity li::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.activity li:last-child { padding-bottom: 0; }
.activity li:last-child::before { display: none; }
.act-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); margin-top: 3px; position: relative; z-index: 1; }
.activity li.good .act-dot { border-color: var(--good); background: var(--good); }
.activity li.info .act-dot { border-color: var(--info); }
.act-time { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* notifications */
.notif-wrap { position: relative; }
.bell { position: relative; }
.bell-count {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 0.66rem; font-weight: 600;
  display: grid; place-items: center; line-height: 1;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(380px, calc(100vw - 24px)); max-height: min(520px, calc(100dvh - 90px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(10, 16, 13, 0.18);
}
.np-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.np-head h2 { font-size: 1rem; }
.np-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; }
.np-item { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) 10px; gap: 10px; align-items: start; padding: 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer; }
.np-item:hover { background: var(--surface-2); }
.np-item.unread { background: var(--accent-soft); }
.np-icon { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.np-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.np-icon.good { background: var(--good-bg); color: var(--good); }
.np-icon.bad { background: var(--bad-bg); color: var(--bad); }
.np-icon.warn { background: var(--warn-bg); color: var(--warn); }
.np-icon.info { background: var(--info-bg); color: var(--info); }
.np-body { display: grid; gap: 1px; min-width: 0; }
.np-title { font-weight: 600; font-size: 0.88rem; }
.np-detail { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-time { font-size: 0.74rem; color: var(--faint); }
.np-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; }
.np-empty { padding: 24px 16px; color: var(--muted); font-size: 0.9rem; }
.np-foot { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 0.86rem; }

/* legal links under the profile */
.side-legal { display: flex; gap: 14px; margin: 0; padding: 0 10px; font-size: 0.74rem; }
.side-legal a { color: var(--faint); text-decoration: none; }
.side-legal a:hover { color: var(--ink); text-decoration: underline; }
.shell.collapsed .side-legal { display: none; }
@media (max-width: 900px) { .shell.collapsed .side-legal { display: flex; } }

/* roadmap page */
.roadmap-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.roadmap-dl { margin: 0; display: grid; gap: 12px; }
.roadmap-dl dt { font-weight: 600; }
.roadmap-dl dd { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 70ch; }

/* ---------- Phase 2: investigation workspace ---------- */
.small { font-size: 0.82rem; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.tab-links { margin-top: -4px; }

/* tabs */
.tabs { display: flex; gap: 2px; overflow-x: auto; margin: 0 0 16px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: 0.72rem; color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.tab .live-dot, .run-status .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; display: inline-block; }

/* workspace header + progress */
.ws-head .box-head { align-items: flex-start; }
.ws-hint { margin: 4px 0 0; max-width: 64ch; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 6px 0 12px; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.basis-legend { margin-bottom: 4px; }
.badge.basis { font-weight: 600; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-top: 16px; }
.ws-side { display: grid; gap: 16px; position: sticky; top: 76px; }
.ws-side .box { margin-top: 0; }

/* stage timeline */
.timeline-ws { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stage { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; position: relative; }
.stage::before { content: ""; position: absolute; left: 14px; top: 32px; bottom: -10px; width: 2px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage.completed::before { background: var(--accent); }
.st-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  border: 2px solid var(--line-strong); background: var(--surface); font-size: 0.8rem; font-weight: 600; color: var(--faint);
}
.st-num svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.stage.completed .st-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stage.investigating .st-num { border-color: var(--info); }
.stage.needs_input .st-num { border-color: var(--warn); color: var(--warn); }
.stage.unable .st-num { border-color: var(--bad); color: var(--bad); }
.st-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--info); border-right-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.st-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.stage.investigating .st-card { border-color: var(--info); }
.st-card > summary, .st-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.st-card > summary::-webkit-details-marker { display: none; }
.st-static .st-summary { cursor: default; }
.st-title { display: grid; gap: 1px; min-width: 0; }
.st-title b { font-weight: 600; }
.st-sub { font-size: 0.8rem; color: var(--muted); }
.st-body { display: grid; gap: 12px; padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.st-block h4 { margin: 10px 0 4px; font-size: 0.8rem; font-weight: 600; color: var(--faint); }
.st-block ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.9rem; }
.st-block .st-evidence, .st-block .st-findings { list-style: none; padding: 0; }
.st-missing ul { list-style: none; padding: 0; }
.st-actions { padding: 0 16px 14px; }
.agent-notes summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.agent-notes .feed { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .st-spin { animation: none; } .progress-bar { transition: none; } }

/* notes + history */
.note-actions { margin: 8px 0 10px; }
.notes, .runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 2px; font-size: 0.88rem; }
.runs li { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.88rem; }
.runs li:first-child { border-top: 0; }

/* documents + evidence strength */
.upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.upload-row select { width: auto; min-width: 180px; }
.upload-row .muted { flex: 1 1 260px; }
.docs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.doc-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }
.doc-icon { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.doc-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.doc-main { display: grid; min-width: 0; }
.doc-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 0.78rem; color: var(--muted); }
.ev-cards { display: grid; gap: 10px; }
.ev-card { border: 1px solid var(--line); border-left-width: 1px; border-radius: var(--radius-sm); padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.ev-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ev-card-head > div { display: grid; gap: 2px; min-width: 0; }
.ev-name { font-weight: 600; }
.badge.rating { font-size: 0.78rem; padding: 3px 9px; }
.criteria { margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.criteria div { display: grid; gap: 1px; padding: 6px 8px; background: var(--surface-2); border-radius: var(--radius-sm); min-width: 0; }
.criteria dt { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.criteria dd { margin: 0; font-size: 0.85rem; font-weight: 600; }
.ev-expl { font-size: 0.9rem; }

/* missing evidence */
.gap-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.gap-cards .box { margin-top: 0; display: grid; gap: 10px; align-content: start; }
.gap-card h2 { font-size: 0.98rem; }
.gap-dl { margin: 0; display: grid; gap: 8px; }
.gap-dl dt { font-size: 0.8rem; font-weight: 600; color: var(--faint); }
.gap-dl dd { margin: 0; font-size: 0.9rem; }

/* contradiction finder: buyer's claims left, seller's evidence right */
.cmp-head { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); gap: 14px; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 0 0 8px; }
.cmp-head span:last-child { grid-column: 3; }
.cmp { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); gap: 0 14px; align-items: stretch; }
.cmp-claim, .cmp-ev { display: grid; gap: 6px; align-content: start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.cmp-claim { background: var(--surface-2); }
.cmp-ev { background: var(--surface); }
.cmp-mid { display: grid; place-items: center; }
.cmp-more { grid-column: 1 / -1; margin-top: 6px; }
.cmp-more summary { cursor: pointer; font-size: 0.84rem; font-weight: 600; color: var(--accent); }
.cmp-detail { display: grid; gap: 10px; padding: 10px 14px; margin-top: 6px; border-left: 2px solid var(--line-strong); }
.excerpt { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); display: grid; gap: 6px; }
.excerpt p { font-family: var(--font-mono); font-size: 0.84rem; }
.ex-check { font-size: 0.8rem; font-weight: 600; }
.ex-check.ok { color: var(--good); }
.ex-check.bad { color: var(--bad); }
.ex-check.cant { color: var(--muted); }

/* flags */
.flag-wrap { display: grid; gap: 6px; }
.flag-wrap textarea { min-height: 60px; }
.flag-btn { color: var(--muted); }
.flagged { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.86rem; }
.flag-reason { color: var(--muted); }

/* summary report */
.report .rep-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.report .rep-sec h3, .viewer-body .rep-sec h3 { font-size: 0.98rem; margin-bottom: 8px; }
.rep-sec ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.92rem; }
.rep-stages { list-style: none; padding: 0 !important; }
.viewer-body .rep-sec { padding: 12px 0; border-top: 1px solid var(--line); }

/* viewer dialog */
.viewer { padding: 0; }
.viewer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.viewer-head h2 { margin: 0; }
.viewer-sub { font-size: 0.84rem; color: var(--muted); margin: 2px 0 0; }
.viewer-body { padding: 16px 18px; display: grid; gap: 12px; }
.doc-img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.doc-text { max-height: none; }
.reassess-form { display: grid; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .case-list { display: none; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .casefile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-grid { grid-template-columns: minmax(0, 1fr); }
  .case-side { position: static; grid-row: 1; }
}
@media (max-width: 760px) {
  .main {
    padding-block: 20px 48px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  /* 16px stops iPhones zooming in when a field is tapped. */
  input, textarea, select { font-size: 16px; }
  .page-head h1, .case-title h1 { font-size: 1.9rem; }
  .verdict { padding: 16px; }
  .verdict-call { font-size: 1.7rem; }
  .box { padding: 16px; }
  .modal { padding: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.6rem; }
  .money-top { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .money-figure .chart-legend { display: flex; flex-wrap: wrap; margin-top: 4px; }
  .money-big { font-size: 1.9rem; }
  .outcomes-grid { gap: 10px; }
  .head-actions { width: 100%; }
  .date-pill { flex: 1 1 100%; }
  .period-select { flex: 1 1 auto; }
  .topsearch input { padding-right: 10px; }
  .kbd { display: none; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .q-row { grid-template-columns: 30px minmax(0, 1fr); padding: 12px; }
  .q-side { grid-column: 2; display: flex; justify-items: start; align-items: baseline; gap: 10px; }
  .case-money { text-align: left; }
  .facts li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .casefile { grid-template-columns: minmax(0, 1fr); }
  .slot { min-height: 0; }
  .stepper { padding: 14px 4px 12px; }
  .step-sub { display: none; }
  .step-label { font-size: 0.78rem; }
  .claims-head { display: none; }
  .claim { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .shop-grid { grid-template-columns: minmax(0, 1fr); }
  .shop { padding: 24px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .track-form { grid-template-columns: minmax(0, 1fr); }
  .track-form button { grid-column: 1; }
}

/* Small phones (about 480px and below) */
@media (max-width: 480px) {
  .decide .btn, .verdict-actions .btn, .box-head-right .btn { width: 100%; }
  .box-head-right { width: 100%; }
  .box-head { flex-wrap: wrap; }
  .case-money .amount { font-size: 1.6rem; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .head-actions .btn { flex: 1 1 auto; }
  .card-amount { font-size: 1.15rem; }
  .product { flex-wrap: wrap; }
  .details-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phase 1 responsive ---------- */
@media (max-width: 1240px) {
  .dash-row { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }





  .dash-queue { align-self: stretch; }



}
@media (max-width: 1380px) and (min-width: 1241px) {
  .money-top { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .money-figure .chart-legend { display: flex; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .topsearch { flex: 1 1 auto; }
}
@media (max-width: 640px) {
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .topbar-brand { display: none !important; }
  /* The dataset switch gets its own full-width row, so nothing in the top bar is squeezed or cut off. */
  .topbar-app { flex-wrap: wrap; row-gap: 8px; }
  .topbar-right { display: contents; }
  .topbar-app #theme-btn, .topbar-app .notif-wrap { order: 2; }
  .topsearch { order: 1; flex: 1 1 0; }
  .menu-btn { order: 0; }
  .dataset-seg { order: 3; flex: 1 1 100%; display: flex; }
  .dataset-seg button { flex: 1 1 50%; padding: 7px 8px; font-size: 0.84rem; }
  .avatar-top { display: none; }
}
@media (max-width: 1100px) {
  .radar-layout { grid-template-columns: minmax(0, 1fr); }
  .radar-detail { position: static; }
  .ev-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Tablets and phones: the sidebar becomes a drawer opened from the top bar. */
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0;
    width: min(280px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(10, 16, 13, 0.2);
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
  .shell.menu-open .side { transform: none; }
  .collapse-btn { display: none; }
  .shell.collapsed .brand-name, .shell.collapsed .nav-text, .shell.collapsed .nav-count, .shell.collapsed .soon,
  .shell.collapsed .nav-heading, .shell.collapsed .profile-text { display: revert; }
  .shell.collapsed .nav-item, .shell.collapsed .side-link, .shell.collapsed .profile { justify-content: flex-start; padding-inline: 10px; }
  .menu-btn { display: inline-grid; }
  .topbar-brand { display: inline; }
  .topbar-app { padding-top: max(10px, env(safe-area-inset-top, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media (max-width: 760px) {
  .q-next { min-width: 0; }
  .q-table .cell-strong, .q-table .cell-sub { white-space: normal; }
.q-table .cell-sub .mono { white-space: nowrap; }
  .q-table .cell-sub { text-align: right; overflow-wrap: anywhere; }
  .data-table:not(.compact) td .cell-stack { justify-items: end; }
  /* Filters as a two-column grid that always fits the screen. */
  .tb-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tb-filters select { min-width: 0; width: 100%; }
  .tb-filters .tb-pair, .tb-filters .tb-check, .tb-filters > .btn { grid-column: 1 / -1; }
  .tb-pair { display: grid; align-items: center; gap: 6px; }
  .tb-amount { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .tb-dates { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
  .tb-filters input[type="number"], .tb-filters input[type="date"] { width: 100%; min-width: 0; }
  .tb-row .search { flex: 1 1 100%; }
  .tb-filters > .btn { justify-self: start; }
  .data-table:not(.compact) td::before { font-family: var(--font-body); font-weight: 400; font-size: 0.78rem; }
  .page-head { align-items: flex-start; }
  /* Tables become stacked cards. */
  .data-table:not(.compact) thead { display: none; }
  .data-table:not(.compact), .data-table:not(.compact) tbody, .data-table:not(.compact) tr, .data-table:not(.compact) td { display: block; width: 100%; }
  .data-table:not(.compact) tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .data-table:not(.compact) tbody tr:last-child { border-bottom: 0; }
  .data-table:not(.compact) td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .data-table:not(.compact) td::before { content: attr(data-label); color: var(--muted); font-size: 0.78rem; text-align: left; flex: none; }
  .data-table:not(.compact) td.cell-action { justify-content: stretch; padding-top: 8px; }
  .data-table:not(.compact) td.cell-action::before { content: none; }
  .data-table:not(.compact) td.cell-action .btn { width: 100%; }
  .cell-date { margin: 0 6px 0 0; display: inline; }
  .ev-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity li { grid-template-columns: 14px minmax(0, 1fr); }
  .act-time { grid-column: 2; }
  .case-money { justify-items: start; }
  .notif-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
}
@media (max-width: 600px) {
  .cal-cell { min-height: 58px; padding: 4px; }
  .cal-chip { padding: 0; min-height: 10px; border-radius: 3px; }
  .cal-chip .cal-name, .cal-chip .cal-amt { display: none; }
  .cal-chip.upcoming { background: var(--accent); }
  .cal-chip.critical { background: var(--bad); }
  .cal-chip.warning { background: var(--warn); }
  .cal-wd { padding: 4px 2px; text-align: center; font-size: 0.64rem; }
  .cal-grid.week { grid-template-columns: minmax(0, 1fr); }
  .cal-grid.week .cal-col { min-height: 0; }
  .cal-grid.week .cal-chip { padding: 6px 8px; min-height: 0; }
  .cal-grid.week .cal-chip .cal-name, .cal-grid.week .cal-chip .cal-amt { display: inline; }
  .cal-grid.week .cal-chip.upcoming { background: var(--accent-soft); }
  .cal-grid.week .cal-chip.critical { background: var(--bad-bg); }
  .cal-grid.week .cal-chip.warning { background: var(--warn-bg); }
}

/* ---------- Phase 2 responsive ---------- */
@media (max-width: 1100px) {
  .ws-grid { grid-template-columns: minmax(0, 1fr); }
  .ws-side { position: static; }
  .criteria { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cmp-head { display: none; }
  .cmp-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cmp-mid { justify-items: start; place-items: start; }
  .criteria { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-row { grid-template-columns: 30px minmax(0, 1fr); }
  .doc-row > .badge, .doc-row > .btn { grid-column: 2; justify-self: start; }
  .gap-cards { grid-template-columns: minmax(0, 1fr); }
  .upload-row select { flex: 1 1 100%; }
  .st-card > summary, .st-summary { flex-wrap: wrap; }
}
