:root {
  --bg: #f7f6f2; --surface: #ffffff; --text: #1d2422; --muted: #5b6662; --line: #dfe3e0;
  --brand: #13609c; --brand-ink: #ffffff; --me: #e4f0f8; --alert: #b3261e; --alert-bg: #fdecea; --warn-bg: #fff6db;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111615; --surface: #1a201f; --text: #e8eeec; --muted: #9fb0ab; --line: #2c3533;
    --brand: #6cc0ea; --brand-ink: #06121b; --me: #1a2d3a; --alert: #ff8a80; --alert-bg: #3a1714; --warn-bg: #352d12;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.brand img { border-radius: 50%; background: #fff; }
.brand-name { display: block; line-height: 1.1; color: var(--brand); }
.brand-tag { display: block; font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.2; }
.lockup { display: flex; justify-content: center; margin: -4px 0 8px; }
.lockup img { max-width: min(320px, 100%); height: auto; border-radius: 14px; background: #fff; }
.brief-logo { display: block; width: 180px; height: auto; margin-bottom: 8px; }
.net { font-size: 13px; color: var(--muted); }
.net.off { color: var(--alert); font-weight: 600; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
h1 { font-size: 24px; margin: 0 0 8px; } h2 { font-size: 18px; margin: 0 0 8px; }
.muted { color: var(--muted); } .fineprint { color: var(--muted); font-size: 13px; }
label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
label.check input { width: auto; margin-top: 4px; }
button { font: inherit; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.chat { display: flex; flex-direction: column; gap: 8px; min-height: 40vh; padding-bottom: 8px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--me); border-color: transparent; }
.bubble.pending { opacity: .7; }
.bubble small { display: block; color: var(--muted); font-size: 12px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: vertical; }
.note { background: var(--warn-bg); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .bubble { max-width: 92%; } }
.alert { border: 2px solid var(--alert); background: var(--alert-bg); }
.alert h1 { color: var(--alert); }
.callbtn { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; background: var(--alert); color: #fff; padding: 14px 16px; border-radius: 12px; margin: 8px 0; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .callbtn { color: #1a0605; } }
.callbtn span:last-child { font-size: 22px; }
.brief { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.brief .banner { background: var(--warn-bg); border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.brief section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.brief h3 { font-size: 15px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.brief table { width: 100%; border-collapse: collapse; font-size: 14px; }
.brief td, .brief th { text-align: left; padding: 4px 8px 4px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.brief th { width: 34%; color: var(--muted); font-weight: 600; }
.brief ul { margin: 0; padding-left: 20px; }
.brief .meta, .brief .footer { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--me); }
@media print {
  .topbar, .row, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  main { max-width: none; padding: 0; }
  .brief { border: none; padding: 0; }
}
fieldset { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 12px 16px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; }
fieldset label.check { margin: 6px 0; }
label.check.flag { color: var(--alert); }
details.card summary { cursor: pointer; }
.qitem { border-top: 1px solid var(--line); padding: 10px 0; }
.qitem p { margin: 0 0 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.opts label { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 400; }
.opts input { width: auto; margin: 0; }
.match h2 { margin-bottom: 4px; }
.match .why { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.urgency { display: inline-block; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--warn-bg); margin: 4px 0 8px; }
.urgency.today { background: var(--alert-bg); color: var(--alert); }
.refs { font-size: 14px; padding-left: 20px; }
.refs li { margin: 6px 0; overflow-wrap: anywhere; }
.refs a { color: var(--brand); }
.rf-banner h2 { color: var(--alert); font-size: 20px; }
button.danger { background: var(--alert); border-color: var(--alert); color: #fff; font-weight: 700; }
.awareness { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; font-size: 14px; }
.awareness .tip { background: var(--me); border-radius: 10px; padding: 8px 12px; }
.followups { border: 2px solid var(--alert); background: var(--alert-bg); border-radius: 10px; padding: 6px 12px; margin-bottom: 8px; }
.followups-title, .prep-title { font-weight: 700; margin: 6px 0 2px; }
.prep { margin: 0; padding-left: 20px; }
.sources summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.dodont { padding-left: 0; list-style: none; margin: 0; }
.dodont li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dodont li.dont strong { color: var(--alert); }

/* Round 4: triage states */
.watch-banner { border: 2px solid #b26a00; background: var(--warn-bg); }
.watch-banner strong { display: block; }
label.check.watch { color: #8a5300; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) label.check.watch { color: #ffc46b; } :root:not([data-theme="light"]) .watch-banner { border-color: #ffc46b; } }
.priority { border: 2px solid var(--alert); }
.priority .pq { margin: 10px 0; }
.priority .pq p { font-weight: 600; margin: 0 0 6px; }
.dont-drive { font-weight: 700; font-size: 18px; }
.handoff-btn { width: 100%; font-size: 18px; padding: 14px; }
.handoff { background: #000; color: #fff; padding: 20px; border-radius: 12px; font-size: 20px; line-height: 1.4; }
.handoff h1 { color: #fff; font-size: 26px; }
.handoff dt { font-weight: 700; color: #ffd54f; margin-top: 12px; }
.handoff dd { margin: 2px 0 0; }
.handoff .fineprint { color: #ddd; }
.handoff button { background: #fff; color: #000; }
@media print { .handoff { background: #fff; color: #000; } .handoff h1, .handoff dd { color: #000; } .handoff dt { color: #000; } }
