/* Bambam design system: CareMed Rides colors, glass surfaces, rounded corners.
   Light and dark are each tuned (text 4.5:1, edges 3:1). Works from 320px phones to wide screens.
   Rules: containers keep spacing and rounded corners; color goes where it means something; a
   feature that's switched off leaves no gap or empty card (templates render nothing for it). */

/* `hidden` always wins: classes like .alert set display, which would otherwise show an empty
   box that JavaScript fills only on error (the login page showed a blank red alert, 2026-12-05). */
[hidden] { display: none !important; }

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-var.woff2") format("woff2");   /* served by us: no Google Fonts call */
}

:root {
  color-scheme: light dark;
  --navy: #0A4D68; --teal: #2A9D8F; --teal-dark: #1A7A6E; --go: #0B6652; --mint: #E3F1EF;
  --bg: #F2F7F8; --bg-2: #E8F2F4;
  --surface: rgba(255, 255, 255, .78); --surface-solid: #fff; --surface-2: rgba(255, 255, 255, .55);
  --text: #0d2433; --mid: #3d6e7e; --faint: #557580;
  --border: #c8e2e8; --divider: #dcecef; --field-border: #6B8C96;   /* fields need 3:1 (WCAG 1.4.11) */
  --red: #b42318; --red-bg: #FDECEA; --amber: #a15500; --amber-bg: #FDF1E1; --ok-bg: #E3F1EF;
  --isa: #0057B8; --isa-text: #0057B8;   /* wheelchair blue; text version is lighter in dark mode */
  --primary: var(--navy); --on-primary: #fff;
  --focus: #2A9D8F;
  --shadow: 0 1px 2px rgba(13, 36, 51, .06), 0 8px 24px rgba(13, 36, 51, .08);
  --shadow-lg: 0 20px 50px rgba(13, 36, 51, .18);
  --r-sm: 10px; --r: 16px; --r-lg: 20px; --r-pill: 999px;
  --blur: saturate(1.6) blur(14px);
  --s-assigned: #2F6FB0; --s-arrived: #0E7C86; --s-onboard: var(--go); --s-done: var(--faint);
  --s-bad: var(--red); --s-open: var(--amber);
  /* Carry, as in the CareMed apps (AskCarriePill.js): teal → green → aqua ring, teal-to-aqua star, gold glint. */
  --carry-ring: linear-gradient(90deg, #0B6E8A, #0E8A8C, #11A08A, #18B07F, #28C08A, #3FCDA2, #57D8BE, #6FDFD6);
  --carry-star-a: #0E8A8C; --carry-star-b: #3FCDA2; --carry-glint: #F2B632;
  --carry-me: #DDF1EA; --carry-them: #F2F7F8; --carry-glow: 0 3px 12px rgba(18, 128, 103, .22);
}
/* Dark: when the device is dark and the person chose Auto, or when they chose Dark (Display settings).
   The same tokens twice; keep the two lists identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #4FB3D9; --teal: #4CC2B2; --teal-dark: #3BA597; --go: #4CC38A; --mint: #163642;
    --bg: #091E24; --bg-2: #0C252D;
    --surface: rgba(15, 46, 56, .78); --surface-solid: #0F2E38; --surface-2: rgba(22, 54, 66, .6);
    --text: #DFF1F5; --mid: #89BCC7; --faint: #7FA8B2;
    --border: #1E4A58; --divider: #183F4B; --field-border: #5D8D9A;
    --red: #FF8A80; --red-bg: rgba(180, 35, 24, .18); --amber: #F5B45C; --amber-bg: rgba(161, 85, 0, .2);
    --ok-bg: rgba(18, 128, 103, .2);
    --primary: #2A9D8F; --on-primary: #04201C; --focus: #4CC2B2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    --s-assigned: #7DB4EC; --s-arrived: #5BC6CF; --isa-text: #8EC1FF;
    --carry-ring: linear-gradient(90deg, #3A9CBE, #3FAAC0, #45B6B6, #4CC2A8, #57CDA6, #66D7B4, #78E0C8, #8CE7DD);
    --carry-star-a: #45B6B6; --carry-star-b: #8CE7DD; --carry-glint: #F5C75A;
    --carry-me: #173B35; --carry-them: #0E1A21; --carry-glow: none;
  }
}
:root[data-theme="dark"] {
  --navy: #4FB3D9; --teal: #4CC2B2; --teal-dark: #3BA597; --go: #4CC38A; --mint: #163642;
  --bg: #091E24; --bg-2: #0C252D;
  --surface: rgba(15, 46, 56, .78); --surface-solid: #0F2E38; --surface-2: rgba(22, 54, 66, .6);
  --text: #DFF1F5; --mid: #89BCC7; --faint: #7FA8B2;
  --border: #1E4A58; --divider: #183F4B; --field-border: #5D8D9A;
  --red: #FF8A80; --red-bg: rgba(180, 35, 24, .18); --amber: #F5B45C; --amber-bg: rgba(161, 85, 0, .2);
  --ok-bg: rgba(18, 128, 103, .2);
  --primary: #2A9D8F; --on-primary: #04201C; --focus: #4CC2B2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --s-assigned: #7DB4EC; --s-arrived: #5BC6CF; --isa-text: #8EC1FF;
  --carry-ring: linear-gradient(90deg, #3A9CBE, #3FAAC0, #45B6B6, #4CC2A8, #57CDA6, #66D7B4, #78E0C8, #8CE7DD);
  --carry-star-a: #45B6B6; --carry-star-b: #8CE7DD; --carry-glint: #F5C75A;
  --carry-me: #173B35; --carry-them: #0E1A21; --carry-glow: none;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--teal) 16%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--navy) 14%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--navy); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface-solid); padding: 10px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
.demo-banner { margin: 0; padding: 6px 12px; text-align: center; color: #3c2308; background: #ffdda6; font-weight: 650; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ── App shell: how each piece looks. WHERE the menu sits (side, bar, ☰ drawer or tab bar) for
   computers, tablets and phones comes from /menu.css (app/layout.py), chosen per person. ───── */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 18px 14px; background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
         font-weight: 800; font-size: 20px; letter-spacing: -.01em; padding: 4px 8px 14px; }
.brand img { width: 34px; height: 34px; }
.org-chip { display: block; margin: 0 6px 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2);
            border: 1px solid var(--border); font-size: 13px; color: var(--mid); text-decoration: none; }
.org-chip b { display: block; color: var(--text); font-size: 14px; }
.nav-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px;
              background: none; border: 0; border-radius: var(--r-sm); cursor: pointer; text-align: left; box-shadow: none; }
.nav-toggle:hover { background: var(--surface-2); color: var(--mid); }
.nav-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round;
                  stroke-linejoin: round; transition: transform .15s; }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }   /* › folded, pointing down when open */
@media (prefers-reduced-motion: reduce) { .nav-toggle svg { transition: none; } }
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-radius: var(--r-sm);
         color: var(--text); text-decoration: none; font-weight: 550; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--navy); font-weight: 700; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--teal); color: var(--on-primary);
             font-size: 12px; font-weight: 750; text-align: center; }
.nav svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: 18px; border-top: 1px solid var(--divider); padding-top: 12px; }
.side-foot .signout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; min-height: 44px;
                      border: 0; border-radius: var(--r-sm); background: none; box-shadow: none; color: var(--text);
                      font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.side-foot .signout:hover { background: var(--surface-2); }
.side-head { display: flex; align-items: center; gap: 6px; padding-bottom: 14px; }
.side-head .brand { flex: 1; min-width: 0; padding-bottom: 0; }
.collapse-btn { flex: none; display: none; }
.collapse-btn .when-collapsed, body.nav-collapsed .collapse-btn .when-open { display: none; }
body.nav-collapsed .collapse-btn .when-collapsed { display: contents; }
.topbar { display: none; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 14px;
          background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-bottom: 1px solid var(--border); }
.topbar .brand { padding: 0; font-size: 18px; }
.topbar .spacer { flex: 1; }
.content { min-width: 0; padding: 24px clamp(14px, 3vw, 36px) 48px; }
.content.center { display: grid; place-items: start center; padding-top: 8vh; }
.scrim { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(9, 30, 36, .45); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--border);
            background: var(--surface-2); color: var(--text); cursor: pointer; padding: 0; min-height: 0; box-shadow: none; }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ── Surfaces ───────────────────────────────────────────────────────────── */
.card, .glass {
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(16px, 2.4vw, 24px);
  margin-bottom: 16px;
}
.page { max-width: 1180px; margin: 0 auto; }
.page.full { max-width: none; }
.page.narrow { max-width: 720px; } .page.slim { max-width: 460px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1 { margin: 0; } .page-head > div:first-child { min-width: 0; }
.back { display: inline-block; margin-bottom: 10px; font-weight: 600; text-decoration: none; }
h1 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 12px; font-weight: 800; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--mid); } .faint { color: var(--faint); } .small { font-size: 13px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-bottom: 16px; }
.cards .card { margin: 0; }
.stat .n { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; } .stat .l { color: var(--mid); font-size: 14px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--field-border); border-radius: 12px; font: inherit;
  background: var(--surface-solid); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent); }
/* Checkboxes and radio buttons drawn the same in every browser and mode: an outline when off (3:1),
   teal when on, a clear focus ring. */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; flex: none;
  border: 2px solid var(--field-border); border-radius: 6px; background: var(--surface-solid) center / 14px 14px no-repeat;
  cursor: pointer; transition: background-color .12s, border-color .12s; box-shadow: none; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked { background-color: var(--teal); border-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
input[type=radio]:checked { border-color: var(--teal); background-image: radial-gradient(circle, var(--teal) 0 5px, transparent 5.5px); background-size: auto; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 550; margin: 10px 0; flex-wrap: wrap; }
label.check input[type=time], label.check input[type=datetime-local] { width: auto; min-height: 40px; }
fieldset { border: 1px solid var(--border); border-radius: var(--r); margin: 16px 0; padding: 6px 16px 12px; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 16px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; } .row > div { flex: 1; min-width: min(100%, 180px); }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.days { display: flex; gap: 4px 16px; flex-wrap: wrap; } .indent { padding-left: 30px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 12px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 4px 14px color-mix(in srgb, var(--primary) 30%, transparent);
  transition: transform .06s, filter .15s;
}
button:hover, .button:hover { filter: brightness(1.06); } button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--surface-solid); color: var(--text); border-color: var(--border); box-shadow: none; }
button.danger, .button.danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); box-shadow: none; }
button.link { background: none; border: 0; color: var(--navy); padding: 0; min-height: 0; box-shadow: none; font-weight: 600; }
button.full, .button.full { width: 100%; }
button.small, .button.small { min-height: 36px; padding: 4px 12px; font-size: 13px; }
.big-button { min-height: 58px; font-size: 18px; margin-top: 10px; width: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=date] { width: auto; }
.row-links { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Messages, pills, status ────────────────────────────────────────────── */
.alert { display: block; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--border); border-left-width: 4px; font-weight: 600; }
.alert.error { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.alert.ok { border-color: var(--go); color: var(--go); background: var(--ok-bg); }
.alert.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.alert code.link { display: block; margin-top: 8px; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 650;
        border: 1px solid var(--border); color: var(--mid); white-space: nowrap; }
.pill.on { border-color: var(--go); color: var(--go); background: var(--ok-bg); }
.pill.paid { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.pill.wc { background: var(--isa); border-color: var(--isa); color: #fff; }   /* the only filled tag (CareMed rule) */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 650;
          color: var(--c, var(--mid)); border: 1px solid color-mix(in srgb, var(--c, var(--border)) 45%, transparent);
          background: color-mix(in srgb, var(--c, transparent) 10%, transparent); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.s-requested { --c: var(--navy); } .s-unassigned { --c: var(--s-open); } .s-assigned { --c: var(--s-assigned); } .s-arrived { --c: var(--s-arrived); }
.s-onboard { --c: var(--s-onboard); } .s-completed { --c: var(--s-done); } .s-canceled, .s-no_show { --c: var(--s-bad); }
.error-text { color: var(--red); font-weight: 650; } .ok-text { color: var(--go); font-weight: 650; }
code.link { word-break: break-all; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }

/* ── Tables: scroll sideways on small screens, never break the page ────── */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
th { color: var(--faint); font-weight: 650; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td form { display: inline; } td select { width: auto; min-height: 38px; padding: 4px 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.off td { color: var(--faint); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 12px 0 0; }
dl.facts dt { color: var(--faint); font-weight: 650; } dl.facts dd { margin: 0; }
@media (max-width: 640px) { .hide-sm { display: none; } dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: 8px; } }

/* ── Dispatch board ─────────────────────────────────────────────────────── */
.board { display: flex; gap: 16px; align-items: flex-start; }
.pool { width: 300px; flex: none; max-height: calc(100vh - 170px); overflow: auto; }
.ticket { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-solid);
          box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.ticket[draggable=true] { cursor: grab; }
.ticket .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.grid-scroll { flex: 1; min-width: 0; overflow: auto; max-height: calc(100vh - 170px); padding: 0; }
.timeline { display: flex; min-width: max-content; }
.hours { width: 60px; flex: none; position: sticky; left: 0; z-index: 3; background: var(--surface-solid); border-right: 1px solid var(--divider); }
.hour { height: 60px; font-size: 12px; color: var(--faint); text-align: right; padding: 2px 8px 0 0; font-variant-numeric: tabular-nums; }
.col-head { height: 58px; padding: 8px 10px; border-bottom: 1px solid var(--divider); position: sticky; top: 0; z-index: 2; background: var(--surface-solid); }
.lane { width: 180px; flex: none; border-right: 1px solid var(--divider); }
.lane-body { position: relative; background: repeating-linear-gradient(transparent 0 59px, var(--divider) 59px 60px); }
.block { position: absolute; left: 5px; right: 5px; border-radius: 10px; padding: 3px 8px; font-size: 12px; overflow: hidden;
         background: color-mix(in srgb, var(--c, var(--teal)) 14%, var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--c, var(--teal)) 45%, transparent);
         border-left: 4px solid var(--c, var(--teal)); }
.block[draggable=true] { cursor: grab; } .block a { color: inherit; text-decoration: none; font-weight: 600; }
.drop.over { outline: 3px dashed var(--teal); outline-offset: -3px; border-radius: 12px; }
dialog { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; width: min(92vw, 420px); background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(9, 30, 36, .5); backdrop-filter: blur(3px); }
dialog .choices { display: grid; gap: 8px; max-height: 50vh; overflow: auto; margin: 12px 0; }
dialog .choices button { justify-content: flex-start; }
@media (max-width: 900px) { .board { flex-direction: column; } .pool { width: 100%; max-height: none; } .grid-scroll { width: 100%; } }

/* ── Driver page ───────────────────────────────────────────────────────── */
.driver .big { font-size: 22px; font-variant-numeric: tabular-nums; }
.trip-card.done { opacity: .6; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav-links .button { min-height: 40px; padding: 6px 12px; }
canvas.sigpad { display: block; width: 100%; height: 160px; border: 2px dashed var(--border); border-radius: 14px; background: #fff; touch-action: none; margin-top: 6px; }
.signbox { border-top: 1px solid var(--divider); margin-top: 12px; padding-top: 6px; }
.sig img { display: block; max-width: 340px; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 12px; }   /* documents stay black on white */

/* ── Messages ──────────────────────────────────────────────────────────── */
.split { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
.people-list { display: flex; flex-direction: column; gap: 4px; padding: 10px; }
.person { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px;
          border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 600; }
.person:hover { background: var(--surface-2); } .person.active { background: var(--mint); color: var(--navy); }
.thread { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow: auto; }
.bubble { max-width: min(85%, 520px); padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-solid);
          border: 1px solid var(--border); overflow-wrap: anywhere; }
.bubble .body { white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--mint); border-color: color-mix(in srgb, var(--teal) 35%, transparent); }
.bubble .small { margin-top: 4px; }
form.send { display: flex; gap: 10px; align-items: flex-end; } form.send textarea { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) { .split { grid-template-columns: minmax(0, 1fr); } .people-list { flex-direction: row; overflow-x: auto; } .person { flex: none; } }

ol.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pool h3 { font-size: 14px; margin: 4px 0 8px; }

/* ── Admin-entered values: numbers and reorderable lists ─────────────── */
.value-row { display: grid; gap: 4px; margin: 12px 0; }
.value-row input { width: 7.5em; }
ol.sortable { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.sort-row { display: flex; align-items: center; gap: 6px; }
.sort-row input { flex: 1; min-width: 0; }
.sort-row .grip { width: 18px; color: var(--faint); cursor: grab; text-align: center; flex: none; }
.sort-row .icon-btn { width: 44px; height: 44px; flex: none; font-size: 16px; }
@media (max-width: 639.98px) { .sort-row .grip { display: none; } }   /* phones reorder with the arrows */

.stat .n.none { font-size: 18px; color: var(--faint) !important; font-weight: 600; }

/* ── Display settings: a segmented Auto / Light / Dark control ─────────── */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2);
             border: 1px solid var(--border); }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 10px;
                  font-weight: 650; color: var(--mid); cursor: pointer; }
.segmented input:checked + span { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Language buttons under the sign-in pages: the chosen one is solid. */
.lang-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.lang-switch button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow);
                                           border-color: var(--text); }

/* ── Carry, the assistant ─────────────────────────────────────────────── */
/* The button, as in the CareMed apps: with text (pill: mark + "Ask Carry") and without (the mark in a
   circle, on phones and in the collapsed menu). A gradient ring; the star pops and the glint twinkles
   once when the page opens, and a soft light sweeps the ring once. Never with Reduce Motion. */
.carry-pill { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 4px 16px 4px 10px;
              border-radius: var(--r-pill); color: var(--text); font-weight: 800; font-size: 14px; flex: none; overflow: hidden;
              border: 2.5px solid transparent; box-shadow: var(--carry-glow);
              background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--carry-ring) border-box; }
.carry-pill:hover { box-shadow: var(--carry-glow), 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
.carry-pill .carry-star { flex: none; }
.carry-pill::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none;
                     background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
                     transform: translateX(-120%); }
.carry-pill.round, .topbar .carry-pill.compact { width: 48px; height: 48px; min-height: 48px; padding: 0; justify-content: center; }
.carry-star .carry-star-body, .carry-star .carry-glint { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .carry-pill .carry-star-body, .carry-head .carry-star-body { animation: carry-pop .9s .3s cubic-bezier(.2, .7, .3, 1) both; }
  .carry-pill .carry-glint, .carry-head .carry-glint { animation: carry-twinkle .9s .3s ease-out both; }
  .carry-pill::after { animation: carry-sweep 1.1s .5s ease-out both; }
}
@keyframes carry-pop { 0% { transform: scale(.8); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes carry-twinkle { 0%, 30% { transform: scale(1) rotate(0); } 65% { transform: scale(1.5) rotate(45deg); }
                           100% { transform: scale(1) rotate(0); } }
@keyframes carry-sweep { to { transform: translateX(120%); } }
.carry-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(100vw, 440px); display: flex;
               flex-direction: column; background: var(--surface-solid); border-left: 1px solid var(--border);
               box-shadow: var(--shadow-lg); }
.carry-panel[hidden] { display: none; }
/* The panel, as CareMed's Carry screen: big friendly bubbles with a tail corner, pill answer buttons with a
   green outline, rounded cards, "thinking" dots, a pill-shaped box to type in. */
.carry-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--divider); }
.carry-head h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--navy); }
.carry-head .carry-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
                           border-radius: 50%; border: 2.5px solid transparent; flex: none;
                           background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--carry-ring) border-box; }
.carry-note { margin: 10px 16px 0; }
.carry-log { list-style: none; margin: 0; padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.carry-msg { display: flex; flex-direction: column; gap: 8px; max-width: 88%; }
.carry-msg.me { align-self: flex-end; align-items: flex-end; max-width: 82%; }
.carry-bubble { padding: 12px 16px; border-radius: 20px 20px 20px 6px; background: var(--carry-them); border: 1px solid var(--divider);
                font-size: 17px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.carry-msg.me .carry-bubble { border-radius: 20px 20px 6px 20px; background: var(--carry-me); border-color: transparent; }
.carry-choices, .carry-links { display: flex; flex-wrap: wrap; gap: 8px; }
.carry-choices button { min-height: 48px; padding: 8px 18px; border-radius: var(--r-pill); border: 2px solid var(--go);
                        background: var(--surface-solid); color: var(--navy); font-weight: 800; font-size: 15px; box-shadow: none; }
.carry-choices button:hover { background: var(--ok-bg); }
.carry-links .button, .carry-links button { min-height: 44px; border-radius: var(--r-pill); }
.carry-card { border: 1.5px solid var(--divider); border-radius: 18px; padding: 14px; background: var(--surface-solid); font-size: 16px; }
.carry-card > b { display: block; font-size: 17px; }
.carry-card ul { margin: 8px 0; padding-left: 18px; line-height: 1.5; }
.carry-notice { margin: 8px 0; padding: 10px 12px; border-left: 4px solid var(--amber); background: var(--amber-bg); border-radius: 12px; }
.carry-dots { display: inline-flex; gap: 6px; padding: 16px 18px; border-radius: 20px 20px 20px 6px; background: var(--carry-them);
              border: 1px solid var(--divider); align-self: flex-start; }
.carry-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--mid); opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  .carry-dots span { animation: carry-dot 1.2s infinite ease-in-out; }
  .carry-dots span:nth-child(2) { animation-delay: .15s; } .carry-dots span:nth-child(3) { animation-delay: .3s; }
  .carry-msg { animation: carry-in .18s ease-out; }
}
@keyframes carry-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-3px); } }
@keyframes carry-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.carry-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px max(10px, env(safe-area-inset-bottom));
              border-top: 1px solid var(--divider); }
.carry-form textarea { flex: 1; min-width: 0; min-height: 52px; resize: none; border-radius: 26px; padding: 14px 18px; font-size: 16px; }
.carry-send { min-height: 52px; padding: 0 20px; border-radius: 26px; font-weight: 800; }
.carry-form .icon-btn { width: 52px; height: 52px; border-radius: 50%; }
/* Voice: the microphone and speaker show "on" clearly (not by colour alone: a ring and a dot). */
.carry-panel .icon-btn[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 0 0 2px var(--text); position: relative; }
.carry-panel .icon-btn[aria-pressed="true"]::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
                                                       border-radius: 50%; background: currentColor; }
.carry-voice-note { margin: 0 14px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.side-carry { width: calc(100% - 12px); margin: 0 6px 12px; justify-content: flex-start; min-height: 44px; text-align: left; }
.side-carry kbd { margin-left: auto; white-space: nowrap; flex: none; font: 600 11px/1 inherit; color: var(--faint); border: 1px solid var(--border);
                  border-radius: 6px; padding: 3px 6px; }
body.nav-collapsed .side-carry { width: 48px; height: 48px; min-height: 48px; margin: 0 auto 12px; padding: 0; justify-content: center; }   /* the button without the text */
@media (max-width: 639.98px) {
  .carry-panel { width: 100vw; border-left: 0; }
  .topbar .carry-pill-label { display: none; }
  .topbar .carry-pill { width: 48px; height: 48px; min-height: 48px; padding: 0; justify-content: center; }   /* without the text */
}

/* ── Drag and drop ──────────────────────────────────────────────────── */
.dnd-toggle { margin: 0 0 10px; }
.dnd-toggle[aria-pressed="true"] { background: var(--mint); color: var(--navy); border-color: var(--teal); }
[data-dnd]:not(.dnd-on) .grip { visibility: hidden; }
.dnd-on [data-drag-item] { cursor: grab; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--r); padding: 14px; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 8%, transparent); }
.dropzone .dz-hint { margin: 6px 0 0; }
.dropzone:not(.dnd-on) .dz-hint { display: none; }

/* Board: a driver's hours for the day, with drag handles at both ends; column arranging. */
.shift-band { position: absolute; left: 0; right: 0; pointer-events: none; border-top: 2px solid transparent; border-bottom: 2px solid transparent; }
.dnd-on .shift-band { border-color: color-mix(in srgb, var(--teal) 55%, transparent); }
.shift-handle { position: absolute; left: 50%; width: 44px; height: 14px; margin-left: -22px; border-radius: 7px; pointer-events: auto;
                background: var(--teal); opacity: 0; cursor: ns-resize; touch-action: none; }
.shift-handle.top { top: -8px; } .shift-handle.bottom { bottom: -8px; }
.dnd-on .shift-handle { opacity: .85; }
.board:not(.dnd-on) .shift-handle { pointer-events: none; }
.shift-band[data-label]::after { content: attr(data-label); position: absolute; top: 4px; right: 6px; font-size: 11px; font-weight: 700;
                                 color: var(--teal-dark); background: var(--surface-solid); padding: 1px 6px; border-radius: 6px; }
.timeline .col-head { min-height: 104px; }   /* dispatch.js gives every column the tallest one's height, so times line up */
.hours-edit { position: relative; }
.hours-edit[open] .hours-form { position: absolute; top: calc(100% + 4px); left: 0; z-index: 6; width: 220px; padding: 10px;
                                background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px;
                                box-shadow: var(--shadow-lg); }
.lane-title { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.lane-move { display: inline-flex; gap: 2px; } .lane-move .icon-btn { width: 44px; height: 36px; font-size: 12px; }
.arranging [data-lane-head] { cursor: grab; background: var(--mint); }
.hours-edit summary { cursor: pointer; list-style: none; margin-top: 2px; } .hours-edit summary::-webkit-details-marker { display: none; }
.link-like { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.hours-form { display: grid; grid-template-columns: auto 1fr; gap: 4px 6px; align-items: center; margin-top: 6px; }
.hours-form input { min-height: 36px; padding: 4px 6px; } .hours-form button { grid-column: 1 / -1; }

.accept-all { margin: 0 0 10px; }

/* Driver manifest (printable) */
.manifest-trip { border-top: 1px solid var(--divider); padding: 12px 0; break-inside: avoid; }
.manifest-trip h2 { font-size: 18px; margin: 0 0 6px; }
.sign-lines { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 10px; font-size: 14px; color: var(--mid); }

/* ── Late warning, shift hours, optimizer ──────────────────────────────── */
.block.late, .ticket.late { box-shadow: 0 0 0 2px var(--amber); }
.late-note { color: var(--amber); font-weight: 750; }
.off-hours { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--faint) 14%, transparent) 6px 12px); pointer-events: none; }
.here-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--go); margin-right: 4px; }

/* ── Feature switches ──────────────────────────────────────────────────── */
.feature-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.feature-head h2 { margin: 0 0 4px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; margin: 0; font-weight: 650; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 52px; height: 30px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
                        box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .track { background: var(--go); } .switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; } .switch input:disabled ~ * { cursor: not-allowed; }
.section-title { margin: 28px 0 12px; font-size: 13px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* ── Sign-in pages ─────────────────────────────────────────────────────── */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; text-align: center; }
.auth-brand img { width: 56px; height: 56px; }
.auth-brand b { font-size: 24px; letter-spacing: -.02em; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--divider); }

@media print {
  body { background: #fff; color: #000; } .sidebar, .topbar, .no-print, .scrim { display: none !important; }
  .shell { display: block; } .card { box-shadow: none; backdrop-filter: none; border: 0; padding: 0; } .content { padding: 0; }
}
