:root{
  --bg:#f6f7f6; --surface:#ffffff; --line:#e2e6e3; --line-soft:#eef1ef;
  --fg:#17211d; --fg-soft:#5b6b64; --fg-faint:#8a9790;
  --accent:#0f6e6b; --accent-soft:#e3f1f0;
  --ok:#1d7a4c; --ok-soft:#e4f3ea;
  --warn:#9a6508; --warn-soft:#fbf0dc;
  --bad:#a32c21; --bad-soft:#fbe6e3;
  --radius:10px;
  --mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg:#111614; --surface:#182220; --line:#2a3733; --line-soft:#222d2a;
    --fg:#e8efec; --fg-soft:#a3b3ad; --fg-faint:#7b8b85;
    --accent:#4ecec6; --accent-soft:#17312f;
    --ok:#5fd394; --ok-soft:#142a1f;
    --warn:#e3b260; --warn-soft:#2d2415;
    --bad:#f08e81; --bad-soft:#2e1a17;
  }
}
:root[data-theme="dark"]{
  --bg:#111614; --surface:#182220; --line:#2a3733; --line-soft:#222d2a;
  --fg:#e8efec; --fg-soft:#a3b3ad; --fg-faint:#7b8b85;
  --accent:#4ecec6; --accent-soft:#17312f;
  --ok:#5fd394; --ok-soft:#142a1f;
  --warn:#e3b260; --warn-soft:#2d2415;
  --bad:#f08e81; --bad-soft:#2e1a17;
}
*{box-sizing:border-box}
body{
  margin:0; background:var(--bg); color:var(--fg);
  font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--accent)}
header.top{
  background:var(--surface); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:10;
}
.topin{max-width:1180px;margin:0 auto;padding:0 16px;display:flex;align-items:center;gap:22px;min-height:58px;flex-wrap:wrap}
.brand{font-weight:650;letter-spacing:-.01em;margin-right:4px}
.brand small{display:block;font-weight:400;font-size:11px;color:var(--fg-faint);letter-spacing:.04em;text-transform:uppercase}
nav a{color:var(--fg-soft);text-decoration:none;padding:6px 0;font-size:14px}
nav a:hover,nav a.on{color:var(--fg);box-shadow:inset 0 -2px 0 var(--accent)}
nav{display:flex;gap:18px;flex-wrap:wrap}
.spacer{flex:1}
.pill{font-size:11px;padding:3px 9px;border-radius:999px;border:1px solid var(--line);color:var(--fg-soft);white-space:nowrap}
.pill.live{background:var(--bad-soft);color:var(--bad);border-color:transparent;font-weight:600}
.pill.dry{background:var(--accent-soft);color:var(--accent);border-color:transparent;font-weight:600}
main{max-width:1180px;margin:0 auto;padding:26px 16px 80px}
h1{font-size:22px;letter-spacing:-.02em;margin:0 0 4px}
h2{font-size:15px;letter-spacing:-.01em;margin:30px 0 12px}
.sub{color:var(--fg-soft);margin:0 0 22px;font-size:14px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px}
.grid{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.stat .n{font-size:26px;font-weight:620;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.stat .l{font-size:12px;color:var(--fg-faint);text-transform:uppercase;letter-spacing:.05em;margin-top:2px}
table{width:100%;border-collapse:collapse;font-size:14px}
th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--fg-faint);font-weight:600;padding:9px 10px;border-bottom:1px solid var(--line)}
td{padding:9px 10px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
tr:last-child td{border-bottom:0}
.mono{font-family:var(--mono);font-size:12.5px}
.tag{display:inline-block;font-size:11px;font-weight:600;padding:2px 8px;border-radius:5px;white-space:nowrap}
.t-ready,.t-sent,.t-delivered,.t-read{background:var(--ok-soft);color:var(--ok)}
.t-skipped{background:var(--warn-soft);color:var(--warn)}
.t-invalid,.t-failed{background:var(--bad-soft);color:var(--bad)}
.btn{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:var(--surface);color:var(--fg);
  padding:9px 15px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;text-decoration:none}
.btn:hover{border-color:var(--fg-faint)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
:root[data-theme="dark"] .btn.primary,
:root:not([data-theme="light"]) .btn.primary{color:#07201f}
@media (prefers-color-scheme:light){:root:not([data-theme="dark"]) .btn.primary{color:#fff}}
.btn.danger{background:var(--bad);border-color:var(--bad);color:#fff}
.btn.small{padding:5px 10px;font-size:12.5px}
.btn:disabled{opacity:.45;cursor:not-allowed}
.note{border-radius:8px;padding:11px 14px;font-size:13.5px;margin:10px 0;border:1px solid transparent}
.note.warn{background:var(--warn-soft);color:var(--warn);border-color:color-mix(in srgb,var(--warn) 25%,transparent)}
.note.bad{background:var(--bad-soft);color:var(--bad);border-color:color-mix(in srgb,var(--bad) 25%,transparent)}
.note.ok{background:var(--ok-soft);color:var(--ok)}
.note.info{background:var(--accent-soft);color:var(--accent)}
input[type=text],input[type=password],input[type=time],input[type=file],textarea,select{
  width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:8px;
  background:var(--bg);color:var(--fg);font:inherit}
textarea{resize:vertical;min-height:70px}
label.fld{display:block;font-size:12px;color:var(--fg-faint);text-transform:uppercase;letter-spacing:.05em;margin-bottom:5px}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.bar{height:7px;background:var(--line-soft);border-radius:999px;overflow:hidden}
.bar>i{display:block;height:100%;background:var(--accent);transition:width .4s ease}
.scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.muted{color:var(--fg-faint)}
.right{text-align:right}
.thread{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:16px;margin-bottom:12px}
.bubble{background:var(--accent-soft);border-radius:10px;padding:10px 13px;margin:9px 0;font-size:14.5px}
.clock{font-size:12px;font-weight:600}
.clock.open{color:var(--ok)} .clock.shut{color:var(--bad)}
@media (max-width:640px){
  main{padding:18px 16px 70px}
  .topin{min-height:52px;gap:14px}
  table:not(.sheet):not(.files) th:nth-child(n+6),
  table:not(.sheet):not(.files) td:nth-child(n+6){display:none}
}


/* === Overzicht: the verdict ==========================================
   The page leads with a sentence, so this panel is the one loud element
   on the screen. Everything below it stays deliberately quiet. */
.verdict{
  background:var(--surface); border:1px solid var(--line);
  border-left:3px solid var(--state,var(--line)); border-radius:var(--radius);
  padding:18px 20px; margin:0 0 16px;
}
.verdict.v-ok{--state:var(--ok)}
.verdict.v-warn{--state:var(--warn)}
.verdict.v-bad{--state:var(--bad)}
.verdict.v-idle{--state:var(--accent)}
.verdict-line{
  margin:0; font-size:20px; line-height:1.35; letter-spacing:-.015em;
  font-weight:550; color:var(--fg); max-width:60ch;
}
.verdict.v-bad .verdict-line{color:var(--bad)}
.verdict-more{margin:12px 0 0; padding:0; list-style:none; font-size:14px}
.verdict-more li{
  color:var(--fg-soft); padding:3px 0 3px 14px; position:relative; max-width:60ch;
}
.verdict-more li::before{
  content:""; position:absolute; left:0; top:11px;
  width:6px; height:6px; border-radius:50%; background:var(--fg-faint);
}
.verdict-more li.m-bad::before{background:var(--bad)}
.verdict-more li.m-warn::before{background:var(--warn)}
.verdict-more li.m-idle::before{background:var(--accent)}
.verdict-more a{color:inherit; text-decoration:underline; text-decoration-color:var(--line)}
.verdict-more a:hover{text-decoration-color:currentColor}
.verdict-act{margin:14px 0 0}

/* === Overzicht: the day ============================================== */
.panels{display:grid; gap:12px; grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
@media (max-width:760px){.panels{grid-template-columns:minmax(0,1fr)}}

.meter-head{margin:0 0 9px; display:flex; align-items:baseline; gap:7px}
.meter-n{font-size:28px; font-weight:620; letter-spacing:-.02em}
.meter-foot{margin:9px 0 0; font-size:13px; line-height:1.45}
.meter-foot:empty{display:none}
.bar>i.full{background:var(--warn)}

/* A filename is data, so it keeps the mono face, but at text weight —
   not dressed up as a code sample. */
.filename{font-family:var(--mono); font-size:12.5px; overflow-wrap:anywhere}
.filename-line{display:flex; flex-direction:column; gap:3px}

.tag.t-neutral{background:var(--line-soft); color:var(--fg-soft)}

/* === Controleren: the counts and the send box ======================== */
.verdict-counts{display:flex; flex-direction:column; justify-content:center}
.count-main{margin:0; display:flex; align-items:baseline; gap:9px; flex-wrap:wrap}
.count-n{font-size:34px; font-weight:620; letter-spacing:-.025em; color:var(--ok)}
.count-l{font-size:15px; color:var(--fg)}
.count-rest{margin:7px 0 0; font-size:13.5px}
.count-norm{margin:5px 0 0; font-size:13px}

.sendbox{display:flex; flex-direction:column; justify-content:center}
.sendbox.live{
  border-color:color-mix(in srgb,var(--bad) 35%,transparent);
  background:color-mix(in srgb,var(--bad-soft) 60%,var(--surface));
}
.btn.send{
  width:100%; justify-content:center; padding:15px 18px; font-size:16px;
  font-weight:600; background:var(--accent); border-color:var(--accent); color:#fff;
}
:root[data-theme="dark"] .btn.send,
:root:not([data-theme="light"]) .btn.send{color:#07201f}
@media (prefers-color-scheme:light){:root:not([data-theme="dark"]) .btn.send{color:#fff}}
.sendbox.live .btn.send{background:var(--bad); border-color:var(--bad); color:#fff}
.btn.send:disabled{background:var(--line-soft); border-color:var(--line); color:var(--fg-faint)}
.sendnote{margin:10px 0 0; font-size:13px; color:var(--fg-soft); text-align:center}
.sendbox.live .sendnote{color:var(--bad); font-weight:500}
.sendrow{margin:14px 0 0; display:flex; align-items:center; gap:10px}
.sendrow .fld{margin:0; flex:1}
.sendrow input{width:120px}

/* === Controleren: the sheet =========================================
   Read down a column, not across a row: numbers and dates are tabular and
   right-aligned where they are compared, names are not. */
table.sheet td,table.sheet th{padding:8px 11px}
table.sheet .num{font-family:var(--mono); font-size:12px; font-variant-numeric:tabular-nums}
table.sheet .tel{white-space:nowrap; font-variant-numeric:tabular-nums}
table.sheet .tel.unusable{color:var(--bad); text-decoration:line-through}
table.sheet .cell-name{font-weight:500}
table.sheet tr:hover td{background:var(--line-soft)}
table.sheet .reason-cell{font-size:13px; max-width:34ch}
.tablefoot{margin:14px 0 0}
@media (max-width:640px){
  table.sheet th:nth-child(5),table.sheet td:nth-child(5){display:none}
}

/* Reasons counted once, with the rows folded away behind them. */
.reasons{margin:0; padding:0; list-style:none}
.reasons li{
  display:flex; gap:11px; align-items:baseline;
  padding:7px 0; border-bottom:1px solid var(--line-soft); font-size:14px;
}
.reasons li:last-child{border-bottom:0}
.reason-n{
  min-width:2.4em; text-align:right; font-weight:600;
  font-variant-numeric:tabular-nums; color:var(--fg);
}
.reason-t{color:var(--fg-soft)}
.fold{margin:14px 0 0; border-top:1px solid var(--line-soft); padding-top:12px}
.fold summary{cursor:pointer; font-size:13.5px; color:var(--accent)}
.fold summary:hover{text-decoration:underline}
.fold[open] summary{margin-bottom:12px}

/* Which column fed which field. */
.cols{
  margin:0; display:grid; gap:4px 16px;
  grid-template-columns:max-content minmax(0,1fr);
}
.cols dt{font-size:13px; color:var(--fg-soft)}
.cols dd{margin:0}
.refused{margin:14px 0 0; font-size:13px; color:var(--bad)}

@media (prefers-reduced-motion:reduce){
  *{animation:none !important; transition:none !important}
}

/* A visible focus ring was missing entirely. Reception works between phone
   calls and a tab key is often faster than the trackpad. */
:is(a,button,input,select,textarea,summary):focus-visible{
  outline:2px solid var(--accent); outline-offset:2px; border-radius:4px;
}

/* Nothing to send: say which reason accounts for it, in plain words. */
.empty{margin:0}
.empty-head{margin:0; font-size:16px; font-weight:550}
.empty-why{margin:8px 0 0; color:var(--fg-soft); font-size:14px; max-width:62ch}
.empty-note{
  margin:14px 0 0; padding:12px 14px; background:var(--warn-soft);
  color:var(--warn); border-radius:8px; font-size:13.5px;
  line-height:1.5; max-width:72ch;
}

/* === The conversation with a patient ================================
   Read top to bottom: the patient on the left, the practice on the
   right, which is the shape everyone already knows from a phone. */
.thread-top{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px}
.thread-top .spacer{flex:1}
.chat{display:flex; flex-direction:column; gap:10px}
.msg{display:flex; flex-direction:column; max-width:min(78%,46ch)}
.msg.in{align-self:flex-start}
.msg.out{align-self:flex-end; align-items:flex-end}
.msg .bubble{margin:0; font-size:14.5px}
.msg.in .bubble{
  background:var(--line-soft); color:var(--fg);
  border-radius:12px 12px 12px 3px;
}
.msg.out .bubble{
  background:var(--accent-soft); color:var(--fg);
  border-radius:12px 12px 3px 12px;
}
.msg .when{font-size:11.5px; margin-top:3px; padding:0 3px}
.msg .tapped{
  display:block; margin-top:5px; font-size:11.5px; color:var(--fg-faint);
  font-style:italic;
}
/* Test mode must never be mistakable for a real answer. */
.msg .notsent{color:var(--bad); font-weight:600; margin-left:6px}
@media (max-width:640px){
  .msg{max-width:88%}
}

/* === Overzicht: the funnel ===========================================
   Four stages of one batch. Each bar is that stage's share of what went
   out, so the drop-off is the shape you read, not the numbers. */
.h2-when{font-weight:400; font-size:13px; letter-spacing:0}
.funnel{display:flex; flex-direction:column; gap:9px}
.stage{display:grid; grid-template-columns:8.5em 1fr 3em; align-items:center; gap:12px}
.stage-l{font-size:13.5px; color:var(--fg-soft)}
.stage-bar{
  height:9px; background:var(--line-soft); border-radius:999px; overflow:hidden;
}
.stage-bar>i{display:block; height:100%; background:var(--accent); border-radius:999px}
/* Later stages are quieter: the eye should land on what went out first. */
.s-arrived .stage-bar>i{background:color-mix(in srgb,var(--accent) 78%,transparent)}
.s-read .stage-bar>i{background:color-mix(in srgb,var(--accent) 58%,transparent)}
.s-answered .stage-bar>i{background:var(--ok)}
.stage-n{
  text-align:right; font-weight:600; font-size:14px;
  font-variant-numeric:tabular-nums;
}
.outcome{
  margin:16px 0 0; padding-top:14px; border-top:1px solid var(--line-soft);
  font-size:14px; color:var(--fg-soft);
}
.outcome.has{color:var(--ok); font-weight:550; font-size:15px}

/* First run: an invitation, not a dashboard of zeros. */
.fresh{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); padding:26px 24px; margin:0 0 16px;
}
.fresh-head{margin:0; font-size:19px; font-weight:550; letter-spacing:-.015em}
.fresh-how{margin:9px 0 18px; color:var(--fg-soft); max-width:58ch; font-size:14.5px}

.safety{
  margin:24px 0 0; font-size:13px; line-height:1.6; max-width:76ch;
  padding-top:14px; border-top:1px solid var(--line-soft);
}

/* On a phone the row count and the date matter less than being able to
   open the file, so those two columns go rather than the action. */
@media (max-width:640px){
  .files th:nth-child(3),.files td:nth-child(3),
  .files th:nth-child(4),.files td:nth-child(4){display:none}
  /* Wrapped, not truncated: two files from the same week differ only in
     the end of the name, and an ellipsis would hide exactly that. */
  .files td.filename{
    font-size:11.5px; max-width:7.5em; line-height:1.35;
    overflow-wrap:anywhere;
  }
  .files td,.files th{padding:9px 6px}
  .files .btn.small{padding:5px 8px; font-size:12px}
}

/* A care home listed once, with its residents counted behind it. */
.inst-why{margin:0 0 14px; font-size:13.5px; max-width:66ch; line-height:1.5}

/* Deleting is available but never inviting: quiet until you reach for it. */
form.inline{display:inline}
.nowrap{white-space:nowrap}
.nowrap .btn{margin-left:6px}
.btn.danger-quiet{color:var(--fg-faint); border-color:var(--line)}
.btn.danger-quiet:hover{color:var(--bad); border-color:var(--bad); background:var(--bad-soft)}
.wipe{margin:12px 0 0; text-align:right}

/* The test/live switch. Barely there while safe; unmissable while live. */
.modeswitch{margin:26px 0 0}
.modeswitch summary{
  cursor:pointer; font-size:12px; color:var(--fg-faint);
  list-style:none; width:max-content;
}
.modeswitch summary::-webkit-details-marker{display:none}
.modeswitch summary:hover{color:var(--fg-soft)}
.modeswitch[open] summary{margin-bottom:10px; color:var(--fg-soft)}
.moderow{display:flex; gap:9px; align-items:center; flex-wrap:wrap}
.moderow input{width:120px; letter-spacing:.2em}
.modenote{margin:8px 0 0; font-size:12px; max-width:52ch}
.livebar{
  margin:26px 0 0; display:flex; align-items:center; gap:14px; flex-wrap:wrap;
  border-width:2px;
}
.livebar strong{flex:1}
