/* =====================================================================
   Daktari design system — one stylesheet, no build step.
   Mobile-first. Breakpoints: 640px, 768px, 1024px.
   Sections: 1 Tokens · 2 Base · 3 Type · 4 Layout · 5 Components
             6 Patient pieces · 7 Clinician & admin pieces · 8 Utilities
   ===================================================================== */

/* 1. TOKENS ----------------------------------------------------------- */
:root {
  --primary: #0A6E78;  --primary-dark: #06505A;  --primary-soft: #E3F2F3;  --primary-tint: #F2FAFA;
  --ink: #0B1D26;      --ink-2: #36454E;         --muted: #4A5D68;         --faint: #7B8B94;
  --line: #DCE5EA;     --line-soft: #EEF3F5;     --line-strong: #9FB3BD;
  --ground: #F3F7F9;   --surface: #FFFFFF;       --night: #0A1419;         --night-2: #14262E;

  --alert: #B4380C;    --alert-dark: #8A2A06;    --alert-ink: #7A2606;     --alert-soft: #FCEDE6; --alert-line: #F3C9B6;
  --success: #1F7A3A;  --success-ink: #14552A;   --success-soft: #E6F4EA;  --success-line: #B9DFC4;
  --info: #1E5AA8;     --info-soft: #E7EEF9;
  --warn-ink: #6B4500; --warn-soft: #FFF4D6;     --warn-line: #EBCF86;

  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --shadow-sm: 0 1px 2px rgba(11, 29, 38, .06);
  --shadow-md: 0 4px 16px rgba(11, 29, 38, .08);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease: 160ms ease;
  --header-h: 68px;
  --bottom-nav-h: 72px;

  /* default tone (overridden by .tone-*) */
  --tone-soft: var(--primary-soft);
  --tone-ink: var(--primary);
}

.tone-teal  { --tone-soft: #E3F2F3; --tone-ink: #0A6E78; }
.tone-blue  { --tone-soft: #E7EEF9; --tone-ink: #1E5AA8; }
.tone-amber { --tone-soft: #FFF4D6; --tone-ink: #7A4F00; }
.tone-rose  { --tone-soft: #FCEDE6; --tone-ink: #B4380C; }
.tone-green { --tone-soft: #E6F4EA; --tone-ink: #1F7A3A; }

/* 2. BASE ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
svg { flex: none; }
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
a { color: var(--primary); text-decoration: none; font-weight: 700; }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
table { border-collapse: collapse; width: 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-md); }
.skip-link:focus { top: 12px; color: #fff; }

/* 3. TYPOGRAPHY ------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.2; letter-spacing: -0.01em; }
h1, .h1 { font-size: 26px; font-weight: 800; }
h2, .h2 { font-size: 18px; font-weight: 800; }
h3, .h3 { font-size: 16px; font-weight: 800; }
h4, .h4 { font-size: 14px; font-weight: 800; }
p { margin: 0; }
.display { font-size: 34px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.lead { font-size: 16px; color: var(--muted); line-height: 1.55; }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-strong { font-weight: 800; color: var(--ink); }
.text-success { color: var(--success); font-weight: 700; }
.text-alert { color: var(--alert); font-weight: 700; }
.mono { font-family: var(--mono); font-weight: 500; letter-spacing: .02em; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 4. LAYOUT ----------------------------------------------------------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 20px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 20px; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-header__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-header .search { flex: 1 1 320px; max-width: 440px; }

.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.stack-sm { --gap: 8px; } .stack-lg { --gap: 20px; }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: var(--gap, 14px); grid-template-columns: minmax(0, 1fr); }
.grid-auto-140 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-auto-180 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-auto-260 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-auto-300 { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }

/* main + aside (doctor profile, checkout, home care) */
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split__main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.split__aside { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 1024px) { .split__aside--sticky { position: sticky; top: calc(var(--header-h) + 16px); } }

/* --- App header (patient web) --- */
.app-header { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.app-header__inner { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand__mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.brand__mark .icon { width: 20px; height: 20px; stroke-width: 2.6; }
.app-nav { display: none; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.app-nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-md);
  color: var(--muted); font-size: 14px; font-weight: 700; transition: background var(--ease), color var(--ease);
}
.app-nav a:hover { background: var(--ground); color: var(--ink); }
.app-nav a.is-active, .app-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.app-header__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-switch { font-size: 13px; font-weight: 800; color: var(--muted); padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }

/* --- Bottom nav (phones) --- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.bottom-nav a .icon { width: 22px; height: 22px; }
.bottom-nav a.is-active, .bottom-nav a[aria-current="page"] { color: var(--primary); }
body.has-bottom-nav { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }

@media (min-width: 768px) {
  .container { padding: 0 24px; }
  .page { padding-top: 28px; padding-bottom: 48px; gap: 22px; }
  .app-nav { display: flex; }
  .bottom-nav { display: none; }
  body.has-bottom-nav { padding-bottom: 0; }
  h1, .h1 { font-size: 30px; }
  .display { font-size: 44px; }
}

/* --- Shell with sidebar (clinician + admin) --- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 100%; min-width: 0; background: var(--ink); color: #fff; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.sidebar--light { background: var(--surface); color: var(--ink); border-right: 1px solid var(--line); }
.sidebar .brand { color: #fff; font-size: 18px; }
.sidebar--light .brand { color: var(--ink); }
.sidebar__nav { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.sidebar__nav::-webkit-scrollbar { display: none; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; white-space: nowrap;
  color: #C9D6DC; font-size: 14px; font-weight: 700;
}
.sidebar--light .sidebar__nav a { color: var(--muted); }
.sidebar__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar--light .sidebar__nav a:hover { background: var(--ground); color: var(--ink); }
.sidebar__nav a.is-active, .sidebar__nav a[aria-current="page"] { background: var(--primary); color: #fff; }
.sidebar--light .sidebar__nav a.is-active, .sidebar--light .sidebar__nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.sidebar__nav .count { margin-left: auto; font-size: 12px; font-weight: 800; color: #FFD9C9; }
.sidebar--light .sidebar__nav .count { color: var(--alert); }
.sidebar__foot { display: none; margin-top: auto; padding: 12px; border-radius: var(--r-md); background: #14303B; font-size: 12px; color: #9FB3BD; }
.sidebar--light .sidebar__foot { background: var(--ground); color: var(--muted); }
.shell__main { flex: 999 1 560px; min-width: 0; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1024px) {
  .sidebar { flex: 0 0 248px; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .sidebar__nav { flex-direction: column; overflow: visible; }
  .sidebar__foot { display: block; }
  .shell__main { padding: 28px clamp(20px, 3vw, 40px) 48px; gap: 22px; }
}

/* 5. COMPONENTS ------------------------------------------------------- */
/* Card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card--tight { padding: 14px; gap: 10px; border-radius: var(--r-lg); }
.card--flush { padding: 0; overflow: hidden; gap: 0; }
.card--muted { background: var(--ground); border-color: transparent; }
.card--tint { background: var(--primary-soft); border-color: transparent; color: var(--primary-dark); }
.card--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-soft); }
a.card { color: inherit; font-weight: inherit; transition: border-color var(--ease), box-shadow var(--ease); }
a.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); color: inherit; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 800; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:hover { background: var(--alert-dark); color: #fff; }
.btn-danger-soft { background: var(--alert-soft); color: var(--alert-dark); border-color: var(--alert-line); }
.btn-success { background: var(--success); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1B313C; color: #fff; }
.btn-light { background: #fff; color: var(--primary); }
.btn-light:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 38px; }
.btn[disabled], .btn[aria-disabled="true"] { background: #C9D6DC; color: #fff; border-color: transparent; cursor: not-allowed; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13px; font-weight: 700; color: var(--ink); }
.field__help { font-size: 12px; color: var(--muted); }
.field__error { font-size: 12px; color: var(--alert); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 500;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A5D68' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 110, 120, .15); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--alert); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; min-height: 28px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.check-card:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.check-card input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }

/* Search */
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 110, 120, .15); }
.search .icon { color: var(--muted); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink); }

/* Toggle switch: <label class="switch"><input type="checkbox" role="switch"><span></span></label> */
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { width: 100%; height: 100%; border-radius: var(--r-pill); background: #C9D6DC; transition: background var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 700; transition: all var(--ease);
}
button.chip:hover, a.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-active, .chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip--soft { background: var(--ground); border-color: transparent; font-weight: 600; }
.chip--tone { background: var(--tone-soft); color: var(--tone-ink); border-color: transparent; }
.chip--filter.is-active, .chip--filter[aria-pressed="true"] { background: var(--tone-soft); color: var(--tone-ink); border-color: var(--tone-ink); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; white-space: nowrap; background: var(--ground); color: var(--muted); }
.badge .icon { width: 14px; height: 14px; }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-alert { background: var(--alert-soft); color: var(--alert-dark); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-dark { background: rgba(0,0,0,.4); color: #fff; }
.badge-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--r-sm); background: var(--ground); color: var(--muted); font-size: 12px; font-weight: 700; }
.verified { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-size: 13px; font-weight: 700; }
.verified .icon { width: 15px; height: 15px; stroke-width: 2.2; }

/* Avatar */
.avatar {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 14px;
  background: var(--tone-soft); color: var(--tone-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar--xs { width: 32px; height: 32px; font-size: 12px; border-radius: 10px; }
.avatar--sm { width: 40px; height: 40px; font-size: 14px; border-radius: 12px; }
.avatar--lg { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }
.avatar--xl { width: 104px; height: 104px; font-size: 34px; border-radius: 26px; }
.avatar--round { border-radius: 50%; }
.avatar .online-dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.avatar--lg .online-dot { width: 18px; height: 18px; border-width: 3px; }
.avatar--xl .online-dot { width: 22px; height: 22px; border-width: 3px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: 48px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--tone-ink); border-bottom-color: var(--tone-ink); }
.tabs--fill .tab { flex: 1 1 0; justify-content: center; }

/* Segmented control */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: #E4ECF0; max-width: 100%; overflow-x: auto; }
.segmented button, .segmented a { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; }
.segmented .is-active, .segmented [aria-checked="true"], .segmented [aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.segmented--fill { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.segmented--fill button { justify-content: center; }

/* Alerts / banners */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid transparent; font-size: 14px; line-height: 1.45; }
.banner > .icon { margin-top: 1px; }
.banner__body { flex: 1; min-width: 0; }
.banner__action { flex: none; align-self: center; }
.banner--alert { background: var(--alert-soft); border-color: var(--alert-line); color: var(--alert-ink); }
.banner--warn { background: var(--warn-soft); border-color: var(--warn-line); color: #4A3200; }
.banner--info { background: var(--info-soft); color: #173F78; }
.banner--success { background: var(--success-soft); border-color: var(--success-line); color: var(--success-ink); }
.banner--tint { background: var(--primary-soft); color: var(--primary-dark); }
.banner a:not(.btn) { color: inherit; text-decoration: underline; }

/* Django messages / toasts */
.messages { position: fixed; z-index: 60; right: 16px; left: 16px; top: calc(var(--header-h) + 8px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.messages .banner { pointer-events: auto; box-shadow: var(--shadow-md); }
@media (min-width: 768px) { .messages { left: auto; width: 380px; } }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty-state__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.empty-state h3 { font-size: 16px; }
.empty-state p { color: var(--muted); font-size: 14px; max-width: 420px; }
.empty-state .btn { margin-top: 6px; }
.empty-inline { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line-strong); font-size: 14px; color: var(--muted); }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
.table { min-width: 620px; font-size: 14px; }
.table th { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover td { background: #FAFCFD; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-title { font-weight: 700; }
.table .cell-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

/* Key-value list */
.kv { display: flex; flex-direction: column; margin: 0; }
.kv__row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv__row:last-child { border-bottom: 0; }
.kv__row dt, .kv__row > :first-child { color: var(--muted); margin: 0; }
.kv__row dd, .kv__row > :last-child { margin: 0; font-weight: 700; text-align: right; }
.kv--total .kv__row:last-child { font-size: 16px; font-weight: 800; padding-top: 12px; border-top: 1px solid var(--line); }
.kv--total .kv__row:last-child > * { color: var(--ink); font-weight: 800; }

/* List rows */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list__item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: inherit; font-weight: inherit; }
.list__item:last-child { border-bottom: 0; }
a.list__item:hover { background: #FAFCFD; color: inherit; }
.list__title { font-size: 14px; font-weight: 700; }
.list__sub { font-size: 12px; color: var(--muted); }

/* Stat tiles */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat--muted { background: var(--ground); border-color: transparent; }
.stat__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat__note { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat__note.is-good { color: var(--success); } .stat__note.is-bad { color: var(--alert); }

/* Breadcrumbs */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 700; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination a, .pagination span { min-width: 40px; min-height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--ink); }
.pagination .is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Progress / steps */
.progress { display: grid; grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr)); gap: 6px; }
.progress__bar { height: 5px; border-radius: var(--r-pill); background: var(--line); }
.progress__bar.is-done { background: var(--primary); }
.stepper { display: flex; flex-direction: column; gap: 4px; }
.stepper__item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); color: var(--ink); }
.stepper__item.is-current { background: var(--primary-soft); }
.stepper__dot { width: 28px; height: 28px; border-radius: 50%; background: #E4ECF0; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none; }
.stepper__item.is-done .stepper__dot { background: var(--success); color: #fff; }
.stepper__item.is-current .stepper__dot { background: var(--primary); color: #fff; }

/* Skeleton + HTMX */
.skeleton { background: linear-gradient(90deg, #E9EFF2 25%, #F4F7F9 50%, #E9EFF2 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.htmx-request.htmx-swap-target, .htmx-request .htmx-swap-target { opacity: .5; transition: opacity var(--ease); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal (dialog element) */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); width: min(520px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(11,29,38,.25); }
dialog.modal::backdrop { background: rgba(11, 29, 38, .45); }
.modal__body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

/* 6. PATIENT PIECES --------------------------------------------------- */
/* Hero card (next consult) */
.hero-card { background: var(--primary); color: #fff; border-radius: var(--r-xl); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hero-card .eyebrow { color: #fff; }
.hero-card .pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.18); }
.hero-card .btn-light { background: #fff; color: var(--primary); }

/* Quick action tiles */
.action-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .action-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.action-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: inherit; }
.action-tile:hover { border-color: var(--line-strong); color: var(--ink); }
.action-tile__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--tone-soft); color: var(--tone-ink); display: inline-flex; align-items: center; justify-content: center; }
.action-tile__title { font-size: 15px; font-weight: 800; }
.action-tile__text { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* Section heading row */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 17px; }
.section-head a { font-size: 13px; }

/* Departments */
.dept-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .dept-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.dept-grid--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dept-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 14px 10px; border-radius: var(--r-lg); border: 2px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: inherit; transition: border-color var(--ease), transform var(--ease);
}
.dept-tile:hover { border-color: var(--line-strong); color: var(--ink); }
.dept-tile.is-selected, .dept-tile[aria-current="true"], .dept-tile[aria-checked="true"] { border-color: var(--tone-ink); }
.dept-tile__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--tone-soft); color: var(--tone-ink); display: inline-flex; align-items: center; justify-content: center; }
.dept-tile__icon .icon { width: 22px; height: 22px; }
.dept-tile__name { font-size: 13px; font-weight: 800; line-height: 1.25; }
.dept-tile__meta { font-size: 11px; color: var(--muted); }
.dept-tile__meta b { color: var(--success); }
.dept-grid--compact .dept-tile { padding: 10px 4px; border-width: 1px; gap: 6px; }
.dept-grid--compact .dept-tile__icon { width: 40px; height: 40px; }
.dept-grid--compact .dept-tile__name { font-size: 11px; font-weight: 700; }
/* list style for phones */
.dept-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: inherit; min-width: 0; }
.dept-row .dept-tile__icon { width: 38px; height: 38px; border-radius: 11px; }

.dept-hero { background: var(--tone-soft); padding: 22px 20px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.dept-hero__icon { width: 60px; height: 60px; border-radius: 16px; background: var(--surface); color: var(--tone-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dept-hero__icon .icon { width: 30px; height: 30px; }
.dept-hero__text { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dept-hero__text h2 { font-size: 24px; }
.dept-hero__text .sw { font-size: 15px; font-weight: 600; color: var(--muted); }
.dept-hero__text p { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.dept-hero .badge { background: var(--surface); color: var(--ink); font-size: 13px; padding: 8px 14px; }
.dept-hero .badge-success { color: var(--success); }
/* solid variant for mobile header */
.dept-hero--solid { background: var(--tone-ink); color: #fff; }
.dept-hero--solid h2, .dept-hero--solid .sw, .dept-hero--solid p { color: #fff; }

/* Doctor cards */
.doctor-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.doctor-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.doctor-card__top { display: flex; gap: 12px; min-width: 0; }
.doctor-card__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doctor-card__name { font-size: 16px; font-weight: 800; color: var(--ink); }
.doctor-card__name:hover { color: var(--primary); }
.doctor-card__role { font-size: 13px; color: var(--muted); }
.doctor-card__rating { font-size: 13px; color: var(--muted); }
.doctor-card__rating b { color: var(--ink); }
.doctor-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.doctor-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.doctor-card__when { font-size: 13px; line-height: 1.35; }
.doctor-card__when b { color: var(--ink); }
.doctor-card__when b.is-now { color: var(--success); }
.doctor-card__actions { display: flex; gap: 6px; }

/* Doctor profile header */
.profile-head { display: flex; flex-wrap: wrap; gap: 20px; }
.profile-head__text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-head__text h1 { font-size: 26px; }
.profile-head__badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Booking panel */
.booking { display: flex; flex-direction: column; gap: 14px; }
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.choice {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-md);
  border: 2px solid var(--line); background: var(--surface); text-align: left; color: var(--ink);
}
.choice:hover { border-color: var(--line-strong); }
.choice.is-active, .choice[aria-checked="true"], .choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__title { font-size: 14px; font-weight: 800; }
.choice__sub { font-size: 12px; color: var(--muted); }
.day-grid { display: grid; gap: 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.day {
  min-height: 56px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.day__dow { font-size: 11px; font-weight: 600; }
.day__num { font-size: 17px; font-weight: 800; }
.day.is-active, .day[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot-grid { display: grid; gap: 6px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.slot { min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; }
.slot:hover { border-color: var(--line-strong); }
.slot.is-active, .slot[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.slot[disabled] { background: var(--line-soft); color: var(--faint); cursor: not-allowed; }
label.slot { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.slot:has(input:disabled) { background: var(--line-soft); color: var(--faint); cursor: not-allowed; }
.slot:has(input:focus-visible), .choice:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice { position: relative; cursor: pointer; }
.booking__summary { padding: 12px; border-radius: var(--r-md); background: var(--ground); }
.booking__note { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.45; }

/* Sticky bottom action bar (phones) */
.action-bar { position: sticky; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.has-bottom-nav .action-bar { bottom: var(--bottom-nav-h); }
@media (min-width: 768px) { .action-bar--mobile { position: static; border: 0; padding: 0; background: transparent; } .has-bottom-nav .action-bar { bottom: 0; } }

/* Reviews & timeline */
.review { padding: 14px; border-radius: 14px; background: var(--ground); display: flex; flex-direction: column; gap: 6px; }
.review__head { font-size: 13px; font-weight: 800; }
.review__text { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.review__meta { font-size: 12px; color: var(--muted); }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline__item { display: flex; gap: 12px; }
.timeline__item::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--tone-ink); margin-top: 6px; flex: none; }
.timeline__title { font-size: 14px; font-weight: 800; }
.timeline__meta { font-size: 13px; color: var(--muted); }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.chat__day { align-self: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 10px; border-radius: var(--r-pill); background: #E4ECF0; }
.bubble { max-width: min(78%, 520px); padding: 10px 12px; font-size: 14px; line-height: 1.45; border-radius: 16px; }
.bubble--me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble--them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble__meta { display: block; margin-top: 4px; font-size: 10px; opacity: .8; }
.bubble--me .bubble__meta { text-align: right; }
.chat-card { align-self: flex-start; width: min(84%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; min-height: 44px; border: 0; border-radius: var(--r-md); background: var(--ground); padding: 0 14px; outline: 0; font-size: 14px; }
.composer input:focus { box-shadow: 0 0 0 2px var(--primary); }

/* Video call */
.call { background: var(--night); color: #fff; border-radius: var(--r-xl); overflow: hidden; }
.call__stage { position: relative; aspect-ratio: 16 / 9; background: var(--night-2); display: flex; align-items: center; justify-content: center; }
.call__stage video { width: 100%; height: 100%; object-fit: cover; }
.call__self { position: absolute; right: 14px; bottom: 14px; width: 22%; min-width: 96px; aspect-ratio: 4 / 3; border-radius: 14px; background: #2B4752; border: 2px solid rgba(255,255,255,.6); overflow: hidden; }
.call__badges { position: absolute; left: 14px; top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.call__controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; padding: 14px; }
.call-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #22363F; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.call-btn:hover { background: #2D4652; }
.call-btn.is-off { background: #fff; color: var(--ink); }
.call-btn--end { width: 68px; border-radius: var(--r-pill); background: #C9370A; }
.call-btn--end:hover { background: var(--alert-dark); }

/* Home care tracking */
.map { position: relative; min-height: 260px; border-radius: var(--r-xl); background: #E8EEF1; overflow: hidden; }
.pin-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 14px; background: var(--ink); color: #fff; }
.pin-box__code { font-family: var(--mono); font-size: 26px; letter-spacing: .18em; }
.pin-input { display: grid; grid-template-columns: repeat(var(--digits, 4), minmax(0, 1fr)); gap: 8px; }
.pin-input input { min-height: 56px; text-align: center; font: 500 22px var(--mono); border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.pin-input input:focus { outline: 0; border-color: var(--primary); }

/* Prescription / QR / receipt */
.qr { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); padding: 6px; background: #fff; flex: none; }
.receipt__hero { background: var(--success); color: #fff; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.receipt__check { width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--success); display: inline-flex; align-items: center; justify-content: center; }

/* Onboarding / auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth__card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp input { min-height: 56px; text-align: center; font: 500 22px var(--mono); border: 2px solid var(--line); border-radius: var(--r-md); }
.otp input:focus { outline: 0; border-color: var(--primary); }
.phone-field { display: flex; min-height: 56px; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; }
.phone-field:focus-within { border-color: var(--primary); }
.phone-field__code { padding: 0 14px; display: flex; align-items: center; background: var(--ground); font-weight: 800; border-right: 1px solid var(--line); }
.phone-field input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0 14px; font-size: 18px; font-weight: 700; letter-spacing: .04em; }

/* 7. CLINICIAN & ADMIN PIECES ----------------------------------------- */
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--r-md); background: var(--success-soft); color: var(--success-ink); font-size: 14px; font-weight: 800; }
.status-pill.is-offline { background: var(--ground); color: var(--muted); }
.priority { display: inline-flex; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; }
.priority--urgent { background: var(--alert-soft); color: var(--alert-dark); }
.priority--soon { background: var(--warn-soft); color: var(--warn-ink); }
.priority--routine { background: var(--info-soft); color: var(--info); }
.incoming { background: var(--ink); color: #fff; border-radius: var(--r-xl); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.incoming .eyebrow { color: #FFB79A; }
.soap textarea { background: #FBFDFE; }
.icd { display: inline-flex; gap: 6px; padding: 6px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 13px; font-weight: 700; }
.icd code { font-family: var(--mono); }
.week-grid { display: grid; grid-template-columns: 80px repeat(7, minmax(44px, 1fr)); gap: 6px; min-width: 620px; }
.week-grid__cell { height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.week-grid__cell.is-on, .week-grid__cell[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.audit { display: flex; flex-direction: column; }
.audit__item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.audit__item::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.audit__meta { font: 500 12px var(--mono); color: var(--muted); }
.perm-yes { color: var(--success); font-weight: 800; text-align: center; }
.perm-half { color: var(--warn-ink); font-weight: 800; text-align: center; }
.perm-no { color: var(--line-strong); font-weight: 800; text-align: center; }
.bar-chart { height: 240px; display: grid; grid-template-columns: repeat(var(--bars, 7), minmax(0, 1fr)); gap: 14px; align-items: end; border-bottom: 1px solid var(--line); }
.bar-chart__col { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; }
.bar-chart__seg { border-radius: 3px; }

/* 8. UTILITIES -------------------------------------------------------- */
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; } .text-right { text-align: right; }
.hidden { display: none !important; }
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .show-mobile { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .app-header, .bottom-nav, .sidebar, .action-bar, .messages { display: none !important; } body { background: #fff; } .card { border-color: #ccc; } }

/* 9. PROJECT ADDITIONS -------------------------------------------------
   Everything above is the design kit, unchanged. Everything below is what this app
   adds to it. The CSP forbids inline styles, so what the kit's templates set with
   style="" lives here as classes. */

/* {% icon %} sizes: CSS outranks the width attribute, so each size needs a class. */
.icon-14 { width: 14px; height: 14px; }
.icon-15 { width: 15px; height: 15px; }
.icon-16 { width: 16px; height: 16px; }
.icon-18 { width: 18px; height: 18px; }
.icon-20 { width: 20px; height: 20px; }
.icon-22 { width: 22px; height: 22px; }
.icon-24 { width: 24px; height: 24px; }
.icon-28 { width: 28px; height: 28px; }
.icon-30 { width: 30px; height: 30px; }

/* Contrast: --faint is 3.5:1 on white, and text must reach 4.5:1. */
.input::placeholder, .textarea::placeholder, .search input::placeholder { color: var(--muted); opacity: 1; }

/* Touch targets: keep the kit's sizes, and widen the area that takes the touch to 44 px. */
.chip, .btn-sm, .lang-switch { position: relative; }
.chip::after, .btn-sm::after, .lang-switch::after { content: ""; position: absolute; inset: -5px 0; }
.chip { cursor: pointer; }
.chips { row-gap: 10px; padding: 5px 0; }
.app-nav a, .breadcrumbs a, .section-head a, .empty-inline a, .section-link { display: inline-flex; align-items: center; min-height: 44px; }
.pagination a, .pagination span { min-width: 44px; min-height: 44px; }
.brand, .skip-link { min-height: 44px; }
.search input { min-height: 44px; }
.doctor-card__name { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }

/* Pages that do not exist yet: a link with no href, in a lighter colour. */
.app-nav a:not([href]), .bottom-nav a:not([href]) { color: #667680; }
.app-nav a:not([href]):hover { background: none; }

/* Header and sidebar */
.app-header__actions .avatar { width: 44px; height: 44px; }
.icon-link { display: inline-flex; align-items: center; gap: 4px; }
.sidebar__label { font-size: 13px; font-weight: 500; opacity: .7; }
/* Sidebar search box with its "/" hint, and the system status line. */
.sidebar__search { min-height: 44px; }
.sidebar__kbd { display: none; padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
@media (min-width: 1024px) { .sidebar__kbd { display: inline-block; } }
.sidebar__status-detail { font-size: 12px; overflow-wrap: anywhere; }
.search-results { display: flex; flex-direction: column; gap: 20px; }
.search-results__title { margin-bottom: 8px; font-size: 16px; }
/* Clinician availability switch at the top of the sidebar. */
.availability { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 44px; }
.availability__state { font-size: 14px; font-weight: 800; }
.has-js .availability__save { display: none; }
.availability__error { flex-basis: 100%; font-size: 13px; color: #FFD9C9; }

/* Layout replacing the kit's inline styles */
.row--tight { --gap: 8px; }
.grid--wide-gap { --gap: 24px; }
.narrow { max-width: 672px; }
.card--plain { border: 0; border-radius: 0; }
.card--flush > .tabs { padding: 0 12px; }
.dept-hero__text h1 { font-size: 26px; }
.dept-hero__text .sw { white-space: nowrap; }
.lead--ink { color: var(--ink-2); }
.review-score { font-size: 18px; }

/* Chips holding a checkbox */
.chip--filter:has(input:checked) { background: var(--tone-soft); color: var(--tone-ink); border-color: var(--tone-ink); }
.chip:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Fees shown in the booking panel before booking exists: they look like .choice but do nothing. */
.choice--static, .choice--static:hover { border-color: var(--line); cursor: default; }

/* Loading */
.skeleton-grid { display: none; }
.htmx-request > .skeleton-grid { display: grid; }
.htmx-request > .skeleton-grid + * { display: none; }
.skeleton-card { height: 180px; border-radius: var(--r-lg); }

/* Console forms: Django renders these widgets, so they cannot take .input directly. */
.field > input:not([type="checkbox"]), .field > select, .field > textarea { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 15px; font-weight: 500; }
.field > textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.field > input:focus, .field > select:focus, .field > textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 110, 120, .15); }
.field > input[type="checkbox"] { align-self: flex-start; width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
/* The kit's .select arrow, for selects Django renders. */
.field > select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A5D68' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field > input[type="file"] { display: flex; align-items: center; padding: 6px; color: var(--muted); font-size: 14px; }
.field > input[type="file"]::file-selector-button { min-height: 36px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); font: 800 13px var(--font); cursor: pointer; }
.field > input[type="file"]::file-selector-button:hover { border-color: var(--line-strong); }
.field div label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
ul.list { margin: 0; padding: 0; list-style: none; }
.list__text { display: flex; flex: 1 1 160px; flex-direction: column; min-width: 0; }
.list__item { flex-wrap: wrap; }
.list__item a.list__title { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; color: var(--ink); }
.list__empty { color: var(--muted); font-size: 14px; }
.console-grid { display: grid; gap: 10px; }
.console-grid .list__item { min-height: 56px; font-weight: 800; }
@media (min-width: 768px) { .console-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Profile and settings */
.settings { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.settings__nav { display: flex; gap: 4px; overflow-x: auto; }
.settings__nav a { display: inline-flex; flex: none; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--r-md); color: var(--muted); font-size: 14px; font-weight: 700; }
.settings__nav a:hover, .settings__nav a.is-active { background: var(--primary-soft); color: var(--primary-dark); }
.settings__body { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.settings__body section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
@media (min-width: 1024px) {
  .settings { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
  .settings__nav { position: sticky; top: calc(var(--header-h) + 16px); flex-direction: column; }
}
.profile-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.profile-banner__text { flex: 1 1 220px; min-width: 0; }
.profile-banner__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.completeness { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary-dark); }
.completeness__bar { display: block; width: 100%; height: 8px; border: 0; border-radius: var(--r-pill); overflow: hidden; appearance: none; background: var(--surface); }
.completeness__bar::-webkit-progress-bar { background: var(--surface); }
.completeness__bar::-webkit-progress-value { background: var(--primary); }
.completeness__bar::-moz-progress-bar { background: var(--primary); }
.save-bar { display: flex; justify-content: flex-end; }
.settings-group { display: flex; flex-direction: column; gap: 8px; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); color: inherit; font-weight: inherit; }
a.settings-row:hover { background: var(--ground); }
.settings-row__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--tone-soft); color: var(--tone-ink); }
.settings-row__text { display: flex; flex: 1 1 160px; flex-direction: column; min-width: 0; }
.settings-row__title { font-size: 14px; font-weight: 700; }
.settings-row__desc { color: var(--muted); font-size: 12px; }
.settings-row__control { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.settings-row__control .select { min-width: 140px; }
.settings-row--soon .settings-row__title { color: var(--muted); }

/* Health records */
.subject-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.subject-switch a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 4px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; }
.subject-switch a .avatar { width: 32px; height: 32px; font-size: 12px; border-radius: 50%; }
.subject-switch a.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.record-head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.record-head__text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.record-head__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.stat--alert { background: var(--alert-soft); border-color: var(--alert-line); }
.stat--alert .stat__label, .stat--alert .stat__value, .stat--alert .stat__note { color: var(--alert-ink); }
.stat__value--sm { font-size: 18px; line-height: 1.3; }
.records-tabs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0 8px; }
.records-tabs .tab .count { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: var(--r-pill); background: var(--ground); color: var(--muted); }
.records-tabs .tab.is-active .count { background: var(--primary-soft); color: var(--primary); }
.item-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.item-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.item-row:first-child { padding-top: 0; }
.item-row:last-child { border-bottom: 0; padding-bottom: 0; }
.item-row__text { display: flex; flex: 1 1 200px; flex-direction: column; gap: 2px; min-width: 0; }
.item-row__title { font-size: 15px; font-weight: 700; }
.item-row__meta { font-size: 13px; color: var(--muted); }

/* Consultations */
.next-up { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; background: var(--primary); color: #fff; border-radius: var(--r-xl); padding: 18px 20px; }
.next-up__when { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-up .eyebrow { color: #BFE3E6; }
.next-up__title { font-size: 20px; font-weight: 800; color: #fff; }
.next-up__meta { font-size: 14px; color: #D4ECEE; }
.next-up__who { flex: 1 1 220px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.next-up__who .avatar { background: #fff; color: var(--primary); }
.next-up__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.next-up .countdown { font-family: var(--mono); font-size: 13px; padding: 4px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.16); }
.consult-group { display: flex; flex-direction: column; gap: 10px; }
.consult-group__label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.consult-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
@media (min-width: 768px) { .consult-card { grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; } }
.date-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 8px 4px; border-radius: 14px; background: var(--tone-soft); color: var(--tone-ink); text-align: center; align-self: start; }
.date-block__mon { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.date-block__day { font-size: 24px; font-weight: 800; line-height: 1.1; }
.date-block__time { font-size: 12px; font-weight: 700; font-family: var(--mono); }
.consult-card__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.consult-card__top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.consult-card__name { font-size: 16px; font-weight: 800; color: var(--ink); }
.consult-card__name:hover { color: var(--primary); }
.consult-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.consult-card__note { font-size: 13px; color: var(--ink-2); }
.consult-card__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
@media (min-width: 768px) { .consult-card__actions { grid-column: auto; padding-top: 0; border-top: 0; justify-content: flex-end; max-width: 360px; } }
.consult-card.is-cancelled { opacity: .78; }
.consult-card.is-cancelled .date-block { background: var(--ground); color: var(--muted); }
.consult-card__who { display: flex; flex-direction: column; min-width: 0; }
.stack--tight { --gap: 10px; }
.btn-ghost--alert, .btn-ghost--alert:hover { color: var(--alert); }
.hero-card--link { color: #fff; font-weight: inherit; gap: 4px; }
.hero-card--link:hover { background: var(--primary-dark); color: #fff; }
.item-row a.item-row__title { color: var(--ink); }

/* Home care */
.progress-labels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.progress-labels .is-done { color: var(--primary-dark); font-weight: 800; }
/* Phones: four labels do not fit under four bars, so the steps become a list with dots. */
@media (max-width: 479px) {
  .progress:has(+ .progress-labels) { display: none; }
  .progress-labels { grid-template-columns: minmax(0, 1fr); gap: 10px; font-size: 14px; }
  .progress-labels li { display: flex; align-items: center; gap: 10px; }
  .progress-labels li::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); }
  .progress-labels li.is-done::before { border-color: var(--primary); background: var(--primary); }
}
.safety-point { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 14px; }
.safety-point .icon { flex: none; margin-top: 1px; }
.legend--spaced { margin-bottom: 12px; }
.choice__price { margin-top: 4px; font-size: 13px; font-weight: 800; color: var(--ink); }
.clinician-line { display: flex; flex-direction: column; gap: 2px; }
/* The whole row opens the request, not only its title. */
.item-row--link { position: relative; }
.item-row--link .item-row__title::after { content: ""; position: absolute; inset: 0; }
.item-row--link:hover .item-row__title { color: var(--primary); }
.item-row .date-block { width: 56px; flex: none; align-self: center; }
.date-block.is-muted { background: var(--ground); color: var(--muted); }
/* A plain .badge is the page colour, so it vanishes outside a card. */
.badge-neutral { background: var(--line); color: var(--ink-2); }

/* Sign-up: brand panel beside the form */
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--surface); }
.auth-brand { display: none; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px clamp(32px, 4vw, 64px); background: var(--primary); color: #fff; }
.auth-brand .brand { color: #fff; }
.auth-brand .brand__mark { background: var(--surface); color: var(--primary); }
.auth-brand h2 { color: #fff; font-size: 36px; letter-spacing: -0.02em; }
.auth-brand p { font-size: 17px; line-height: 1.45; }
.auth-points { display: flex; flex-direction: column; gap: 16px; }
.auth-point { display: flex; align-items: flex-start; gap: 12px; }
.auth-point b { display: block; }
.auth-point div span { display: block; font-size: 13px; opacity: .85; }
.auth-point__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .16); }
.auth-panel { display: flex; flex-direction: column; min-width: 0; }
.auth-panel__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; }
.auth-panel__body { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 480px; margin: 0 auto; padding: 8px 16px 40px; }
.auth-title { display: flex; flex-direction: column; gap: 8px; }
.auth-title h1 { font-size: 26px; }
.auth-title p { color: var(--muted); }
.lang-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: #E4ECF0; }
.lang-toggle button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.lang-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.form-grid--narrow { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.auth-hero { display: flex; flex-direction: column; gap: 12px; padding: 24px 16px; background: var(--primary); color: #fff; }
.auth-hero .brand { color: #fff; }
.auth-hero .brand__mark { background: var(--surface); color: var(--primary); }
@media (max-width: 1023px) { .auth-hero + .auth-panel__body { padding-top: 20px; } }
.lang-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 6px; }
.lang-card { position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.lang-card input { position: absolute; opacity: 0; pointer-events: none; }
.lang-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.lang-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.lang-card__dot { display: flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; border: 2px solid var(--line-strong); border-radius: 50%; }
.lang-card:has(input:checked) .lang-card__dot { border-color: var(--primary); }
.lang-card:has(input:checked) .lang-card__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.lang-card__text { display: flex; flex-direction: column; min-width: 0; }
.lang-card__text span { color: var(--muted); font-size: 12px; }
.trust-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; color: var(--muted); font-size: 12px; font-weight: 700; }
.trust-row span { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 1024px) {
  .auth-split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .auth-brand { display: flex; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .auth-panel__top { justify-content: flex-end; padding: 24px 32px; }
  .auth-panel__top .brand, .auth-hero { display: none; }
  .auth-panel__body { margin-block: auto; padding-top: 0; }
}

/* Sign-up */
.auth__steps { display: flex; align-items: center; gap: 8px; }
.auth__steps .progress { flex: 1; }
.auth__steps .btn-icon { margin-left: -10px; color: var(--ink); }
.auth__card h1 { font-size: 26px; }
.code-input { min-height: 56px; border-width: 2px; border-color: var(--primary); font-family: var(--mono); font-size: 22px; letter-spacing: .5em; text-align: center; }
.qr-code { width: 208px; max-width: 100%; margin: 0 auto; }
.qr-code svg { display: block; width: 100%; height: auto; }

/* Console dashboard */
.dash { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card__title { font-size: 16px; }

/* Charts (core/templatetags/charts.py). Marks carry their own colours as SVG attributes;
   these rules add hover and the HTML legend keys, which share the same four slots. */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; }
.viz { display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; }
.viz__svg { display: block; height: auto; overflow: visible; }
.viz__tick, .viz__value { font-variant-numeric: tabular-nums; }
.viz__column:hover .viz__bar { opacity: .85; }
.viz__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.viz__legend li { display: inline-flex; align-items: center; gap: 6px; }
.viz__key { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.viz__key--line { width: 14px; height: 2px; border-radius: 1px; }
.viz-s1 { --c: var(--series-1); } .viz-s2 { --c: var(--series-2); } .viz-s3 { --c: var(--series-3); } .viz-s4 { --c: var(--series-4); }
.viz__empty { color: var(--muted); font-size: 14px; }
.viz__table summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--primary); min-height: 44px; display: flex; align-items: center; }
@media (forced-colors: active) { .viz__bar, .viz__dot { fill: CanvasText; } .viz__line { stroke: CanvasText; } }

/* Console list pages (apps/console/lists.py) */
.filter-bar { display: flex; flex-direction: column; gap: 12px; }
.filter-bar__search { max-width: 520px; }
.filter-bar__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filter-bar__form .field { flex: 1 1 150px; max-width: 220px; }
.sort-link { color: inherit; text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.sort-link:hover { color: var(--ink); }
.cell-days-left.is-urgent { color: var(--alert); font-weight: 800; }
.detail-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.live-map { height: 360px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.payload { margin: 0; padding: 12px; border-radius: var(--r-md); background: var(--ground); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Clinician verification: review page, camera, tracker */
.review { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .review { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.review__documents { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.doc-viewer { margin: 0; }
.doc-viewer__frame { overflow: auto; max-height: 520px; border-radius: var(--r-md); background: var(--ground); }
.doc-viewer__image { display: block; width: 100%; height: auto; transform-origin: top left; }
.doc-viewer__image.is-zoom-2 { width: 200%; max-width: none; }
.doc-viewer__image.is-zoom-3 { width: 300%; max-width: none; }
.photo-compare { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.photo-compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-compare img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-md); background: var(--ground); }
.photo-compare figcaption { font-size: 13px; color: var(--muted); }
.text-alert { color: var(--alert); }
.camera__view { width: 100%; max-width: 420px; border-radius: var(--r-lg); background: var(--ink); transform: scaleX(-1); }
.camera__hint { font-size: 16px; font-weight: 700; }
.tracker { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tracker__item { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }
.tracker__item.is-done { color: var(--ink); }
.tracker__dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.tracker__item.is-done .tracker__dot { background: var(--success); border-color: var(--success); }
.inline-form { display: inline; }
.verified-badge summary { cursor: pointer; list-style: none; display: inline-flex; min-height: 44px; align-items: center; }
.clinician-card { display: flex; align-items: center; gap: 14px; }
.clinician-card__photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--ground); flex: none; }

/* 7b. CONSOLE LAYOUT --------------------------------------------------
   The admin console and the clinician workspace share one layout: a dark sidebar (272 px,
   a 76 px icon rail when collapsed, a drawer below 1024 px) and a sticky top bar holding the
   page title. The kit's .shell and .sidebar are extended here, not replaced. Without
   JavaScript, phones show the sidebar above the page; the drawer rules sit under .has-js. */
:root {
  --side-admin: #0B1D26;
  --side-clinician: #06313A;
  --side-active: rgba(10, 110, 120, .35);
  --side-marker: #4FC3CC;
  --side-ink: #C9D6DC;
  --side-muted: #8FA3AD;
  --top-h: 64px;
}
.shell__column { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.shell__column > .shell__main { flex: 1 0 auto; }
.shell__scrim[hidden] { display: none; }

.sidebar { color: var(--side-ink); }
.sidebar--admin { background: var(--side-admin); }
.sidebar--clinician { background: var(--side-clinician); }
.sidebar :focus-visible { outline-color: var(--side-marker); }
.sidebar__head { display: flex; align-items: center; gap: 8px; }
.sidebar__head .sidebar__label { margin-right: auto; }
.sidebar__label.badge { background: rgba(255,255,255,.12); color: #fff; opacity: 1; }
.sidebar__icon-btn, .shell__menu {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer;
}
.sidebar__icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.shell__menu:hover { background: var(--line-soft); }
.sidebar__close, .sidebar__collapse { display: none; }
.sidebar .search { min-height: 44px; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--side-ink); }
.sidebar .search input { color: #fff; background: transparent; }
.sidebar .search input::placeholder { color: var(--side-muted); }
.sidebar .sidebar__kbd { border-color: rgba(255,255,255,.2); color: var(--side-ink); }

/* Navigation: groups of 40 px links, a teal bar on the current one. */
.side-nav { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group__label { margin: 0; padding: 0 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--side-ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.nav-link .icon { flex: none; }
.nav-link__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link[href]:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active { background: var(--side-active); color: #fff; }
.nav-link.is-active::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-marker); }
.nav-link:not([href]) { color: #8299A4; cursor: default; }
.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.14); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.nav-count.is-warn { background: #F2B53A; color: #3A2600; }
.nav-count.is-alert { background: var(--alert); color: #fff; }
.nav-dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.nav-dot--live { background: #4ADE80; box-shadow: 0 0 0 3px rgba(74,222,128,.22); }
.nav-dot--warn { background: #F2B53A; }
.nav-dot--alert { background: #FF8A5C; }

/* Sidebar footer cards and the signed-in user. */
.sidebar__foot--stack { display: flex; flex-direction: column; gap: 10px; padding: 0; background: none; }
.side-card {
  display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md); background: rgba(255,255,255,.05); color: var(--side-ink); font-size: 12px; text-decoration: none;
}
a.side-card:hover { border-color: rgba(255,255,255,.2); }
.side-card__title { color: #fff; font-size: 13px; font-weight: 700; }
.side-card__body { line-height: 1.45; }
.side-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-card--warn { background: rgba(242,181,58,.14); border-color: rgba(242,181,58,.35); color: #FFE3A3; }
.side-card--alert { background: rgba(255,138,92,.16); border-color: rgba(255,138,92,.4); color: #FFD9C9; }
.side-card--status { flex-direction: row; align-items: flex-start; gap: 10px; }
.status-dot { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: #4ADE80; }
.side-card--status.is-degraded .status-dot { background: #F2B53A; }
.side-card--status.is-down .status-dot { background: #FF8A5C; }
.sidebar .lang-switch { background: transparent; color: var(--side-ink); border-color: rgba(255,255,255,.18); }
.sidebar__foot > form { align-self: flex-start; }
.meter { display: block; width: 100%; height: 6px; border: 0; border-radius: var(--r-pill); background: rgba(255,255,255,.15); -webkit-appearance: none; appearance: none; overflow: hidden; }
.meter::-webkit-progress-bar { background: rgba(255,255,255,.15); }
.meter::-webkit-progress-value { background: #5CC8CF; border-radius: var(--r-pill); }
.meter::-moz-progress-bar { background: #5CC8CF; border-radius: var(--r-pill); }
.sidebar__alerts[aria-pressed="true"] { background: rgba(255,255,255,.14); }
.user-card { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-card__name { overflow: hidden; color: #fff; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-card__meta { color: var(--side-muted); font-size: 12px; overflow-wrap: anywhere; }
.user-card__out { flex: none; }

/* The top bar: the section above the page title, and the page's actions. */
.shell__top {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  min-height: var(--top-h); padding: 8px 16px; border-bottom: 1px solid var(--line);
  background: rgba(243,247,249,.88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.shell__heading { flex: 1 1 200px; min-width: 0; }
.shell__crumbs { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.shell__crumbs:empty { display: none; }
.shell__crumbs a { color: inherit; }
.shell__title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.shell__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.shell__actions:empty { display: none; }
/* The sentence that used to sit under a page's heading, now that the heading is in the top bar. */
.page-intro { max-width: 720px; margin: 0; color: var(--muted); font-size: 15px; }

/* Toasts, such as "A new patient is waiting". */
.toast-region { position: fixed; right: 16px; bottom: 16px; left: 16px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 420px; padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: #fff; box-shadow: var(--shadow-md); font-size: 14px; font-weight: 600; pointer-events: auto; animation: toast-in 200ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1023.98px) {
  .nav-link { min-height: 44px; }
  .shell__menu-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
  .shell__menu-count.is-alert { background: var(--alert); }
  .shell__menu { margin-left: -8px; }
  html:not(.has-js) .shell__menu { display: none; }
  .has-js .shell__scrim { position: fixed; inset: 0; z-index: 40; background: rgba(11,29,38,.55); }
  .has-js .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(300px, 86vw); flex: none;
    overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 0 40px rgba(11,29,38,.3);
    transform: translateX(-100%); visibility: hidden; transition: transform 200ms ease, visibility 0s linear 200ms;
  }
  .has-js .shell.is-open .sidebar { transform: none; visibility: visible; transition: transform 200ms ease; }
  /* The drawer scrolls as one; its parts keep their height instead of overlapping. */
  .has-js .sidebar > * { flex-shrink: 0; }
  .has-js .sidebar__close { display: inline-flex; }
  .sidebar__foot { display: block; }
  .sidebar__foot--stack { display: flex; }
}

@media (min-width: 1024px) {
  .toast-region { align-items: flex-end; }
  .shell__top { padding: 12px 28px; }
  .shell__menu { display: none; }
  .sidebar { flex-basis: 272px; overflow: hidden; }
  .side-nav { flex: 1 1 auto; overflow-y: auto; margin: 0 -8px; padding: 0 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
  .has-js .sidebar__collapse { display: inline-flex; }
  .sidebar-collapsed .sidebar { flex-basis: 76px; padding-right: 12px; padding-left: 12px; }
  .sidebar-collapsed .sidebar__head { flex-direction: column; }
  .sidebar-collapsed .sidebar__text, .sidebar-collapsed .sidebar__label, .sidebar-collapsed .nav-group__label,
  .sidebar-collapsed .nav-link__text, .sidebar-collapsed .sidebar__search, .sidebar-collapsed .online-card__text,
  .sidebar-collapsed .availability__note, .sidebar-collapsed .side-card, .sidebar-collapsed .sidebar__alerts,
  .sidebar-collapsed .user-card__text, .sidebar-collapsed .sidebar__foot > form { display: none; }
  .sidebar-collapsed .online-card { justify-content: center; padding: 8px 0; }
  .sidebar-collapsed .nav-link { justify-content: center; padding: 0; }
  /* Collapsed, a count is a small red dot; its number stays for screen readers. */
  .sidebar-collapsed .nav-count { position: absolute; top: 7px; right: 9px; width: 9px; min-width: 0; height: 9px; padding: 0; overflow: hidden; background: var(--alert); font-size: 0; }
  .sidebar-collapsed .nav-dot { position: absolute; top: 8px; right: 10px; }
  .sidebar-collapsed .user-card { flex-direction: column; }
}

/* 7d. CLINICIAN SIDEBAR -----------------------------------------------
   The Online / Offline card: green when online, grey when offline, faded with its reason
   when locked (licence expired, suspended, not approved). Going offline always works. */
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .45; }
.online-card { gap: 12px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-md); background: rgba(255,255,255,.04); }
.online-card.is-online { border-color: rgba(74,222,128,.55); background: rgba(74,222,128,.1); }
.online-card__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.online-card .availability__state { color: #fff; }
.online-card__hint { color: var(--side-muted); font-size: 12px; }
.online-card.is-locked .switch, .online-card.is-locked .online-card__text { opacity: .6; }
.availability__note { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--side-ink); }

/* 7c. DASHBOARDS -------------------------------------------------------
   Pieces both dashboards share, and the admin dashboard. KPI grid: 2 columns on phones,
   3 from 900 px, 5 or 6 from 1280 px. The side column (things to do) comes first on phones. */
.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi-grid--five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.kpi__head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--tone-soft); color: var(--tone-ink); }
.kpi__label { font-size: 12px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
.kpi__value { font-size: clamp(20px, 5.5vw, 26px); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__change { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi__change.is-good { color: var(--success); }
.kpi__change.is-bad { color: var(--alert); }
.kpi__change.is-flat { color: var(--muted); }
.kpi__peer { font-size: 12px; color: var(--muted); }
.kpi .spark { margin-top: auto; }

.dash-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-col--side { order: -1; }
@media (min-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .dash-col--side { order: 0; }
}

/* "Needs your attention": the whole row is the link. */
.attention { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.attention__row { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 0 -10px; padding: 8px 10px; border-radius: var(--r-md); color: inherit; text-decoration: none; }
a.attention__row:hover { background: var(--ground); }
.attention__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--tone-soft); color: var(--tone-ink); }
.attention__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.attention__title { font-size: 14px; font-weight: 700; }
.attention__sub { font-size: 12px; color: var(--muted); }
.attention__count { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.attention__chevron { display: inline-flex; color: var(--muted); }

/* Load bars: a <progress>, so no inline width is needed. Green, amber when busy, red when over. */
.load { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.load .load-bar { flex: 1 1 80px; }
.load-bar { display: block; flex: none; width: 100%; height: 8px; border: 0; border-radius: var(--r-pill); background: var(--line-soft); -webkit-appearance: none; appearance: none; overflow: hidden; }
.load-bar::-webkit-progress-bar { background: var(--line-soft); }
.load-bar::-webkit-progress-value { background: var(--success); border-radius: var(--r-pill); }
.load-bar::-moz-progress-bar { background: var(--success); border-radius: var(--r-pill); }
.load-bar.is-busy::-webkit-progress-value { background: #C98A00; }
.load-bar.is-busy::-moz-progress-bar { background: #C98A00; }
.load-bar.is-over::-webkit-progress-value { background: var(--alert); }
.load-bar.is-over::-moz-progress-bar { background: var(--alert); }

.sos-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--alert); color: #fff; }
.sos-alert__icon { display: inline-flex; flex: none; }
.sos-alert__text { display: flex; flex: 1 1 220px; flex-direction: column; min-width: 0; font-size: 14px; }
.sos-alert__text strong { font-size: 15px; }
.sos-alert .btn-light { color: var(--alert-dark); }

.provider-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.provider { display: flex; flex-direction: column; gap: 6px; }
.provider__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.provider__name { font-size: 14px; font-weight: 700; }
.provider__detail { font-size: 12px; color: var(--muted); }

.feed { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.feed__item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.feed__item:last-child { border-bottom: 0; }
.feed__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--tone-soft); color: var(--tone-ink); }
.feed__text { flex: 1; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.feed__text strong { color: var(--ink); }
.feed__time { flex: none; font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.num-strong { font-weight: 800; font-variant-numeric: tabular-nums; }
/* Today's column in a bar chart is outlined (in SVG attributes): the day is not over yet. */
.viz__today { pointer-events: none; }

/* 7e. CLINICIAN DASHBOARD -----------------------------------------------
   The next patient, priority pills, today's agenda on a rail, and this month's earnings. */
.banner--action { align-items: center; flex-wrap: wrap; }
.banner--action .banner__body { flex: 1 1 200px; }
.next-patient {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding: 20px; border-radius: var(--r-xl); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff;
}
.next-patient__who { display: flex; flex: 1 1 280px; align-items: center; gap: 16px; min-width: 0; }
.next-patient__avatar { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--primary); font-size: 22px; font-weight: 800; }
.next-patient__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-patient .eyebrow { color: #BFE3E6; }
.next-patient__name { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.next-patient__meta { font-size: 14px; color: #D4ECEE; overflow-wrap: anywhere; }
.next-patient__side { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.next-patient__countdown { padding: 6px 12px; border-radius: var(--r-pill); background: rgba(255,255,255,.16); font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.next-patient__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.next-patient .btn-light[aria-disabled="true"] { cursor: default; background: rgba(255,255,255,.16); color: #fff; opacity: 1; }

.priority { padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; white-space: nowrap; }
.priority--urgent { background: var(--alert-soft); color: var(--alert-ink); }
.priority--soon { background: var(--warn-soft); color: var(--warn-ink); }
.priority--routine { background: var(--ground); color: var(--muted); }

/* Today's agenda: a time column, a rail with dots (green done, teal ring now, hollow to come). */
.agenda { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.agenda__item { position: relative; display: grid; grid-template-columns: 48px 16px minmax(0, 1fr) auto; align-items: start; gap: 4px 10px; padding: 10px 8px; border-radius: var(--r-md); }
.agenda__item::before { content: ""; position: absolute; top: 0; bottom: 0; left: 73px; width: 2px; background: var(--line); }
.agenda__item:first-child::before { top: 16px; }
.agenda__item:last-child::before { bottom: calc(100% - 16px); }
.agenda__item:only-child::before { display: none; }
.agenda__time { padding-top: 1px; font-family: var(--mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda__dot { position: relative; z-index: 1; width: 12px; height: 12px; margin: 4px 2px 0; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.agenda__item.is-done .agenda__dot { border-color: var(--success); background: var(--success); }
.agenda__item.is-now { background: var(--primary-tint); }
.agenda__item.is-now .agenda__dot { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.agenda__body { display: flex; flex-direction: column; min-width: 0; }
.agenda__title { font-size: 14px; font-weight: 700; color: var(--ink); }
.agenda__meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .agenda__item { grid-template-columns: 44px 16px minmax(0, 1fr); }
  .agenda__item::before { left: 69px; }
  .agenda__item .badge { grid-column: 3; justify-self: start; }
}

.money-big { font-size: 30px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* 7f. MANAGEMENT PAGES ---------------------------------------------------
   Built once for every console section: the list (.table-card), the detail page
   (.detail-head), the form page (.form-card) and the confirm dialog. */

/* Lists: tabs with counts, a toolbar, the table, the bulk bar and the footer. */
.table-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.table-card__head { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 16px; border-bottom: 1px solid var(--line); }
.table-card .tabs { margin: 0 -4px; }
.tab__count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: var(--r-pill); background: var(--ground); color: var(--muted); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tab.is-active .tab__count { background: var(--primary-soft); color: var(--primary-dark); }
.tab__count.is-alert { background: var(--alert); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar__search { flex: 1 1 240px; max-width: 420px; min-height: 40px; }
.toolbar__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar__field { display: inline-flex; align-items: center; gap: 6px; }
.toolbar__label { font-size: 12px; font-weight: 700; color: var(--muted); }
.select--compact, .input--compact { width: auto; min-height: 40px; font-size: 14px; }
.table--list { min-width: 720px; }
.table--list td, .table--list th { white-space: nowrap; }
/* A row heading is a name, not a column label: no capitals, no muted grey. */
.table tbody th { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); color: var(--ink); font-size: 14px; font-weight: 600; letter-spacing: 0; text-align: left; text-transform: none; }
.table tbody tr.is-flagged > :first-child { box-shadow: inset 3px 0 0 var(--alert); }
.table tbody tr.is-selected td, .table tbody tr.is-selected th { background: var(--primary-tint); }
.cell-check { width: 44px; }
.cell-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.cell-action { width: 1%; text-align: right; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .avatar { width: 36px; height: 36px; font-size: 13px; }
.cell-user .avatar .online-dot { width: 11px; height: 11px; }
.cell-user__text { display: flex; flex-direction: column; min-width: 0; }
.sort-link { gap: 4px; white-space: nowrap; }
.sort-link__mark { color: var(--line-strong); font-size: 12px; }
.sort-link.is-active { color: var(--ink); }
.sort-link.is-active .sort-link__mark { color: var(--primary); }
.bulk-bar {
  position: sticky; bottom: 12px; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin: 12px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(11,29,38,.25);
  animation: toast-in 160ms ease;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar__count { font-size: 14px; }
.bulk-bar__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.list-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.list-footer__count { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-footer .pagination { justify-content: flex-end; }
.pagination .is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.empty-state--list { margin: 20px; }

/* Detail page: the head card, four numbers, tabs, and the side column. */
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 20px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.detail-head__main { display: flex; flex: 1 1 320px; flex-direction: column; gap: 8px; min-width: 0; }
.detail-head__name { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.detail-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.meta-row li { display: inline-flex; align-items: center; gap: 6px; }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--line); gap: 1px; overflow: hidden; }
@media (min-width: 700px) { .mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mini-stats__item { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); }
.mini-stats__item dt { font-size: 12px; font-weight: 700; color: var(--muted); }
.mini-stats__item dd { margin: 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mini-stats__item small { font-size: 13px; color: var(--muted); font-weight: 600; }
.detail-grid--main { grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .detail-grid--main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); } }
.tabs--card { margin-bottom: -6px; }
.admin-note { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--warn-line); border-radius: var(--r-md); background: #FFFBEA; }
.admin-note p { margin: 0; font-size: 14px; }
.admin-note__meta { font-size: 12px; color: var(--muted); }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form-inline .field { flex: 1 1 220px; }

/* Form page: sections with an intro column, fields, pickers, and a sticky save bar. */
.form-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.form-section { display: grid; gap: 14px 32px; padding: 22px 20px; border-bottom: 1px solid var(--line); }
@media (min-width: 960px) { .form-section { grid-template-columns: 260px minmax(0, 1fr); padding: 24px 28px; } }
.form-section__title { margin: 0 0 4px; font-size: 16px; }
.form-section__intro p { margin: 0; font-size: 13px; color: var(--muted); }
.form-section__fields { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.field-pair { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
fieldset.field { margin: 0; padding: 0; border: 0; }
.req { color: var(--alert); }
.has-error .input, .has-error .select, .has-error .textarea, .has-error input, .has-error select, .has-error textarea { border-color: var(--alert); }
.input-affix { display: flex; align-items: stretch; }
.input-affix__text { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: var(--ground); color: var(--muted); font-size: 14px; font-weight: 700; }
.input-affix input { min-width: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }
.icon-picker { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.icon-picker__tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--r-md); color: var(--muted); cursor: pointer; text-align: center; }
.icon-picker__tile input, .swatch input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker__tile:hover { border-color: var(--line-strong); }
.icon-picker__tile:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.icon-picker__tile:has(input:focus-visible), .swatch:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-picker__name { font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 8px; border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer; font-size: 14px; font-weight: 700; }
.swatch__dot { width: 20px; height: 20px; border-radius: 50%; background: var(--tone-ink); box-shadow: 0 0 0 3px var(--tone-soft); }
.swatch:has(input:checked) { border-color: var(--tone-ink); background: var(--tone-soft); }
.preview-tile { display: flex; flex-direction: column; gap: 6px; }
.preview-tile__label { font-size: 12px; font-weight: 700; color: var(--muted); }
.dept-preview { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; min-width: 220px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.dept-preview__icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--tone-soft); color: var(--tone-ink); }
.dept-preview__name { font-size: 15px; font-weight: 800; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-row__text { display: flex; flex-direction: column; }
.settings-row__title { font-weight: 700; }
.settings-row__sub { font-size: 13px; color: var(--muted); }
/* A switch that is a button: it posts a change rather than ticking a box. */
.switch-button { position: relative; flex: none; width: 44px; height: 26px; padding: 0; border: 0; border-radius: var(--r-pill); background: #C9D6DC; cursor: pointer; }
.switch-button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--ease); }
.switch-button[aria-checked="true"] { background: var(--primary); }
.switch-button[aria-checked="true"]::after { transform: translateX(18px); }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 20px; border-radius: 0 0 var(--r-xl) var(--r-xl); background: rgba(255,255,255,.96); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.save-bar__end { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* The confirm dialog: a red icon tile, the question, and an optional required reason. */
.confirm__icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--r-md); background: var(--alert-soft); color: var(--alert); }
.confirm__title { margin: 0; font-size: 18px; }
.confirm__text { margin: 0; color: var(--muted); font-size: 14px; }

/* Clinician reports */
.spark { display: block; margin-top: 6px; }
.spark .viz__svg { height: 28px; overflow: hidden; }
.range-custom summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--primary); }
.range-custom__form { align-items: flex-end; flex-wrap: wrap; }
.range-custom__form .field { min-width: 150px; }
.statement__head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.statement__head .brand { color: var(--ink); }
.statement__who { flex: 1 1 260px; min-width: 0; }
.statement__who h1 { margin: 0 0 4px; }
/* Console clinician reports */
.table .table__summary th, .table .table__summary td { background: var(--ground); font-weight: 700; }
.ranked { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; font-size: 14px; }
.heatmap { min-width: 760px; font-size: 11px; }
.heatmap th, .heatmap td { padding: 4px 2px; text-align: center; }
.heatmap__hour { font-weight: 600; }
.heatmap__cell { font-variant-numeric: tabular-nums; }
/* Five steps of the primary colour; the number stays in each cell, so colour is never the only cue. */
.heat-0 { background: var(--surface); color: var(--muted); }
.heat-1 { background: #E3F2F3; color: var(--ink); }
.heat-2 { background: #B8DEE1; color: var(--ink); }
.heat-3 { background: #1E7C86; color: #fff; }
.heat-4 { background: var(--primary); color: #fff; }

@media print {
  .statement__print, .shell__top, .toast-region { display: none !important; }
  .shell__main { padding: 0; }
  .statement { max-width: none; }
  .statement .card { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .bulk-bar { animation: none; }
  .switch-button::after { transition: none; }
  .has-js .sidebar, .has-js .shell.is-open .sidebar { transition: none; }
  .toast { animation: none; }
}

/* A <details> that opens a row's edit forms or a region's district list. */
.disclosure summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--primary); }
.disclosure[open] > summary { margin-bottom: 8px; }

/* The Region → District → Ward picker (geo/_area_picker.html). */
.area-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.area-picker__results:empty { display: none; }
.area-picker__results .list { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.area-picker__only { font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.list__button { display: flex; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.list__button:hover, .list__button:focus-visible { background: var(--ground); }
.area-picker .btn-block { justify-content: center; gap: 8px; }
.ward-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; padding: 4px 0 8px; }
.area-picker__locate { display: grid; gap: 6px; }
.area-picker__search { margin: 0; }
.progress--5 { --steps: 5; }

/* Doctors by location: the place line, the scope tabs and the badges on doctor cards. */
.area-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.area-bar__place { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.area-bar__change { flex: 1 1 100%; }
.area-bar__change[open] { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.chip__count { display: inline-flex; min-width: 20px; justify-content: center; margin-left: 6px; padding: 0 6px; border-radius: var(--r-pill); background: var(--ground); font-size: 12px; font-weight: 800; }
.chip.is-disabled { opacity: .45; cursor: not-allowed; }
.doctor-card__place { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tag--home { background: var(--success-soft, var(--ground)); color: var(--success-ink, var(--ink)); }
.scope-tabs { padding-bottom: 2px; }
.request-steps { margin: 0; padding-left: 20px; font-size: 14px; }

/* "Request a doctor": the live search card and the clinician's offer cards. */
.request-card { position: relative; }
.search-rings { position: relative; width: 120px; height: 120px; margin: 8px auto 0; display: grid; place-items: center; color: var(--primary); }
.search-rings span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--primary); opacity: 0; animation: search-ring 2.4s ease-out infinite; }
.search-rings span:nth-child(2) { animation-delay: .8s; }
.search-rings span:nth-child(3) { animation-delay: 1.6s; }
@keyframes search-ring { from { transform: scale(.35); opacity: .7; } to { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .search-rings span { animation: none; opacity: .25; } }
.scope-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.scope-steps__step { padding-top: 10px; border-top: 4px solid var(--line); overflow-wrap: anywhere; }
.scope-steps__step.is-done { border-color: var(--primary); color: var(--primary-dark); }
.scope-steps__step.is-current { border-color: var(--primary); color: var(--ink); }
.countdown { font-variant-numeric: tabular-nums; }
.doctor-row { display: flex; gap: 14px; align-items: center; }
.doctor-row p { margin: 0; }
.choice-grid--3 { --cols: 3; border: 0; padding: 0; margin: 0; }
.offer-card { display: grid; gap: 10px; }
.offer-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.offer-card__facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; font-size: 14px; color: var(--muted); }
.offer-card.is-done { opacity: .7; }
.request-cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--primary); color: #fff; text-decoration: none; }
.request-cta span { flex: 1; }
.request-cta:hover, .request-cta:focus-visible { background: var(--primary-dark); color: #fff; }

/* The confirm dialog is a short question: narrower than other modals. */
dialog.modal.confirm { width: min(420px, calc(100% - 32px)); }
/* The icon inside an icon-picker tile: a fixed box, so every tile lines up. */
.icon-picker__icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
/* "Clear filters" sits in the toolbar row as a button, not a block form. */
.toolbar__clear { display: inline-flex; margin: 0; }
