:root {
  --ink: #080808;
  --muted: #686862;
  --paper: #fafaf7;
  --card: #ffffff;
  --soft: #f1f1ec;
  --forest: #080808;
  --forest-deep: #000000;
  --copper: #9a5b2c;
  --copper-soft: #f5e8dc;
  --danger: #8f2921;
  --danger-soft: #f8e5e2;
  --success: #184d37;
  --success-soft: #e2eee8;
  --line: #deded8;
  --line-strong: #b8b8b0;
  --focus: #1d5f67;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.5 Arial, Helvetica, system-ui, sans-serif; letter-spacing: -.01em; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--muted); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; color: white; background: var(--ink); padding: .75rem 1rem; border-radius: 99px; }
.skip-link:focus { top: 1rem; }

.topbar { background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; min-height: 82px; margin: auto; padding: 1rem 1.6rem; display: flex; align-items: center; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; white-space: nowrap; font-size: 1.24rem; font-weight: 600; letter-spacing: -.04em; }
.brand:hover { color: var(--ink); }
.brand small { display: block; margin-top: .1rem; color: var(--muted); font-size: .58rem; line-height: 1; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 10px); gap: 3px; width: 23px; flex: 0 0 23px; }
.brand-mark i { display: block; width: 10px; height: 10px; background: var(--ink); border-radius: 4px 7px 4px 7px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { border-radius: 7px 4px 7px 4px; }
.nav { display: flex; align-items: center; gap: .15rem; margin: 0 auto; }
.nav a { padding: .55rem .8rem; border-radius: 99px; color: #343431; text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--soft); }
.identity { display: flex; align-items: center; gap: .8rem; }
.identity-copy { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.identity-copy strong, .identity-copy span { display: block; }
.identity-copy strong { color: var(--ink); font-size: .83rem; }
.role-switch { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .45rem .85rem; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: white; text-decoration: none; font-weight: 600; }
.role-switch:hover { color: var(--ink); border-color: var(--ink); }
.link-button { border: 0; padding: 0; color: var(--ink); background: transparent; text-decoration: underline; cursor: pointer; }
.partner-banner { display: flex; justify-content: center; gap: 1rem; padding: .48rem 1rem; color: #4f3620; background: var(--copper-soft); border-bottom: 1px solid #dfc5ad; font-size: .72rem; }
.partner-banner strong { color: #291a0e; }
.partner-banner span + span::before { content: "·"; margin-right: 1rem; color: #9d8068; }

main { max-width: 1240px; margin: 0 auto; padding: 3.5rem 1.6rem 6rem; }
.narrow { max-width: 820px; }
.eyebrow { margin: 0 0 .5rem; color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
h1, h2, h3 { margin-top: 0; color: var(--ink); font-family: Arial, Helvetica, system-ui, sans-serif; letter-spacing: -.045em; }
h1 { margin-bottom: 0; font-size: clamp(2.9rem, 6vw, 5.15rem); line-height: .98; font-weight: 500; }
h2 { margin-bottom: 0; font-size: clamp(1.45rem, 2.5vw, 2rem); line-height: 1.08; font-weight: 500; }
h3 { margin-bottom: 0; font-size: 1.05rem; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
p { margin: .5rem 0 0; }
.lede { max-width: 720px; color: #363633; font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.45; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.page-head .lede { margin-top: 1rem; }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.today-hero { display: flex; min-height: 380px; padding: 1rem 0 4.5rem; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.today-hero .eyebrow { margin-top: 2.2rem; }
.today-hero .lede { max-width: 700px; margin: 1.25rem auto 0; }
.today-hero .page-actions { justify-content: center; margin-top: 1.65rem; }
.handoff-pill { display: inline-flex; align-items: center; gap: .55rem; min-height: 38px; max-width: min(100%, 760px); padding: .5rem .95rem; border-radius: 99px; color: #383834; background: var(--soft); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff-pill span { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--success); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: .65rem 1.25rem; border: 1px solid var(--ink); border-radius: 99px; color: white; background: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.015em; cursor: pointer; }
.button::after { content: "→"; font-size: 1.05em; }
button.button::after { content: none; }
.button:hover { color: white; background: #2d2d2a; }
.button.secondary { color: var(--ink); background: white; border-color: var(--line); }
.button.secondary:hover { color: var(--ink); border-color: var(--ink); background: white; }
.button.copper { color: white; border-color: var(--copper); background: var(--copper); }
.button.danger { color: var(--danger); border-color: #d4aaa5; background: transparent; }
.button.danger:hover { color: white; border-color: var(--danger); background: var(--danger); }
.button[disabled] { opacity: .55; cursor: wait; }

.card { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.card-body { padding: 1.5rem; }
.hero-summary { padding: 1.5rem; margin-bottom: 1rem; }
.hero-summary p { max-width: 800px; font-size: 1.2rem; line-height: 1.45; }
.meta { color: var(--muted); font-size: .8rem; letter-spacing: 0; }
.muted { color: var(--muted); }

.count-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 3rem; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.count-card { min-height: 132px; padding: 1.35rem 1.25rem; background: transparent; border-right: 1px solid var(--line); }
.count-card:last-child { border-right: 0; }
.count-card strong { display: block; color: var(--ink); font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; font-weight: 400; letter-spacing: -.06em; }
.count-card span { display: block; margin-top: .8rem; color: var(--muted); font-size: .82rem; }
.count-card.attention { color: var(--danger); background: transparent; }
.count-card.attention strong { color: var(--danger); }

.ingest-strip { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .9fr) auto; gap: 1.5rem; align-items: center; margin: 0 0 1rem; padding: 1.25rem 1.4rem; }
.ingest-summary strong { display: block; max-width: 620px; font-size: .95rem; font-weight: 600; }
.ingest-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 0; }
.ingest-facts dt { color: var(--muted); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ingest-facts dd { margin: .15rem 0 0; font-size: .78rem; }
.text-link { font-weight: 600; white-space: nowrap; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.inbox-location { margin-top: 1rem; color: var(--muted); font-size: .78rem; }
.inbox-location summary { width: fit-content; cursor: pointer; font-weight: 600; }
.inbox-location code { display: block; margin-top: .5rem; padding: .6rem .7rem; color: var(--ink); background: var(--soft); border-radius: 8px; overflow-wrap: anywhere; }

.layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .7fr); gap: 1rem; align-items: start; }
.stack { display: grid; gap: 1rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: 1.35rem 1.45rem 1.1rem; border-bottom: 1px solid var(--line); }
.queue-list { list-style: none; padding: 0; margin: 0; }
.queue-item { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 1.25rem 1.45rem; border-bottom: 1px solid var(--line); transition: background-color .15s ease; }
.queue-item:last-child { border-bottom: 0; }
.queue-item:hover { background: #f8f8f4; }
.queue-title { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.patient { color: var(--ink); font-size: 1.02rem; font-weight: 600; text-decoration: none; }
.patient:hover { text-decoration: underline; }
.queue-details { margin-top: .35rem; color: var(--muted); font-size: .84rem; }
.amount { color: var(--ink); font-size: 1rem; font-weight: 600; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 26px; padding: .18rem .55rem; border-radius: 99px; color: #343431; background: var(--soft); font-size: .7rem; font-weight: 700; letter-spacing: 0; }
.badge.blocked, .badge.release_failed, .badge.rejected { color: var(--danger); background: var(--danger-soft); }
.badge.awaiting_office, .badge.awaiting_provider, .badge.appeal_drafted { color: #75411f; background: var(--copper-soft); }
.badge.released, .badge.submitted, .badge.appeal_approved { color: var(--success); background: var(--success-soft); }

.activity { list-style: none; margin: 0; padding: .7rem 1.45rem 1.1rem; }
.activity li { position: relative; padding: .6rem 0 .6rem 1rem; color: #363633; font-size: .82rem; }
.activity li::before { content: ""; position: absolute; left: 0; top: 1rem; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.release-list { list-style: none; margin: 0; padding: .7rem 1.45rem 1.1rem; }
.release-list li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.release-list li:last-child { border: 0; }

.notice { padding: .9rem 1rem; border: 1px solid #a8c4b4; border-radius: 12px; color: var(--success); background: var(--success-soft); margin: 0 0 1rem; }
.notice.warning { color: #6e3b1c; border-color: #dcb38f; background: var(--copper-soft); }
.notice.error { color: var(--danger); border-color: #d8aaa5; background: var(--danger-soft); }

.decision-card { padding: clamp(1.4rem, 3vw, 2.35rem); border-color: var(--ink); border-radius: 22px; }
.decision-card > h2 { max-width: 900px; font-size: clamp(1.8rem, 4vw, 3.25rem); line-height: 1.05; }
.decision-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin-top: 2rem; }
.decision-grid section { padding-top: 1rem; border-top: 1px solid var(--line); }
.decision-grid strong { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; }
.approval-track { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: 1.5rem 0; }
.approval-step { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.approval-step.complete { border-color: #9fb9aa; background: var(--success-soft); }
.approval-step.current { border-color: #c99b77; background: var(--copper-soft); }
.approval-step span { display: block; margin-top: .2rem; color: var(--muted); font-size: .78rem; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.2rem; margin-top: 1rem; }
.definition-grid dt { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.definition-grid dd { margin: .15rem 0 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { text-align: left; padding: .75rem 1rem; color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.row-error { background: #fff7f5; }
.issue-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.issue-list li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.issue-list li:last-child { border: 0; }
.issue-code { display: block; color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.timeline { list-style: none; margin: 1rem 0 0; padding: 0 0 0 1.1rem; border-left: 1px solid var(--line-strong); }
.timeline li { position: relative; padding: 0 0 1.25rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .4rem; width: 8px; height: 8px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }
.timeline time { display: block; color: var(--muted); font-size: .7rem; }
.timeline p { margin: .18rem 0; }

form.stack-form { display: grid; gap: .9rem; margin-top: 1.2rem; }
label { display: grid; gap: .35rem; color: var(--ink); font-weight: 600; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 48px; padding: .7rem .8rem; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
input[type="file"] { padding: .62rem; background: var(--card); }
.form-actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.drop-card { min-height: 260px; display: flex; align-items: center; justify-content: center; padding: 2.2rem; border: 1px dashed var(--line-strong); text-align: center; }
.drop-card form { width: min(100%, 560px); }
.column-list { columns: 2; padding-left: 1.2rem; color: var(--muted); font-size: .82rem; }

.artifact { padding: 1rem; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; }
.artifact-label { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: .66rem; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); padding: 1rem; border-radius: 10px; }
.empty { padding: 2rem 1.4rem; color: var(--muted); text-align: center; }
.checklist { list-style: none; margin: .8rem 0 0; padding: 0; }
.checklist li { position: relative; padding: .8rem 0 .8rem 1.8rem; border-bottom: 1px solid var(--line); }
.checklist li::before { content: "✓"; position: absolute; left: .15rem; color: var(--success); font-weight: 800; }

.login-shell { max-width: 980px; margin: 3vh auto; }
.login-shell > h1 { max-width: 760px; }
.login-shell > .lede { margin-top: 1rem; }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.login-card { min-height: 315px; padding: 1.6rem; }
.login-card p { color: var(--muted); }

.site-footer { max-width: 1240px; margin: auto; padding: 2rem 1.6rem 3rem; display: flex; gap: 1.3rem; flex-wrap: wrap; color: var(--muted); font-size: .75rem; border-top: 1px solid var(--line); }
.site-footer strong { color: var(--ink); margin-right: auto; }

@media (max-width: 900px) {
  .topbar-inner { align-items: center; flex-wrap: wrap; gap: .8rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; justify-content: center; }
  .identity { margin-left: auto; }
  main { padding-top: 2.4rem; }
  .today-hero { min-height: 330px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .count-grid { grid-template-columns: repeat(3, 1fr); }
  .count-card:nth-child(3) { border-right: 0; }
  .count-card:nth-child(n+4) { border-top: 1px solid var(--line); }
  .layout, .detail-grid, .decision-grid, .ingest-strip { grid-template-columns: 1fr; }
  .ingest-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  body { font-size: 16px; }
  .topbar-inner, main { padding-left: 1rem; padding-right: 1rem; }
  .topbar-inner { min-height: 70px; }
  .brand small, .identity-copy { display: none; }
  .partner-banner { justify-content: flex-start; overflow-x: auto; white-space: nowrap; }
  .nav { justify-content: flex-start; }
  .nav a { white-space: nowrap; }
  .today-hero { min-height: 0; padding: .5rem 0 3rem; align-items: flex-start; text-align: left; }
  .today-hero .lede { margin-left: 0; }
  .today-hero .page-actions { width: 100%; justify-content: flex-start; }
  .handoff-pill { max-width: 100%; }
  .login-grid, .approval-track { grid-template-columns: 1fr; }
  .queue-item { grid-template-columns: 1fr; gap: .35rem; }
  .count-grid { grid-template-columns: repeat(2, 1fr); }
  .count-card:nth-child(n) { border-top: 0; border-right: 1px solid var(--line); }
  .count-card:nth-child(2n) { border-right: 0; }
  .count-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .definition-grid { grid-template-columns: 1fr; }
  .column-list { columns: 1; }
  .button { width: 100%; }
  .page-actions, .form-actions { width: 100%; }
  .site-footer { flex-direction: column; gap: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .site-footer, .no-print { display: none !important; }
  body { background: white; }
  main { max-width: none; padding: 0; }
  .card { border-radius: 0; box-shadow: none; }
}
