/* =========================================================================
   Clinic Follow-ups — design system (mockup → becomes v2 base CSS). See ADR-008.
   ========================================================================= */

:root {
  /* Brand-neutral app palette (not SkinLab brand colours — owner decision 2026-11-14, ADR-008).
     Contrast-checked: text #1E2A32 on bg 13.3 · muted #56636D on bg 5.6 · white on primary 6.2 ·
     white on header 13.4 · field border #8A949B on white 3.1 (non-text ≥ 3) · status pairs ≥ 5.7 */
  --primary: #0B6E5C;         /* main action on each screen (white text) */
  --primary-hover: #095A4B;
  --on-primary: #FFFFFF;
  --brand: #18323F;           /* header, headings, selected states, focus ring */
  --text: #1E2A32;            /* body text */
  --text-strong: #101A20;
  --muted: #56636D;           /* secondary text (AA) */
  --accent: #D4A72C;          /* decoration only (icons, dots) — never text */
  --marker: #F4D35E;          /* highlighter behind one key word per heading */

  /* Surfaces */
  --bg: #F6F4EF;              /* warm paper */
  --paper: #FFFFFF;
  --tint: #E3F1EC;            /* selected / tags (teal tint) */
  --surface-3: #F1EEE6;       /* notes, soft panels */
  --surface-4: #E8E4DA;       /* tracks, background wash */
  --line: #E2DED6;            /* decorative dividers */
  --line-strong: #C9C4BA;
  --field: #8A949B;           /* form borders */

  /* Status (functional, always paired with words/icons) */
  --late-fg: #B42318;  --late-bg: #FDECEA;
  --today-fg: #8A4B00; --today-bg: #FFF4E0;
  --done-fg: #1E6B3A;  --done-bg: #E9F5EC;
  --wa: #25D366;       --wa-fg: #0B5132;

  /* Type: Helvetica (owner choice 2026-11-15, ADR-015); Windows shows Arial */
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Shape & motion */
  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --shadow: 0 1px 2px rgba(16, 26, 32, .06), 0 6px 22px rgba(16, 26, 32, .07);
  --shadow-up: 0 2px 4px rgba(16, 26, 32, .08), 0 14px 34px rgba(16, 26, 32, .13);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --focus: 0 0 0 3px #FFFFFF, 0 0 0 5px var(--brand);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 420px at 90% -140px, #DCEDE6 0%, rgba(220, 237, 230, 0) 70%),
    radial-gradient(900px 380px at -10% -80px, var(--surface-4) 0%, rgba(232, 228, 218, 0) 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
[tabindex="-1"]:focus { outline: none; box-shadow: none; } /* headings focused on screen change (for screen readers) */
.sprite { display: none; }
.ic { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 30px; height: 30px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--paper); padding: 10px 14px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 14px rgba(16, 26, 32, .25);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 24px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand-app { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: .02em; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .35); white-space: nowrap; }

.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  color: #fff; text-decoration: none; font-weight: 500;
  padding: 9px 14px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center;
}
.nav a:hover { background: rgba(255, 255, 255, .12); }
.nav a[aria-current="page"] { background: #fff; color: var(--text-strong); }
.whoami {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 5px 6px 5px 14px;
}
.whoami-text { line-height: 1.2; font-size: 14px; }
.whoami-text b { display: block; font-size: 15px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
}
.icon-btn:hover { background: rgba(255, 255, 255, .3); }

/* Mobile bottom navigation */
.bottomnav { display: none; }

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; }
.screen { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.12; color: var(--brand); font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1, h2, h3, legend, .call-name, .kpi b, .stat b, .client-phone { font-family: var(--display); }
h1 em, h2 em, legend em { font-style: normal; color: inherit; padding: 0 .08em; border-radius: 4px;
  background: linear-gradient(transparent 58%, var(--marker) 58%, var(--marker) 92%, transparent 92%); }
h2 { font-size: 21px; color: var(--brand); margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 18px; margin: 0; color: var(--text-strong); font-weight: 600; }
p { margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 17px; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; align-items: start; }

/* ---------- Buttons ---------- */
.btn {
  --bg-btn: var(--brand); --fg-btn: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 2px solid transparent;
  background: var(--bg-btn); color: var(--fg-btn); font-weight: 600; font-size: 17px;
  cursor: pointer; text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s;
  position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn.primary { --bg-btn: var(--primary); --fg-btn: var(--on-primary); }
.btn.primary:hover { --bg-btn: var(--primary-hover); }
.btn.primary::after { /* slow brand glare */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transition: transform .9s var(--ease);
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.secondary { --bg-btn: var(--paper); --fg-btn: var(--text-strong); border-color: var(--field); }
.btn.secondary:hover { border-color: var(--brand); }
.btn.quiet { --bg-btn: transparent; --fg-btn: var(--brand); padding: 0 12px; min-height: 44px; }
.btn.quiet:hover { background: var(--surface-3); box-shadow: none; }
.btn.danger { --bg-btn: var(--late-fg); --fg-btn: #fff; }
.btn.wa { --bg-btn: var(--paper); --fg-btn: var(--wa-fg); border-color: var(--field); }
.btn.wa .ic { color: #1DA851; }
.btn.wa:hover { border-color: var(--wa-fg); }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn[disabled]::after { display: none; }
.btn .ic { width: 22px; height: 22px; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 22px;
}
.card.soft { background: var(--surface-3); box-shadow: none; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title .ic { color: var(--accent); }

/* ---------- Summary strip ---------- */
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  border-radius: var(--r); padding: 16px 18px; background: var(--paper); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
}
.stat b { font-size: 34px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 15px; line-height: 1.25; }
.stat.late { background: var(--late-bg); border-color: transparent; color: var(--late-fg); }
.stat.today { background: var(--today-bg); border-color: transparent; color: var(--today-fg); }
.stat.done { background: var(--done-bg); border-color: transparent; color: var(--done-fg); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.search { flex: 1 1 280px; position: relative; }
.search .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--field);
  padding: 0 16px 0 48px; background: var(--paper); font-size: 17px;
}
.search input:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }

/* ---------- Section headings in the call list ---------- */
.group { margin-bottom: 30px; }
.group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.group-head h2 { margin: 0; }
.group-head .count { font-size: 15px; color: var(--muted); }
.call-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }

/* ---------- Call card ---------- */
.call {
  display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 0 18px; align-items: stretch;
  background: var(--paper); border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden; transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.call:hover { box-shadow: var(--shadow-up); transform: translateY(-1px); }
.call .rail { background: var(--line-strong); }
.call.is-late .rail { background: var(--late-fg); }
.call.is-today .rail { background: #D99A1E; }
.call.is-done .rail { background: var(--done-fg); }
.call-body { padding: 16px 0; min-width: 0; }
.call-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.call-name { font-size: 19px; font-weight: 600; color: var(--text-strong); }
.call-why { color: var(--text); margin: 2px 0 6px; }
.call-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.call-meta span { display: inline-flex; gap: 6px; align-items: center; }
.call-actions { display: flex; gap: 10px; align-items: center; padding: 14px 18px 14px 0; }
.call.is-done .call-name { color: var(--text); }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.badge.late { background: var(--late-bg); color: var(--late-fg); }
.badge.today { background: var(--today-bg); color: var(--today-fg); }
.badge.done { background: var(--done-bg); color: var(--done-fg); }
.badge.soon { background: var(--surface-3); color: var(--text); }
.tag {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px; font-size: 14px; font-weight: 500;
  background: var(--tint); color: var(--text-strong);
}

/* ---------- Client screen ---------- */
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--brand); text-decoration: none; font-weight: 500; margin-bottom: 14px; padding: 8px 10px 8px 4px; }
.back:hover { text-decoration: underline; }
.client-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--tint); color: var(--brand); font-weight: 600; font-size: 20px; border: 1px solid var(--line-strong);
}
.client-phone { font-size: 22px; font-weight: 600; color: var(--text-strong); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.call-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0 0; }
.facts dt { color: var(--muted); font-size: 15px; }
.facts dd { margin: 0; color: var(--text-strong); }
.note-box { background: var(--surface-3); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 14px; border-left: 3px solid var(--accent); }
.note-box b { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 10px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.timeline .when { font-size: 14px; color: var(--muted); }
.timeline .what { color: var(--text-strong); font-weight: 500; }
.timeline .who { font-size: 14px; color: var(--muted); }

/* ---------- Outcome picker (big radio tiles) ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
legend { font-size: 21px; font-weight: 600; color: var(--brand); margin-bottom: 4px; padding: 0; }
.legend-hint { color: var(--muted); margin: 0 0 14px; }
.step-no {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; margin-right: 8px;
  background: var(--brand); color: #fff; font-size: 15px; vertical-align: 2px;
}
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile label {
  display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--paper); cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease); line-height: 1.25;
}
.tile label .ic { width: 28px; height: 28px; color: var(--brand); }
.tile label small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; margin-top: 2px; }
.tile label b { font-weight: 600; color: var(--text-strong); font-size: 17px; }
.tile input:hover + label { border-color: var(--brand); }
.tile input:focus-visible + label { box-shadow: var(--focus); }
.tile input:checked + label { border-color: var(--brand); background: var(--tint); box-shadow: inset 0 0 0 1.5px var(--brand); }
.tile input:checked + label::after {
  content: ""; margin-left: auto; width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.tile.warn label .ic { color: var(--late-fg); }

/* Chips (quick choices) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip label {
  display: inline-flex; flex-direction: column; justify-content: center; min-height: 52px; padding: 6px 18px;
  border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--paper); cursor: pointer; line-height: 1.2;
}
.chip label b { font-weight: 600; color: var(--text-strong); }
.chip label small { color: var(--muted); font-size: 14px; }
.chip input:hover + label { border-color: var(--brand); }
.chip input:focus-visible + label { box-shadow: var(--focus); }
.chip input:checked + label { background: var(--brand); border-color: var(--brand); }
.chip input:checked + label b, .chip input:checked + label small { color: #fff; }

.reveal { animation: rise .35s var(--ease) both; }
.check-row {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding: 14px 16px; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--paper);
}
.check-row:hover { border-color: var(--brand); }
.check-row input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.check-row b { display: block; color: var(--text-strong); }
.check-row small { display: block; color: var(--muted); font-size: 15px; }
.check-row:has(input:checked) { border-color: var(--brand); background: var(--tint); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .field .label { font-weight: 600; color: var(--text-strong); }
.field .hint { color: var(--muted); font-size: 15px; }
.field input, .field select, .field textarea {
  min-height: 52px; border-radius: 12px; border: 1.5px solid var(--field); padding: 10px 14px; background: var(--paper); font-size: 17px; width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.field.has-error input, .field.has-error select { border-color: var(--late-fg); }
.error-text { color: var(--late-fg); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.phone-wrap { display: flex; }
.phone-wrap span { display: grid; place-items: center; padding: 0 14px; border: 1.5px solid var(--field); border-right: 0; border-radius: 12px 0 0 12px; background: var(--tint); font-weight: 600; }
.phone-wrap input { border-radius: 0 12px 12px 0; }

.save-bar {
  position: static; z-index: 5; margin-top: 8px;
  background: rgba(255, 252, 251, .92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-up);
}
.save-hint { margin: 8px 2px 0; color: var(--muted); font-size: 15px; display: flex; gap: 6px; align-items: center; }
.save-hint.ok { color: var(--done-fg); }
.attempts { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 15px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots i.on { background: var(--brand); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--today-bg); color: var(--today-fg); margin-top: 12px; }
.callout.info { background: var(--surface-3); color: var(--text-strong); }
.callout.error { background: var(--late-bg); color: var(--late-fg); }
/* Signature field: who did the work (picked every time) */
.field.signer { background: var(--tint); border-radius: 14px; padding: 14px 16px; border: 1.5px dashed var(--brand); }
.field.signer label { display: inline-flex; gap: 8px; align-items: center; font-size: 18px; }
.field.signer.has-error { border-color: var(--late-fg); background: var(--late-bg); }
.sync { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--done-bg); color: var(--done-fg); font-size: 15px; font-weight: 600; }
.src { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.table td:first-child { white-space: nowrap; }

/* ---------- Sign-in ---------- */
.center-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 24px 0; }
.signin { width: min(440px, 100%); }
.signin .logo-panel { background: var(--brand); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 26px 26px 22px; }
.signin .logo-panel img { height: 46px; width: auto; }
.signin .logo-panel p { color: #fff; margin: 12px 0 0; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; }
.signin .card { border-radius: 0 0 var(--r-lg) var(--r-lg); }
/* ---------- Manager ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi small { display: block; color: var(--muted); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.kpi b { display: block; font-size: 34px; font-weight: 600; color: var(--text-strong); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 14px; color: var(--muted); }
.kpi.late b { color: var(--late-fg); }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1.5px solid var(--line-strong); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.table td.warn-text { color: var(--late-fg); }
.spaced-sm { margin-top: 10px; }
p.hint { color: var(--muted); font-size: 15px; margin: 4px 0 12px; }
.section-title { font-size: 20px; margin: 8px 0 12px; }
.alerts-banner { margin-bottom: 16px; }
.alerts-banner .ios-help { margin: 8px 0 0; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.side-btn.is-on .ic { color: var(--done-fg); }
.toast.bad { background: var(--late-fg); }
.mail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.mail-clinic { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 0; min-width: 0; display: grid; gap: 10px; }
.mail-clinic legend { font-weight: 700; color: var(--brand); padding: 0 6px; }
.mail-grid .field, .mail-clinic .field { margin: 0; min-width: 0; }
.mail-grid input { width: 100%; }
.period { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.period a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  color: var(--text); text-decoration: none; font-weight: 600; background: var(--paper); }
.period a:hover { border-color: var(--brand); }
.period a[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.period-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.period-pick .field { margin: 0; }
.report-for { margin: 6px 0 14px; color: var(--muted); }
.report-for b { color: var(--text-strong); }
.report h3 { font-size: 18px; margin-bottom: 8px; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-4); overflow: hidden; min-width: 120px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.attn { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.attn li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-3); }
.attn li .ic { color: var(--late-fg); }
.attn li a { margin-left: auto; color: var(--brand); font-weight: 600; white-space: nowrap; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 150px; margin-top: 8px; }
.week div { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 14px; color: var(--muted); }
.week .col { width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: var(--brand); }
.week .col.miss { background: var(--late-fg); }
.legend-row { display: flex; gap: 16px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 48px; height: 28px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--done-fg); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* ---------- Toast, dialog, empty ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--text-strong); color: #fff; border-radius: 14px; padding: 14px 20px; box-shadow: var(--shadow-up);
  display: flex; gap: 10px; align-items: center; font-weight: 500; max-width: calc(100vw - 32px);
  animation: rise .35s var(--ease) both;
}
.toast .ic { color: #8EE0A8; }
.confirm { border: 0; border-radius: var(--r-lg); padding: 26px; max-width: 440px; width: calc(100vw - 32px); box-shadow: var(--shadow-up); color: var(--text); }
.confirm::backdrop { background: rgba(16, 26, 32, .5); }
.confirm h2 { font-size: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.empty { text-align: center; padding: 34px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--muted); }
.empty b { display: block; font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--brand); margin-bottom: 4px; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 10px 0; list-style: none; display: inline-flex; gap: 8px; align-items: center; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸"; transition: transform .2s; }
details.more[open] summary::before { transform: rotate(90deg); }


/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav { display: none; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(16, 26, 32, .08);
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px;
    text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; min-height: 56px;
  }
  .bottomnav a .ic { width: 24px; height: 24px; }
  .bottomnav a[aria-current="page"] { color: var(--brand); }
  body { padding-bottom: 76px; }
  .toast { bottom: 128px; }
}
@media (max-width: 640px) {
  main { padding: 18px 16px 40px; }
  .topbar-in { padding: 8px 16px; gap: 10px; }
  .brand img { height: 28px; }
  .brand-app { display: none; }
  .whoami-text span { display: none; }
  .summary { gap: 8px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; }
  .stat b { font-size: 28px; }
  .stat span { font-size: 14px; }
  .call { grid-template-columns: 5px minmax(0, 1fr); }
  .call-actions { grid-column: 2; padding: 0 16px 16px 0; }
  .call-actions .btn { flex: 1; }
  .tiles { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .kpis { gap: 10px; }
  .table .hide-sm { display: none; }
  .toast { top: 72px; bottom: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  body { background: #fff; padding: 0; }
  .call { box-shadow: none; break-inside: avoid; }
}

/* ---------- App additions (v2) ---------- */
.narrow { width: min(560px, 100%); } .narrow-form { max-width: 780px; } .spaced { margin-top: 18px; }
.muted { color: var(--muted); font-size: 15px; } .lead.small { font-size: 15px; }
.tag.soft { background: var(--surface-3); color: var(--muted); } .sync.warn { background: var(--today-bg); color: var(--today-fg); }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mini-list li { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-3); }
.card-title h2 { margin: 0; } .pick { margin-top: 14px; }
.inline-rename { display: flex; gap: 8px; align-items: center; }
.inline-rename input { min-height: 44px; border: 1.5px solid var(--field); border-radius: 10px; padding: 6px 10px; width: 100%; font-size: 16px; }
.table td.actions { white-space: nowrap; } .table td.actions form { display: inline; }
.clinic-switch select { min-height: 40px; border-radius: 999px; border: 0; padding: 0 12px; font-weight: 600; }
.week progress { writing-mode: vertical-lr; direction: rtl; width: 34px; height: 110px; }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) {
  .table td:first-child { white-space: normal; }
  .inline-rename { flex-wrap: wrap; }
  .inline-rename input { flex: 1 1 100%; }
  .table td, .table th { padding: 10px 6px; }
  .card { padding: 18px; }
}

/* ---------- Left sidebar layout (owner request 2026-11-15, ADR-015) ---------- */
.shell { min-height: 100vh; }
body.has-sidebar .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  background: var(--brand); color: #fff; padding: 18px 14px; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 8px 12px; border-bottom: 1px solid rgba(255,255,255,.14); }
.side-brand img { height: 32px; width: auto; }
.side-brand span { font-weight: 700; font-size: 16px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 16px;
}
.side-nav a:hover { background: rgba(255,255,255,.10); }
.side-nav a[aria-current="page"] { background: #fff; color: var(--text-strong); }
.side-nav a .ic { width: 20px; height: 20px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); }
.side-clinic { display: grid; gap: 4px; padding: 0 6px; }
.side-clinic b { font-size: 16px; }
.side-label, .clinic-switch label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #C9D6DD; font-weight: 600; }
.clinic-switch { display: grid; gap: 6px; }
.clinic-switch select {
  width: 100%; min-height: 44px; border-radius: 10px; border: 0; padding: 0 12px;
  background: #fff; color: var(--text-strong); font-weight: 600; font-size: 15px;
}
.clinic-switch select option { color: var(--text-strong); background: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.avatar.small { width: 36px; height: 36px; font-size: 14px; }
.side-user-text { display: grid; line-height: 1.25; min-width: 0; }
.side-user-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { color: #C9D6DD; font-size: 13px; }
.side-actions { display: grid; gap: 4px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: #fff; font: inherit; font-size: 15px; text-decoration: none; cursor: pointer; text-align: left;
}
.side-btn:hover { background: rgba(255,255,255,.10); }
.side-btn .ic { width: 18px; height: 18px; }
body.has-sidebar main { margin: 0; max-width: 1180px; padding: 28px 32px 48px; }
@media (max-width: 980px) {
  body.has-sidebar .shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px 14px; gap: 10px; overflow: visible; }
  .side-brand { border: 0; padding: 0; }
  .side-nav, .side-user, .side-label, .clinic-switch label { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; border: 0; padding: 0; gap: 6px; }
  .side-clinic { padding: 0; }
  .clinic-switch select { min-height: 40px; max-width: 150px; }
  .side-actions { display: flex; }
  .side-btn { width: auto; padding: 0 10px; }
  .side-btn span { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.has-sidebar main { padding: 18px 16px 40px; }
}
@media print { .sidebar { display: none !important; } body.has-sidebar .shell { display: block; } }
@media (max-width: 640px) { .side-brand span { display: none; } }
