:root {
  color-scheme: light;
  --ink: #17324d;
  --muted: #62748a;
  --line: #dbe5ee;
  --paper: #f5f8fb;
  --panel: #ffffff;
  --blue: #1769aa;
  --blue-dark: #0f4d7f;
  --green: #13795b;
  --amber: #9b6700;
  --red: #a12b2b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.topbar { align-items: center; background: #102b44; color: #fff; display: flex; justify-content: space-between; padding: 22px max(24px, calc((100vw - 1240px) / 2)); }
.compact-topbar { padding-top: 18px; padding-bottom: 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.35rem, 2vw, 1.8rem); margin-bottom: 0; }
h2 { font-size: 1.2rem; margin-bottom: 10px; }
h3 { font-size: .95rem; margin-bottom: 8px; }
.eyebrow { color: #79a9ca; font-size: .7rem; font-weight: 800; letter-spacing: .13em; margin-bottom: 7px; text-transform: uppercase; }
.topbar .eyebrow { color: #9cc9e5; }
.safety-badge, .tenant-chip, .count-chip, .pill { border-radius: 999px; display: inline-flex; font-size: .72rem; font-weight: 800; letter-spacing: .02em; padding: 6px 10px; }
.safety-badge { background: #e1f4ec; color: #155f4a; }
.page-shell { margin: 0 auto; max-width: 1240px; padding: 30px 24px 70px; }
.narrow-shell { max-width: 640px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(34, 68, 100, .06); padding: 22px; }
.auth-panel { margin: 4vh auto 0; max-width: 450px; }
.muted { color: var(--muted); line-height: 1.55; }
.stack-form { display: grid; gap: 9px; }
label { color: var(--ink); font-size: .85rem; font-weight: 700; }
input { border: 1px solid #b9c9d8; border-radius: 9px; color: var(--ink); padding: 11px 12px; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 105, 170, .14); outline: none; }
button { border: 0; border-radius: 9px; font-weight: 750; padding: 10px 14px; transition: transform .12s ease, background .12s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
.primary { background: var(--blue); color: white; }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.secondary { background: #eaf2f8; color: var(--blue-dark); }
.quiet { background: transparent; color: var(--muted); }
.message { min-height: 1.3em; margin: 12px 0 0; font-size: .84rem; line-height: 1.45; }
.message a { color: var(--blue); font-weight: 750; }
.message.error { color: var(--red); }
.message.success { color: var(--green); }
.message.working { color: var(--amber); }
.identity-row, .section-heading, .detail-heading, .toolbar-actions, .action-row { align-items: center; display: flex; gap: 14px; justify-content: space-between; }
.identity-row { margin-bottom: 16px; }
.identity-row .eyebrow { margin-bottom: 3px; }
.tenant-chip { background: #eef5fa; color: var(--blue-dark); margin-left: 8px; }
.toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.board-layout { display: grid; gap: 16px; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.8fr); margin-top: 16px; }
.case-list-panel { min-height: 530px; }
.section-heading { margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 0; }
.count-chip { background: #eaf2f8; color: var(--blue-dark); }
.case-list { display: grid; gap: 8px; }
.case-row { align-items: flex-start; background: #f7fafc; border: 1px solid var(--line); color: var(--ink); display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; }
.case-row:hover, .case-row.active { background: #edf6fc; border-color: #8ab9d8; }
.case-row-title { font-size: .8rem; overflow-wrap: anywhere; }
.pill { background: #edf1f5; color: #526579; white-space: nowrap; }
.state-awaiting-clinician, .state-draft-ready { background: #fff2d7; color: var(--amber); }
.state-awaiting-determination, .state-determination-received { background: #e3effa; color: var(--blue-dark); }
.state-closed-won { background: #e0f5ed; color: var(--green); }
.state-quarantined, .state-closed-lost { background: #fde8e8; color: var(--red); }
.state-evidence-insufficient { background: #f3eafa; color: #71459a; }
.detail-heading { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.detail-heading h2 { overflow-wrap: anywhere; }
.metric-grid { display: grid; gap: 9px; grid-template-columns: repeat(4, 1fr); margin: 20px 0; }
.metric { background: #f7fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.metric span { color: var(--muted); display: block; font-size: .72rem; margin-bottom: 5px; }
.metric strong { font-size: .86rem; overflow-wrap: anywhere; }
.action-row { justify-content: flex-start; flex-wrap: wrap; margin: 18px 0 4px; }
.detail-grid { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 22px; }
.compact-list { list-style: none; margin: 0; padding: 0; }
.compact-list li { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; padding: 8px 0; }
.compact-list span { color: var(--muted); font-size: .8rem; }
.review-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.review-section { border-top: 1px solid var(--line); padding-top: 1rem; }
.review-facts { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-facts div, .criterion-list li, .evidence-list li { background: #f7fafc; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
.review-facts dt, .criterion-list small, .evidence-list small, .policy-heading span { color: var(--muted); font-size: .78rem; }
.review-facts dd { margin: .2rem 0 0; }
.policy-heading, .criterion-list li > div, .evidence-list li > div { align-items: center; display: flex; gap: .5rem; justify-content: space-between; }
.policy-heading { margin-bottom: .75rem; }
.criterion-list, .evidence-list { display: grid; gap: .65rem; list-style: none; margin: 0; padding: 0; }
.criterion-list li { margin-left: calc(var(--criterion-depth) * 1rem); }
.criterion-list p, .evidence-list p { margin: .45rem 0; }
details { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 14px; }
summary { color: var(--blue-dark); cursor: pointer; font-weight: 750; }
pre { background: #102b44; border-radius: 10px; color: #d9edf8; font-size: .72rem; max-height: 360px; overflow: auto; padding: 14px; white-space: pre-wrap; }
.empty-state { padding: 42px 8px; }
[hidden] { display: none !important; }

@media (max-width: 850px) {
  .topbar, .identity-row { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
  .board-layout, .detail-grid { grid-template-columns: 1fr; }
  .case-list-panel { min-height: 0; }
}

@media (max-width: 540px) {
  .page-shell { padding: 20px 14px 50px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .tenant-chip { display: flex; margin: 8px 0 0; width: fit-content; }
  .review-facts { grid-template-columns: 1fr; }
}
