/* Tisols Command Center. Same tokens and the same three rules as the admin console: one accent;
   separation by surface and space rather than borders; status colour never alone. */
:root {
  color-scheme: light;
  --plane: #f9f9f7; --card: #ffffff; --sunken: #f4f4f1;
  --hairline: rgba(11,11,11,.09); --hairline-soft: rgba(11,11,11,.055);
  --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #898781;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --idle: #898781;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-wash: rgba(42,120,214,.08);
  --tint: 14%;
  --lift: 0 1px 2px rgba(11,11,11,.04), 0 1px 1px rgba(11,11,11,.03);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane: #0d0d0d; --card: #1a1a19; --sunken: #141413;
    --hairline: rgba(255,255,255,.10); --hairline-soft: rgba(255,255,255,.06);
    --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #898781;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57,135,229,.12);
    --tint: 20%; --lift: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d; --card: #1a1a19; --sunken: #141413;
  --hairline: rgba(255,255,255,.10); --hairline-soft: rgba(255,255,255,.06);
  --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #898781;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57,135,229,.12);
  --tint: 20%; --lift: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--plane); color: var(--ink);
  font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
.boot { padding: 40px; color: var(--ink-3); }

/* ---- the frame: the shared header, the side panel, the page ---------------------------------
   The header is the Tisols bar (templates/suitebar.html); the Command Center fills its two slots.
   The side panel is a column of sections on wide screens, a strip of icons when collapsed, and a
   drawer that slides over the page on phones. */
:root { --side-w: 256px; --rail-w: 68px; --on-strong: #ffffff; }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--sb-h, 0px)); }
.main { padding: 28px 34px 80px; min-width: 0; outline: none; }
.side { position: sticky; top: var(--sb-h, 0px); height: calc(100vh - var(--sb-h, 0px)); display: flex; flex-direction: column;
  min-width: 0; background: var(--card); box-shadow: inset -1px 0 0 var(--hairline); }
/* The frame's buttons start from nothing: the app's form buttons are filled blue, these are not.
   Single-class weight, so each button's own rule below (same weight, later) takes over. */
.grp-head, .rail-toggle, .side-close, .hb-btn, .hb-acct, .pop-item { margin: 0; padding: 0; border: 0; background: transparent;
  color: inherit; font: inherit; line-height: inherit; text-align: inherit; cursor: pointer; }
.side button:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* which clinic this is */
.ws { display: flex; align-items: center; gap: 11px; padding: 16px 16px 12px; }
.ws-mark { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 700; letter-spacing: .03em; }
.ws-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.ws-text strong { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-text small { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws .ws-mode { display: none; margin-top: 6px; align-self: flex-start; }      /* the header shows it; phones show it here */
.side-close { display: none; margin-left: auto; width: 38px; height: 38px; border-radius: 10px; place-items: center; color: var(--ink-2); }
.side-close:hover { background: var(--hairline-soft); color: var(--ink); }

/* the sections */
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 14px;
  scrollbar-width: thin; scrollbar-color: var(--hairline) transparent; }
.side-scroll::-webkit-scrollbar { width: 10px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 10px; border: 3px solid var(--card); }
.grp + .grp { margin-top: 12px; }
.grp-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px 5px 10px; border-radius: 7px;
  font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.grp-head:hover, .grp-head.holds-here { color: var(--ink-2); background: transparent; }
.grp-name { flex: 1; }
.grp-head .ic { transition: transform .15s ease; }
.grp-head[aria-expanded="false"] .ic { transform: rotate(-90deg); }
.grp-items { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 34px; padding: 6px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: 13.5px; line-height: 1.25; }
.nav-item:hover { background: var(--hairline-soft); color: var(--ink); }
.nav-ic { flex: none; display: grid; place-items: center; width: 18px; color: var(--ink-3); }
.nav-item:hover .nav-ic { color: var(--ink-2); }
.nav-item.here { background: var(--accent-wash); color: var(--accent-ink); font-weight: 580; }
.nav-item.here .nav-ic { color: var(--accent); }
.nav-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-note { font-size: 11.5px; font-weight: 500; color: var(--critical); margin-top: 2px; }
.nav-ext { display: grid; color: var(--ink-3); }
.count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; background: var(--sunken); color: var(--ink-2); }
.count.urgent { background: color-mix(in srgb, var(--critical) 13%, transparent); color: var(--critical); }
.nav-item .count.urgent { display: none; }      /* the note says it in words; the number is for the icon strip */

/* collapsing the panel to a strip of icons */
.side-foot { padding: 8px 12px 12px; box-shadow: inset 0 1px 0 var(--hairline-soft); }
.rail-toggle { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: 8px;
  color: var(--ink-3); font-size: 13px; }
.rail-toggle:hover { background: var(--hairline-soft); color: var(--ink); }
@media (min-width: 861px) {
  .shell.rail { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .shell.rail .ws { justify-content: center; padding: 16px 0 12px; }
  .shell.rail .ws-text, .shell.rail .grp-head, .shell.rail .nav-text, .shell.rail .nav-ext,
  .shell.rail .rail-toggle span { display: none; }
  .shell.rail .side-scroll { padding: 4px 10px 14px; }
  .shell.rail .grp + .grp { margin-top: 10px; padding-top: 10px; box-shadow: inset 0 1px 0 var(--hairline-soft); }
  .shell.rail .grp-items[hidden] { display: grid; }
  .shell.rail .nav-item { justify-content: center; padding: 8px 0; position: relative; }
  .shell.rail .nav-item .count { display: inline-grid; position: absolute; top: 1px; right: 4px; min-width: 17px; height: 17px;
    padding: 0 4px; font-size: 10px; box-shadow: 0 0 0 2px var(--card); }
  .shell.rail .side-foot { padding: 8px 10px 12px; }
  .shell.rail .rail-toggle { justify-content: center; padding: 6px 0; }
}

/* phones and narrow windows: the panel becomes a drawer over the page */
.scrim { display: none; }
@media (max-width: 860px) {
  .shell, .shell.rail { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; height: auto; width: min(304px, 86vw);
    transform: translateX(-104%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: 0 0 0 1px var(--hairline), 0 16px 48px rgba(11,11,11,.22); }
  .shell.drawer-open .side { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(11,11,11,.4); opacity: 0;
    pointer-events: none; transition: opacity .22s ease; }
  .shell.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .side-close { display: grid; }
  .ws { padding: 12px 10px 10px 16px; }
  .side-foot { display: none; }
  .nav-item { min-height: 40px; }
  .main { padding: 20px 16px 60px; }
}
@media (max-width: 600px) { .ws .ws-mode { display: inline-flex; } }
body.no-scroll { overflow: hidden; }

/* ---- the header's Command Center controls ------------------------------------------------------ */
.suitebar[data-loading]::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 34%;
  background: var(--sb-mark); border-radius: 2px; animation: cc-loading 1.1s ease-in-out infinite; }
@keyframes cc-loading { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.suitebar button:focus-visible, .suitebar .hb-mode:focus-visible { outline: 2px solid var(--sb-mark); outline-offset: 1px; }
.hb-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--sb-ink-2); }
.hb-btn:hover, .hb-btn[aria-expanded="true"] { background: var(--sb-hover); color: var(--sb-ink); }
.suitebar.sb-outside .sb-links, .suitebar.sb-outside .sb-sep, .suitebar.sb-outside .sb-switch { display: none; }
.suitebar .hb-menu { display: none; }
@media (max-width: 860px) { .suitebar .hb-menu { display: grid; } }
.hb-badge { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center; background: var(--critical); color: var(--on-strong); font-size: 10px; font-weight: 700;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--sb-bg); }
.hb-badge[hidden] { display: none; }
.hb-wrap { position: relative; }
/* search */
.hb-search { display: flex; align-items: center; gap: 8px; width: clamp(220px, 24vw, 340px); height: 36px; padding: 0 7px 0 11px;
  border-radius: 10px; background: var(--sb-field); box-shadow: inset 0 0 0 1px var(--sb-line); color: var(--sb-ink-3); }
.hb-search:focus-within { background: var(--sb-bg); box-shadow: inset 0 0 0 1px var(--sb-mark), 0 0 0 3px var(--sb-ring); color: var(--sb-ink-2); }
.suitebar .hb-search-input { all: unset; flex: 1; min-width: 0; height: 100%; font-size: 13.5px; color: var(--sb-ink); }
.suitebar .hb-search-input::placeholder { color: var(--sb-ink-3); }
.hb-kbd { flex: none; font: 600 11px/1 system-ui, sans-serif; color: var(--sb-ink-3); padding: 4px 6px; border-radius: 6px;
  background: var(--sb-bg); box-shadow: inset 0 0 0 1px var(--sb-line); }
.suitebar .hb-search-btn { display: none; }
@media (max-width: 760px) {
  .suitebar .hb-search-btn { display: grid; }
  .hb-search { display: none; }
  .hb-search-wrap.expanded .hb-search { display: flex; position: fixed; z-index: 75; top: 8px; left: 8px; right: 8px; width: auto;
    background: var(--sb-bg); }
  .hb-search-wrap.expanded .pop-palette { position: fixed; top: calc(var(--sb-h) + 2px); left: 8px; right: 8px; width: auto; }
  .hb-kbd { display: none; }
}
/* test mode */
.hb-mode { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px 0 9px; margin: 0 4px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
  background: color-mix(in srgb, var(--warning) 15%, transparent); color: color-mix(in srgb, var(--warning) 40%, var(--sb-ink)); }
.hb-mode i { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
a.hb-mode:hover { background: color-mix(in srgb, var(--warning) 24%, transparent); }
@media (max-width: 600px) { .hb-mode { display: none; } }
/* account */
.hb-acct { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 4px; border-radius: 999px; color: var(--sb-ink-3); }
.hb-acct:hover, .hb-acct[aria-expanded="true"] { background: var(--sb-hover); }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  letter-spacing: .03em; background: color-mix(in srgb, var(--sb-mark) 16%, var(--sb-bg)); color: var(--sb-here); }
.avatar.lg { width: 38px; height: 38px; font-size: 13px; }
.hb-name { font-size: 13.5px; font-weight: 600; color: var(--sb-ink); }
@media (max-width: 1100px) { .hb-name, .hb-acct > .ic { display: none; } .hb-acct { padding: 0 4px; } }
/* the menus that drop from the header */
.pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 70; min-width: 264px; padding: 6px; border-radius: 12px;
  background: var(--sb-bg); color: var(--sb-ink); box-shadow: var(--sb-pop-shadow);
  font: 400 13.5px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
.pop[hidden] { display: none; }
.pop-head, .pal-head { padding: 9px 10px 5px; font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--sb-ink-3); }
.pop-list { list-style: none; margin: 0; padding: 0; }
.pop-list a, .pop-acct a, .suitebar .pop-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px;
  border-radius: 8px; color: var(--sb-ink-2); text-decoration: none; }
.pop-list a:hover, .pop-acct a:hover, .suitebar .pop-item:hover, .pop-list a:focus-visible, .pop-acct a:focus-visible,
.suitebar .pop-item:focus-visible { background: var(--sb-hover); color: var(--sb-ink); outline: none; }
.pop-list a > span { flex: 1; }
.pop-list a > .ic, .pop-acct .ic { color: var(--sb-ink-3); }
.pop-list a.urgent > .ic:first-child { color: var(--critical); }
.pop-empty, .pal-note { margin: 0; padding: 10px; color: var(--sb-ink-3); }
.pop-who { display: flex; align-items: center; gap: 11px; padding: 8px 10px 10px; }
.pop-who strong { display: block; font-size: 14px; font-weight: 650; color: var(--sb-ink); }
.pop-who small { display: block; font-size: 12px; color: var(--sb-ink-3); }
.pop-sep { height: 1px; margin: 6px 4px; background: var(--sb-line); }
.pop-palette { left: 0; right: auto; width: min(480px, calc(100vw - 16px)); max-height: min(70vh, 540px); overflow-y: auto; }
.pal-opt { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--sb-ink-2); }
.pal-opt > .ic:first-child { flex: none; color: var(--sb-ink-3); }
.pal-opt.active { background: var(--sb-here-bg); color: var(--sb-here); }
.pal-opt.active > .ic:first-child { color: var(--sb-mark); }
.pal-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.pal-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.pal-text small { flex: none; font-size: 12px; color: var(--sb-ink-3); }
.pal-enter { font-size: 12px; color: var(--sb-ink-3); }
@media (prefers-reduced-motion: reduce) {
  .side, .scrim, .grp-head .ic { transition: none !important; }
  .suitebar[data-loading]::after { animation: none; width: 100%; opacity: .5; }
}
.head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-size: 20px; font-weight: 640; margin: 0; letter-spacing: -.015em; }
h2 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); margin: 30px 0 12px; }
.lede { color: var(--ink-2); font-size: 13.5px; margin: -6px 0 16px; max-width: 76ch; }
.banner { padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: color-mix(in srgb, var(--warning) 45%, var(--ink)); }

/* ---- cards, tiles, chips ------------------------------------------------------------------ */
.card { background: var(--card); border-radius: 12px; box-shadow: var(--lift);
  outline: 1px solid var(--hairline); outline-offset: -1px; }
.pad { padding: 16px; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { padding: 14px 16px; }
.tile .label { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; }
.tile .value { font-size: 24px; font-weight: 620; letter-spacing: -.025em; margin: 6px 0 2px; }
.tile .note { font-size: 12px; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500;
  padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--chip) var(--tint), transparent);
  color: color-mix(in srgb, var(--chip) 65%, var(--ink)); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--chip); }
.pill.good { --chip: var(--good); } .pill.warning { --chip: var(--warning); }
.pill.serious { --chip: var(--serious); } .pill.critical { --chip: var(--critical); }
.pill.idle { --chip: var(--idle); background: var(--sunken); color: var(--ink-3); }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.grid2 > * { min-width: 0; }

/* ---- tables ----------------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
td { padding: 10px 14px; border-bottom: 1px solid var(--hairline-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--accent-wash); }
.sub { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
pre.report { white-space: pre-wrap; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0; padding: 16px; color: var(--ink-2); }

/* ---- the boards ---------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px;
  overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--sunken); border-radius: 12px; padding: 10px; min-height: 160px; }
.col h3 { font-size: 12px; font-weight: 600; margin: 2px 4px 10px; display: flex;
  justify-content: space-between; color: var(--ink-2); }
.kcard { background: var(--card); border-radius: 9px; padding: 10px 11px; margin-bottom: 8px;
  box-shadow: var(--lift); outline: 1px solid var(--hairline); outline-offset: -1px; cursor: pointer; }
.kcard:hover { outline-color: var(--accent); }
.kcard strong { display: block; font-size: 13px; font-weight: 600; }
.kcard .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kcard .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.kcard .next { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }

/* ---- forms ----------------------------------------------------------------------------------- */
label { display: block; font-size: 12px; color: var(--ink-2); margin: 11px 0 5px; font-weight: 500; }
input, select, textarea { width: 100%; padding: 8px 11px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--sunken); border: 1px solid var(--hairline);
  border-radius: 8px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash); background: var(--card); }
input[type=checkbox] { width: auto; }
button { padding: 8px 15px; font: 500 13px/1.4 inherit; border: 1px solid transparent;
  border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button:hover { background: var(--accent-ink); }
button.ghost { background: transparent; color: var(--accent-ink); border-color: var(--hairline); }
button.ghost:hover { background: var(--accent-wash); }
button.danger { background: transparent; color: var(--critical);
  border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
button.small { padding: 4px 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.form { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 15px;
  border-radius: 10px; background: var(--ink); color: var(--plane); font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 80; }
.toast.bad { background: var(--critical); color: #fff; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin: 0 0 18px; }
.tabs button { background: transparent; color: var(--ink-2); border: 0; border-radius: 8px 8px 0 0;
  padding: 9px 13px; position: relative; }
.tabs button:hover { background: var(--hairline-soft); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px;
  bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }

/* ---- the sign-in and the patient form ------------------------------------------------------- */
.signin { min-height: calc(100vh - var(--sb-h, 0px)); display: flex; align-items: center; justify-content: center; padding: 20px; }
.signin .box { width: 100%; max-width: 380px; padding: 28px; }
.signin h1 { margin-bottom: 4px; }
.secret { font: 15px ui-monospace, Menlo, monospace; letter-spacing: .08em; background: var(--sunken);
  padding: 10px 12px; border-radius: 8px; word-break: break-all; margin: 8px 0; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--plane);
  box-shadow: -10px 0 30px rgba(0,0,0,.12); overflow-y: auto; padding: 24px; z-index: 65; }
.scroll { overflow-x: auto; }
td.nowrap { white-space: nowrap; }

/* ---- phones: every table row is a card ------------------------------------------------------
   Title on top, short fields in two columns (label above value), long text across the card,
   the row's buttons as a full-width grid of thumb-sized targets. */
@media (max-width: 600px) {
  .scroll table, .scroll tbody { display: block; width: 100%; }
  .scroll tr:first-child { display: none; }                       /* the header row */
  .scroll tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px;
    border-bottom: 1px solid var(--hairline-soft); }
  .scroll tr:last-child { border-bottom: 0; }
  .scroll td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; }
  .scroll td.n { text-align: left; }
  .scroll td::before { content: attr(data-label); display: block; color: var(--ink-3); font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
  .scroll td.t-title, .scroll td.t-wide, .scroll td.t-actions { grid-column: 1 / -1; }
  .scroll td.t-title::before, .scroll td.t-actions::before { content: none; }
  .scroll td.t-title { font-weight: 600; font-size: 15.5px; color: var(--ink); }
  .scroll td.t-title .sub { font-weight: 400; font-size: 13px; margin-top: 1px; }
  .scroll td.t-actions:empty { display: none; }
  .scroll td.t-actions > .actions, .scroll td.t-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 !important; }
  .scroll td.t-actions > .actions { grid-column: 1 / -1; }
  .scroll td.t-actions button { min-height: 44px; width: 100%; }
  .scroll td.t-actions button:only-child { grid-column: 1 / -1; }
  .scroll td.t-actions input[type=checkbox] { width: 22px; height: 22px; }
  .scroll td .pill { justify-self: start; }
}

/* ---- schedule: a table on wide screens, a card per appointment on phones ------------------ */
.day-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.day-nav input { width: auto; }
.appt-cards { display: none; }
@media (max-width: 600px) {
  .appt-table { display: none; }
  .appt-cards { display: grid; gap: 10px; margin-bottom: 18px; }
  .head:has(.day-nav) { flex-wrap: wrap; }
  .day-nav { margin-left: 0; width: 100%; }
  .day-nav input { flex: 1; }
  .appt { background: var(--card); border-radius: 12px; box-shadow: var(--lift); padding: 14px; }
  .appt-past { opacity: .6; }
  .appt-top { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start; }
  .appt-time { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .appt-name { font-weight: 600; font-size: 15.5px; color: var(--ink); text-decoration: none; }
  .appt-who .sub { margin-top: 2px; }
  .appt-pills { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
  .appt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .appt-actions button:only-child { grid-column: span 2; }
  .appt-actions button { min-height: 44px; width: 100%; }
}

/* ---- provider workspace on a phone: the same cards as the schedule ------------------------ */
@media (max-width: 600px) {
  .desk-board { display: none; }
  .appt-group { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-3); margin: 8px 2px 0; }
  .appt > .appt-who + .appt-pills { margin-top: 8px; }
}

/* ---- the three boards on a phone: one stage at a time ------------------------------------- */
.board-phone { display: none; }
@media (max-width: 600px) {
  .board-phone { display: grid; gap: 10px; }
  .chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px;
    padding-right: 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
    border-radius: 999px; background: var(--card); color: var(--ink-2); border: 1px solid var(--hairline);
    font-size: 13px; font-weight: 500; }
  .chip span { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; }
  .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
  .chip.on span { color: inherit; opacity: .85; }
  .chip.late:not(.on) { color: var(--critical); border-color: currentColor; }
  .board-phone .next { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
  .board-move select { min-height: 44px; width: 100%; }
}

/* ---- phones: tabs scroll sideways; a lone row checkbox sits beside the card's title -------- */
@media (max-width: 600px) {
  .tabs { overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; }
  .scroll tr:has(> td.t-actions:first-child > input[type=checkbox]:only-child) > td.t-title { grid-column: 1; grid-row: 1; }
  .scroll td.t-actions:first-child:has(> input[type=checkbox]:only-child) { display: block; grid-column: 2; grid-row: 1;
    justify-self: end; }
}


/* ---- appraisal evidence: label / value pairs -------------------------------------------------- */
.evidence { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.evidence dt { color: var(--ink-3); }
.evidence dd { margin: 0; }
.appraisal summary { cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.appraisal h3 { font-size: 13px; margin: 12px 0 6px; }

/* ---- phones: a title column inside the card; a two-cell row reads as one line ---------------- */
@media (max-width: 600px) {
  .scroll td.t-title { order: -1; }                                   /* the title leads, whatever its column */
  .scroll tr:has(> td:nth-child(2):last-child):not(:has(> td.t-actions)) { grid-template-columns: 1fr auto; align-items: baseline; }
  .scroll tr:has(> td:nth-child(2):last-child):not(:has(> td.t-actions)) > td { grid-column: auto; }
  .scroll tr:has(> td:nth-child(2):last-child):not(:has(> td.t-actions)) > td:not(.t-title)::before { content: none; }
  .scroll tr:has(> td:nth-child(2):last-child):not(:has(> td.t-actions)) > td:not(.t-title) { text-align: right; }
  .scroll tr:has(> td:only-child) > td.t-title { font-size: 15px; }
}
