:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f8fafd; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e6eaf2;
  --brand: #2563eb; --brand-2: #7c3aed; --brand-soft: #e8efff;
  --ok: #059669; --ok-soft: #e6f7f0; --warn: #d97706; --warn-soft: #fff4e0; --bad: #dc2626; --bad-soft: #fdeaea; --info: #0ea5e9; --info-soft: #e6f6fd;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.12);
  --radius: 16px; --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .strong { font-weight: 600; } .center { text-align: center; } .right { text-align: right; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #0b1220 0%, #101a2e 100%); color: #cbd5e1; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand .mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: .02em; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px -8px rgba(124,58,237,.7); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: .04em; } .brand-text small { color: #94a3b8; font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(37,99,235,.18); color: #fff; box-shadow: inset 0 0 0 1px rgba(99,102,241,.35); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: #94a3b8; }
.engine { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.05); color: #e2e8f0; }
.engine .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.engine.bad .dot { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.18); }
.content { display: flex; flex-direction: column; min-width: 0; }
main { padding: 28px 32px 40px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 24px 22px; }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.lead { color: var(--muted); margin: 0; font-size: 15px; }
.head-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.head-tools .search { flex: 1 1 240px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; color: var(--muted); min-width: 300px; }
.search input { border: 0; outline: 0; font: inherit; width: 100%; background: transparent; color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.kpi-n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; } .kpi-n small { font-size: 13px; color: var(--muted); margin-left: 2px; font-weight: 500; }
.kpi-l { color: var(--muted); font-size: 12.5px; }
.kpi.accent .kpi-n { color: var(--brand); } .kpi.good .kpi-n { color: var(--ok); }
.assumption { margin: 12px 4px 16px; line-height: 1.5; }
.kpis + .assumption { margin-top: -8px; }

/* Tables */
.table-card { padding: 6px 0 0; overflow: hidden; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; white-space: nowrap; padding: 12px 18px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.right, .table td.nowrap, .table td .strong { white-space: nowrap; }
.table td.chips { display: table-cell; } .table td.chips > .chips { min-width: 180px; }
@media (max-width: 1340px) { .table td .strong { white-space: normal; } .table td { padding: 12px 14px; } }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2f8; color: var(--ink-2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }
.chip.validated { background: var(--ok-soft); color: var(--ok); }
.chip.not_validated { background: var(--bad-soft); color: var(--bad); }
.chip.needs_senior_review { background: var(--warn-soft); color: var(--warn); }
.chip.new { background: var(--info-soft); color: #0369a1; }
.chip.neutral { background: var(--brand-soft); color: #1d4ed8; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.not_started { background: #eef2f8; color: var(--muted); }
.status.in_review { background: var(--brand-soft); color: #1d4ed8; }
.status.complete { background: var(--ok-soft); color: var(--ok); }
.status.running { background: var(--brand-soft); color: #1d4ed8; } .status.running i { animation: pulse 1.2s infinite; }
.status.error { background: var(--bad-soft); color: var(--bad); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 9px 14px; cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(37,99,235,.8); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn.subtle { background: var(--surface-2); }
.btn.icon { width: 40px; padding: 0; font-size: 18px; }
.btn.good { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn.on { outline: 2px solid currentColor; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.segmented button { font: inherit; font-weight: 600; border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 220px; padding: 6px; display: none; z-index: 20; }
.menu-list.open { display: block; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 9px 12px; border-radius: 8px; color: var(--ink); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-list .disabled, .menu-list button:disabled { color: var(--muted); pointer-events: none; }

/* Record header */
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.record-id { display: flex; gap: 16px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); flex-shrink: 0; }
.record-head h1 { font-size: 20px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.record-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Workspace */
.workspace { display: grid; grid-template-columns: minmax(380px, 44%) minmax(0, 1fr); gap: 16px; align-items: start; }
.workspace > * { min-width: 0; }
.record-pane { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.pane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { display: flex; flex-direction: column; align-items: flex-start; gap: 0; font: inherit; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; cursor: pointer; line-height: 1.2; }
.tab span { font-weight: 600; font-size: 12.5px; } .tab small { color: var(--muted); font-size: 11px; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); } .tab.active small { color: #cbd5e1; }
.page { display: none; } .page.active { display: block; animation: fade .18s ease; }
.page-meta { margin-bottom: 8px; }
.page-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; }
mark.ev { background: #fde68a; padding: 0 2px; border-radius: 3px; box-shadow: 0 0 0 2px #fde68a; }

/* Progress */
.progress-bar { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 12px; }
.progress-bar span { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); animation: slide 1.4s ease-in-out infinite; }
.steps { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.step { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 7px 6px; border-radius: 10px; align-items: start; animation: fade .2s ease; }
.step:hover { background: var(--surface-2); }
.step .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; font-size: 11px; font-weight: 700; }
.step.running .ic { border: 2px solid var(--brand); border-right-color: transparent; animation: spin .8s linear infinite; }
.step.done .ic { background: var(--ok-soft); color: var(--ok); }
.step.warn .ic { background: var(--warn-soft); color: var(--warn); }
.step.error .ic { background: var(--bad-soft); color: var(--bad); }
.step .lbl { font-weight: 500; } .step .sum { color: var(--muted); font-size: 12.5px; }

/* Results */
.outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.outcome { border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.outcome::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--muted); }
.outcome.validated::before { background: var(--ok); } .outcome.not_validated::before { background: var(--bad); } .outcome.needs_senior_review::before { background: var(--warn); } .outcome.new::before { background: var(--info); }
.outcome .o-k { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.outcome.validated .o-k { color: var(--ok); } .outcome.not_validated .o-k { color: var(--bad); } .outcome.needs_senior_review .o-k { color: var(--warn); } .outcome.new .o-k { color: #0369a1; }
.outcome .o-h { font-weight: 700; font-size: 15px; margin-top: 4px; } .outcome .o-l { color: var(--ink-2); font-size: 13px; }
.outcome .o-r { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.summary-card { background: linear-gradient(135deg, #f3f6ff, #f8f5ff); border: 1px solid #e3e8ff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.summary-card .s-h { font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 10px; }
.summary-card .s-m { color: var(--muted); font-size: 12.5px; }
.check-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 500; }
.check.ok { color: var(--ok); } .check.bad { color: var(--bad); }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 10px; }
.section-title h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.finding { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.finding-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto 28px; gap: 6px 10px; align-items: center; padding: 12px 14px; cursor: pointer; }
.finding-head .det { grid-column: 1; grid-row: 1; } .finding-head .code { grid-column: 2; grid-row: 1; } .finding-head .dx { grid-column: 3 / span 2; grid-row: 1; }
.finding-head .chev { grid-column: 5; grid-row: 1 / span 2; }
.finding-head .hcc { grid-column: 1 / span 3; grid-row: 2; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.finding-head .conf { grid-column: 4; grid-row: 2; justify-self: end; }
.finding-head:hover { background: var(--surface-2); }
.det { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.det.supported { background: var(--ok-soft); color: var(--ok); } .det.unsupported { background: var(--bad-soft); color: var(--bad); } .det.needs_senior_review { background: var(--warn-soft); color: var(--warn); }
.finding .code { font-weight: 700; } .finding .dx { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finding .hcc { background: #eef2f8; border-radius: 999px; padding: 3px 9px; font-size: 12px; white-space: nowrap; } .finding .hcc.has { background: var(--brand-soft); color: #1d4ed8; }
.finding .conf { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chev { border: 0; background: none; font-size: 14px; color: var(--muted); cursor: pointer; transition: transform .15s; } .finding.open .chev { transform: rotate(180deg); }
.finding-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--line); }
.finding.open .finding-body { display: block; animation: fade .18s ease; }
.evidence { margin-top: 12px; }
.evidence q { display: block; quotes: none; font-style: italic; color: var(--ink-2); background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 8px; padding: 8px 10px; margin: 6px 0 2px; cursor: pointer; }
.evidence q:hover { background: #fff3c4; }
.evidence .ref { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.flags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; } .flags .chip { background: var(--warn-soft); color: var(--warn); }
.rationale { margin: 10px 0 4px; }
.provider { color: var(--muted); margin-top: 4px; }
.decide { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.decide-btns { display: flex; gap: 6px; } .decide-btns .btn { padding: 7px 12px; }
.decide input { flex: 1; min-width: 200px; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.decided { font-size: 12.5px; font-weight: 600; } .decided.accept { color: var(--ok); } .decided.reject { color: var(--bad); } .decided.escalate { color: var(--warn); }
.finding.locked .decide { opacity: .6; pointer-events: none; }
.actions-list { margin: 6px 0 0; padding-left: 18px; } .actions-list li { margin: 4px 0; }
.complete-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); font-weight: 500; animation: fade .2s ease; z-index: 50; }
.toast.err { background: var(--bad); }

/* Empty state */
.empty { text-align: center; padding: 36px 28px; }
.empty-art { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.error-card { background: var(--bad-soft); border: 1px solid #f7caca; color: var(--bad); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }

@keyframes slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(300%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; } .record-pane { position: static; max-height: none; } }
@media (max-width: 820px) { .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; min-width: 0; } .sidebar-foot { margin-left: auto; margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; } .nav { flex-direction: row; flex-wrap: wrap; min-width: 0; } .nav a { padding: 8px 10px; } main { padding: 18px 16px; } .page-head { flex-direction: column; align-items: stretch; } .search { min-width: 0; } .record-head { flex-direction: column; align-items: stretch; } .record-actions { justify-content: flex-start; } .intake input, .intake select { min-width: 0; } .edge-table { display: block; overflow-x: auto; } .edge-table input { min-width: 96px; } .two-col .card { overflow-x: auto; } .record-id > div + div { min-width: 0; } .record-head .chip { white-space: normal; border-radius: 12px; } }

/* Intake */
.intake { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(420px, 1.2fr); gap: 16px; align-items: start; }
.intake-form h2 { margin: 18px 0 10px; } .intake-form h2:first-of-type { margin-top: 6px; }
.stepper { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.stepper span { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; }
.stepper span.on { background: var(--brand-soft); color: #1d4ed8; }
.dropzone { display: flex; align-items: center; gap: 14px; border: 1.5px dashed #c7d2e5; border-radius: 14px; padding: 18px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.has { border-style: solid; border-color: var(--ok); }
.dz-art { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #fff; color: var(--brand); box-shadow: var(--shadow); flex-shrink: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.intake label, .page-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.intake input, .intake select, .page-edit input, .page-edit select { font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); color: var(--ink); }
.intake input:focus, .intake select:focus { outline: 2px solid rgba(37,99,235,.25); border-color: var(--brand); }
.check-label { flex-direction: row !important; align-items: center; gap: 8px !important; padding-top: 22px; }
.check-label input { width: 16px; height: 16px; }
.edge-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.edge-table th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 4px 6px; }
.edge-table td { padding: 4px 6px; } .edge-table input { width: 100%; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.page-edit { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.page-edit header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.page-edit details { margin-top: 8px; } .page-edit .page-text { max-height: 220px; overflow: auto; margin-top: 6px; }
@media (max-width: 1100px) { .intake { grid-template-columns: minmax(0, 1fr); } .grid2, .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.ocr-note { background: var(--info-soft); border: 1px solid #bae6fd; color: #075985; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.hdr-chips { display: flex; gap: 6px; } .ocr-warn { margin: -4px 0 8px; }

/* Workflow additions */
.kpi.warn .kpi-n { color: var(--warn); } .kpi.bad .kpi-n { color: var(--bad); }
.reasons { margin: 4px 0 0; padding-left: 16px; font-size: 13px; min-width: 170px; } .reasons li { margin: 2px 0; }
.o-usd { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.s-impact { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.rules { margin: 4px 0 2px; } .rule { display: inline-block; background: #eef2f8; border-radius: 6px; padding: 1px 7px; margin: 2px 4px 2px 0; font-size: 11.5px; color: var(--ink-2); }
.att { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.senior-decide .final { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--surface); }
.senior-decide { border-top: 1px dashed var(--line); padding-top: 10px; }
.senior-decided.accept { color: var(--ok); } .senior-decided.reject { color: var(--warn); }
.activity { list-style: none; margin: 10px 0 0; padding: 0; max-height: 260px; overflow: auto; font-size: 12.5px; }
.activity li { display: grid; grid-template-columns: 150px 110px 170px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.activity li:last-child { border-bottom: 0; } .activity .when { color: var(--muted); } .activity .who { font-weight: 600; }
#activity-card summary { list-style: none; cursor: pointer; } #activity-card summary::-webkit-details-marker { display: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.table.compact th, .table.compact td { padding: 8px 10px; }
.note-cell { max-width: 320px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } .activity li { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }
.o-k .by-senior { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 6px; }

/* Page images */
.pane-tools { display: flex; align-items: center; gap: 10px; }
.segmented.mini button { padding: 4px 10px; font-size: 12px; }
.page-image { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.page-image img { display: block; width: 100%; height: auto; }
.page-image .boxes { position: absolute; inset: 0; pointer-events: none; }
.ev-box { position: absolute; border: 2px solid #f59e0b; background: rgba(253, 230, 138, .35); border-radius: 3px; box-shadow: 0 0 0 2px rgba(245,158,11,.25); animation: fade .25s ease; }

/* Auth */
.user-box { display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto auto; gap: 8px; align-items: center; margin: 0; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.05); }
.user-box .btn { grid-column: 1 / span 2; padding: 5px 8px; font-size: 11.5px; border-radius: 8px; width: 100%; }
.user-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; color: #e2e8f0; min-width: 0; } .user-meta strong { font-size: 12.5px; overflow-wrap: anywhere; } .user-meta small { color: #94a3b8; font-size: 11px; }
.user-box .btn { background: rgba(255,255,255,.08); color: #e2e8f0; border-color: transparent; }
.login-body { background: radial-gradient(1200px 600px at 20% -10%, #e8efff, transparent), radial-gradient(900px 500px at 100% 100%, #f3ecff, transparent), var(--bg); min-height: 100vh; display: grid; place-items: center; }
.login-wrap { width: min(440px, 92vw); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 60px -30px rgba(15,23,42,.35); padding: 28px; }
.login-card .brand.dark { color: var(--ink); margin-bottom: 18px; } .login-card .brand.dark small { color: var(--muted); }
.login-card h1 { font-size: 22px; margin: 6px 0 4px; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.login-form input { font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }


/* Protocol citations, RXC chips, diagnosis edits (2026-11-09) */
a.sec { color: #1d4ed8; text-decoration: none; border-bottom: 1px dotted #93c5fd; cursor: pointer; font-weight: 600; white-space: nowrap; }
a.sec:hover { background: var(--brand-soft); border-bottom-color: #1d4ed8; }
.chip.rxc { border: 1px dashed currentColor; background: transparent; }
.chip.rxc.validated { color: var(--ok); } .chip.rxc.not_validated { color: var(--bad); } .chip.rxc.needs_senior_review { color: var(--warn); }
.outcome.rxc { border-style: dashed; }
.outcome .o-dev { margin-top: 6px; font-size: 12px; color: var(--warn); }
.edits { margin: 2px 0 4px; }
.sub-h { font-size: 14px; font-weight: 700; margin: 18px 0 4px; }
.file-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal[hidden] { display: none !important; }
.modal-card { background: var(--surface); border-radius: 14px; max-width: 860px; width: 100%; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.25); overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 2px 0; font-size: 17px; }
.protocol-text { white-space: pre-wrap; font-family: Inter, system-ui, sans-serif; font-size: 13.5px; line-height: 1.55; padding: 16px 20px; overflow: auto; margin: 0; color: var(--ink); }
.modal-card footer { padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.nowrap { white-space: nowrap; }
.own-work-note { margin-top: 4px; }

/* Review steps: 1 HCCs found in the record, 2 validation of submitted HCCs */
.rstep { margin: 18px 0 14px; }
.rstep-title { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rstep-title h3 { margin: 0; font-size: 15px; }
.rstep-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand, #1d4ed8); color: #fff; font-weight: 700; font-size: 13.5px; display: grid; place-items: center; }
.rstep-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.rstep-row { display: grid; gap: 4px 16px; padding: 14px 16px; border-top: 1px solid var(--line); border-left: 4px solid transparent; font-size: 13px; align-items: start; }
.rstep-card > .rstep-row:first-child { border-top: 0; }
.rstep-row.s1 { grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr); }
.rstep-row.s2 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr); }
.rstep-row.head { padding: 8px 16px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.rstep-row .k { display: none; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.rstep-row .c { min-width: 0; overflow-wrap: anywhere; }
.rstep-row .h { font-weight: 700; font-size: 14px; }
.rstep-row .l { color: var(--ink-2); font-size: 12.5px; }
.rstep-row .ref { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.rstep-row .ref.warn, .rstep-note.warn { color: var(--warn); }
.rstep-row .chip { margin-top: 5px; }
.rstep-row .why { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.rstep-row q { display: block; quotes: none; font-style: italic; color: var(--ink-2); background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 8px; padding: 6px 9px; cursor: pointer; }
.rstep-row q:hover { background: #fff3c4; }
.rstep-row .ck { font-size: 12.5px; }
.rstep-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.rstep-row.s1.supported, .rstep-row.s2.validated { border-left-color: var(--ok); }
.rstep-row.s1.pending_senior_review, .rstep-row.s2.needs_senior_review { border-left-color: var(--warn); }
.rstep-row.s1.not_supported, .rstep-row.s2.not_validated { border-left-color: var(--bad); }
.rstep-row.s2.new { border-left-color: #0ea5e9; }
.rstep-row.s1.not_supported .h, .rstep-row.s1.superseded .h { color: var(--muted); }
.rstep-row.s1.superseded { border-left-color: var(--line); }
.rstep-sub { padding: 8px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.rstep-empty { padding: 16px; color: var(--muted); font-size: 13px; }
.rstep-foot { padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; background: var(--surface-2); }
.code-link { cursor: pointer; color: #1d4ed8; text-decoration: underline dotted; text-underline-offset: 3px; }
.code-link:hover { text-decoration-style: solid; }
.finding.flash { box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); transition: box-shadow .3s; }
.rstep .o-usd { display: inline-block; margin-top: 5px; }
@container results (max-width: 480px) {
  .rstep-row.s1, .rstep-row.s2 { grid-template-columns: 1fr; gap: 10px; }
  .rstep-row.head { display: none; }
  .rstep-row .k { display: block; }
  .finding-head { grid-template-columns: auto minmax(0, 1fr) 28px; }
  .finding-head .dx { grid-column: 1 / span 2; grid-row: 2; }
  .finding-head .hcc { grid-column: 1 / span 2; grid-row: 3; }
  .finding-head .conf { grid-column: 1 / span 2; grid-row: 4; justify-self: start; }
  .finding-head .chev { grid-column: 3; grid-row: 1 / span 4; }
}
#results { container: results / inline-size; }
