/* ============================================================================
   HSA — OneShifa healthcare super-app demo
   Design system stylesheet — demo/assets/hsa.css
   Built by RootSoft IT. Contract: docs/design/DEMO_DESIGN_SYSTEM.md
   Tokens: docs/design/tokens.css (copied verbatim below, section 2) — never retype,
   copy the file section when tokens.css changes. Namespace is HSA, not the brand
   name, so a rename touches only assets/i18n.js and assets/img/.

   TABLE OF CONTENTS
   1.  Fonts (@font-face — self-hosted Geist, Geist Mono, Noto Sans/Serif Bengali; no Google Fonts)
   2.  Tokens (verbatim docs/design/tokens.css primitive/semantic/component layers)
       + demo-only layout tokens
   3.  Reset
   4.  Typography
   5.  Utilities (pulse-line rule, reveal animation, layout helpers)
   6.  Buttons — RootSoft BUTTON STANDARD
   7.  Forms — RootSoft NUMBER FIELD STANDARD
   8.  Layout shells (public / portal: sidebar, topbar, bottom tab bar, wallet chips)
   9.  Components: card, stat, grid, badge, chip (+clinical), tabs, stepper,
       timeline, table, toolbar, pagination, empty, skeleton, alert, breadcrumb,
       avatar, kbd, tooltip, progress, kv, phone, map, queue-board, calendar,
       trend, vitals, rx-builder, rx-sheet, lab-report, receipt, health-id-card,
       emergency-card, media-grid, upload-progress, plan-card, site-preview,
       video-room, chat, otp, chips-input, search-select
   9b. Portal v2: page-head, now-strip/now-panel, needs, list-row, tile-grid,
       minibar, portal-cols, stat-row (DESIGN_LANGUAGE_V2.md §3)
   9c. Browse: departments and symptoms (the directory front door)
   10. Overlays: modal, drawer, toast, confirm
   11. Responsive breakpoints (640 / 960 / 1280)
   12. Print (.rx-sheet, .lab-report, .receipt — A4/A5)
   13. Reduced motion
   ============================================================================ */

/* ============================================================================
   1. FONTS — self-hosted Bengali faces (copied from the SDA demo's woff2 set)
   ============================================================================ */
/* Geist + Geist Mono — self-hosted variable fonts (SIL OFL, from the official geist npm package v1.7.2),
   so the demo never depends on Google Fonts at presentation time (Sayem, 20 Sep 2026). Latin only —
   Bengali stays Noto Sans/Serif Bengali below. */
@font-face{font-family:'Geist';font-style:normal;font-weight:100 900;font-display:swap;
  src:url('fonts/geist-variable.woff2') format('woff2');}
@font-face{font-family:'Geist Mono';font-style:normal;font-weight:100 900;font-display:swap;
  src:url('fonts/geist-mono-variable.woff2') format('woff2');}
/* Fraunces — the display serif of the HERITAGE brand (see §2b). Self-hosted variable file
   (SIL OFL, @fontsource-variable/fraunces 5.3.0, latin "full" cut so the opsz / SOFT / WONK
   axes are all present). This is the brand's display face (§2b); .display-1..4 use it
   unless a page asks for the old teal brand with ?brand=classic. */
@font-face{font-family:'Fraunces Variable';font-style:normal;font-weight:100 900;font-display:swap;
  src:url('fonts/fraunces-variable.woff2') format('woff2-variations');}

@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:400;font-display:swap;
  src:url('fonts/noto-sans-bengali-bengali-400-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:400;font-display:swap;
  src:url('fonts/noto-sans-bengali-latin-400-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:500;font-display:swap;
  src:url('fonts/noto-sans-bengali-bengali-500-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:500;font-display:swap;
  src:url('fonts/noto-sans-bengali-latin-500-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:600;font-display:swap;
  src:url('fonts/noto-sans-bengali-bengali-600-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:600;font-display:swap;
  src:url('fonts/noto-sans-bengali-latin-600-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:700;font-display:swap;
  src:url('fonts/noto-sans-bengali-bengali-700-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Sans Bengali';font-style:normal;font-weight:700;font-display:swap;
  src:url('fonts/noto-sans-bengali-latin-700-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}

@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:400;font-display:swap;
  src:url('fonts/noto-serif-bengali-bengali-400-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:400;font-display:swap;
  src:url('fonts/noto-serif-bengali-latin-400-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:500;font-display:swap;
  src:url('fonts/noto-serif-bengali-bengali-500-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:500;font-display:swap;
  src:url('fonts/noto-serif-bengali-latin-500-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:600;font-display:swap;
  src:url('fonts/noto-serif-bengali-bengali-600-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:600;font-display:swap;
  src:url('fonts/noto-serif-bengali-latin-600-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:700;font-display:swap;
  src:url('fonts/noto-serif-bengali-bengali-700-normal.woff2') format('woff2');
  unicode-range:U+0980-09FF;}
@font-face{font-family:'Noto Serif Bengali';font-style:normal;font-weight:700;font-display:swap;
  src:url('fonts/noto-serif-bengali-latin-700-normal.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}

/* ============================================================================
   2. TOKENS — verbatim from docs/design/tokens.css (primitive → semantic → component)
   ============================================================================ */

/* ============================== 1. PRIMITIVE ============================== */
:root {
  /* -- Brand teal (anchor: teal-700 = #0F766E, the brief's binding anchor hex) -- */
  --teal-50:  #f3fcfb;
  --teal-100: #e2f8f6;
  --teal-200: #c0f2ee;
  --teal-300: #8aeae3;
  --teal-400: #47e1d5;
  --teal-500: #1dc3b6;
  --teal-600: #15998e;
  --teal-700: #0F766E; /* anchor */
  --teal-800: #0a5e58;
  --teal-900: #0a4540;
  --teal-950: #072724;

  /* --brand-N — the alias every COMPONENT uses (.health-id-card, .rx-sheet, .lab-report,
     .receipt, .queue-board, .surface-teal, .pub-footer__mark, .btn--inverse…). This block
     seeds it from the teal scale and §2b re-points it at forest green for the real brand,
     so one line re-skins every printed and branded surface. Never reference --teal-N
     directly outside this block. */
  --brand-50:var(--teal-50);   --brand-100:var(--teal-100); --brand-200:var(--teal-200);
  --brand-300:var(--teal-300); --brand-400:var(--teal-400); --brand-500:var(--teal-500);
  --brand-600:var(--teal-600); --brand-700:var(--teal-700); --brand-800:var(--teal-800);
  --brand-900:var(--teal-900); --brand-950:var(--teal-950);

  /* -- Warm accent: apricot / terracotta (human moments, CTAs) -- */
  --accent-50:  #fef4ee;
  --accent-100: #fce5d9;
  --accent-200: #f8ccb5;
  --accent-300: #f2ad88;
  --accent-400: #eb9160;
  --accent-500: #e07a42;
  --accent-600: #ce6127;
  --accent-700: #a94f1e;
  --accent-800: #843c15;
  --accent-900: #5e2d12;
  --accent-950: #361b0d;

  /* -- Neutral (10-step, hue 175° — a barely-there green undertone; doubles as "ink") -- */
  --neutral-0:   #FFFFFF;
  --neutral-50:  #fafcfb;
  --neutral-100: #f3f6f6;
  --neutral-200: #e5ebeb;
  --neutral-300: #ced9d8;
  --neutral-400: #a4b6b5;
  --neutral-500: #7e9593;
  --neutral-600: #5f7775;
  --neutral-700: #475c5a;
  --neutral-800: #2f4140;
  --neutral-900: #1d2b2a;
  --neutral-950: #0e1817; /* ink */

  /* -- Semantic hues (success/warning/danger/info) — solved for real contrast, not guessed -- */
  --success-solid:      #1f8552;
  --success-subtle-lt:  #f2f8f5;
  --success-text-lt:    #1c794b;
  --success-subtle-dk:  #183929;
  --success-text-dk:    #47ca88;

  --warning-solid:      #986d0a;
  --warning-subtle-lt:  #fbf7ef;
  --warning-text-lt:    #8b6409;
  --warning-subtle-dk:  #413310;
  --warning-text-dk:    #e1ab2c;

  --danger-solid:       #d9382a;
  --danger-subtle-lt:   #f9f1f1;
  --danger-text-lt:     #c33022;
  --danger-subtle-dk:   #3c1916;
  --danger-text-dk:     #e8a29b;

  --info-solid:         #3476c3;
  --info-subtle-lt:     #f2f5f8;
  --info-text-lt:       #2f6aaf;
  --info-subtle-dk:     #182839;
  --info-text-dk:       #93b7e0;

  /* -- Clinical status (separate namespace from semantic — colour-blind safe hue spread;
        ALWAYS paired with an icon + text label, never colour alone, see §4.5) -- */
  --clinical-normal-solid:     #1f8552;
  --clinical-normal-subtle-lt: #f2f8f5;
  --clinical-normal-text-lt:   #1c794b;
  --clinical-normal-subtle-dk: #183929;
  --clinical-normal-text-dk:   #47ca88;

  --clinical-borderline-solid:     #976e11;
  --clinical-borderline-subtle-lt: #faf7f0;
  --clinical-borderline-text-lt:   #89640f;
  --clinical-borderline-subtle-dk: #3f3212;
  --clinical-borderline-text-dk:   #ddac3c;

  --clinical-abnormal-solid:     #bb5917;
  --clinical-abnormal-subtle-lt: #faf4f0;
  --clinical-abnormal-text-lt:   #a95015;
  --clinical-abnormal-subtle-dk: #3f2412;
  --clinical-abnormal-text-dk:   #e7a578;

  --clinical-critical-solid:     #d13a73;
  --clinical-critical-subtle-lt: #f8f2f4;
  --clinical-critical-text-lt:   #bf2d65;
  --clinical-critical-subtle-dk: #391825;
  --clinical-critical-text-dk:   #e4a0ba;

  /* -- Data visualisation, 6-colour categorical (colour-blind-safe hue spread) -- */
  --dataviz-1-lt: #117f77; --dataviz-1-dk: #0b9f93;
  --dataviz-2-lt: #566dc3; --dataviz-2-dk: #748ada;
  --dataviz-3-lt: #946b09; --dataviz-3-dk: #b9850a;
  --dataviz-4-lt: #b9541e; --dataviz-4-dk: #e96720;
  --dataviz-5-lt: #8660b7; --dataviz-5-dk: #a27dd1;
  --dataviz-6-lt: #5f7581; --dataviz-6-dk: #6c94a7;

  /* -- Typography primitives -- */
  /* One modern family for UI and display (Sayem, 20 Sep 2026: "use a modern font"): Geist —
     high x-height, unambiguous 0/O and 1/l/I for doses and IDs, weights 300–800 from one file.
     Geist Mono carries codes, IDs and tabular clinical numbers. Bengali stays Noto Sans Bengali. */
  --font-display: 'Geist', 'Noto Sans Bengali', ui-sans-serif, system-ui, sans-serif;
  --font-ui:      'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-bn-ui:     'Noto Sans Bengali', var(--font-ui);
  --font-bn-serif:  'Noto Serif Bengali', Georgia, serif;
  --font-ar:        'Noto Sans Arabic', var(--font-ui);
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;

  --text-2xs:  0.75rem;    --leading-2xs:  1rem;
  --text-xs:   0.8125rem;  --leading-xs:   1.125rem;
  --text-sm:   0.875rem;   --leading-sm:   1.25rem;
  --text-base: 1rem;       --leading-base: 1.5rem;
  --text-md:   1.125rem;   --leading-md:   1.625rem;
  --text-lg:   1.25rem;    --leading-lg:   1.75rem;
  --text-xl:   1.5rem;     --leading-xl:   2rem;
  --text-2xl:  1.75rem;    --leading-2xl:  2.25rem;
  --text-3xl:  2rem;       --leading-3xl:  2.5rem;
  --text-4xl:  2.25rem;    --leading-4xl:  2.75rem;
  --text-5xl:  2.5rem;     --leading-5xl:  3rem;
  --text-6xl:  3rem;       --leading-6xl:  3.5rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;  --space-4: 1rem;
  --space-5: 1.25rem;  --space-6: 1.5rem;   --space-8: 2rem;     --space-10: 2.5rem;
  --space-12: 3rem;    --space-16: 4rem;    --space-20: 5rem;    --space-24: 6rem;

  --radius-xs: 4px;  --radius-sm: 6px;  --radius-md: 10px;
  --radius-lg: 14px; --radius-xl: 20px; --radius-2xl: 28px; --radius-full: 999px;

  --duration-fast: 100ms;
  --duration-base: 160ms;
  --duration-slow: 240ms;
  --ease-standard:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-decelerate:  cubic-bezier(0, 0, 0.2, 1);
  --ease-accelerate:  cubic-bezier(0.4, 0, 1, 1);

  --shadow-xs: 0 1px 2px rgba(14, 24, 23, 0.06);
  --shadow-sm: 0 1px 3px rgba(14, 24, 23, 0.08), 0 1px 2px rgba(14, 24, 23, 0.05);
  --shadow-md: 0 4px 10px rgba(14, 24, 23, 0.08), 0 2px 4px rgba(14, 24, 23, 0.06);
  --shadow-lg: 0 12px 24px rgba(14, 24, 23, 0.12), 0 4px 8px rgba(14, 24, 23, 0.06);
  --shadow-xl: 0 24px 48px rgba(14, 24, 23, 0.16), 0 8px 16px rgba(14, 24, 23, 0.08);
}

/* ============================== 2. SEMANTIC — light (default) ============================== */
:root {
  color-scheme: light;

  --color-surface-canvas:  var(--neutral-50);
  --color-surface-paper:   var(--neutral-0);
  --color-surface-sunken:  var(--neutral-100);
  --color-surface-raised:  var(--neutral-0);
  --color-surface-overlay: rgba(14, 24, 23, 0.48);

  --color-border-subtle:  var(--neutral-200);
  --color-border-default: var(--neutral-300);
  --color-border-strong:  var(--neutral-400);
  --color-border-input:   var(--neutral-500);

  --color-ink-primary:   var(--neutral-950);
  --color-ink-secondary: var(--neutral-700);
  --color-ink-muted:     var(--neutral-600);
  --color-ink-disabled:  var(--neutral-500);
  --color-ink-inverse:   var(--neutral-0);

  --color-brand-primary:        var(--teal-700);
  --color-brand-primary-hover:  var(--teal-800);
  --color-brand-primary-active: var(--teal-900);
  --color-brand-primary-subtle: var(--teal-50);
  --color-brand-primary-border: var(--teal-200);
  --color-brand-on-primary:     var(--neutral-0);

  --color-accent:          var(--accent-700);
  --color-accent-hover:    var(--accent-800);
  --color-accent-active:   var(--accent-900);
  --color-accent-subtle:   var(--accent-50);
  --color-accent-border:   var(--accent-200);
  --color-accent-decorative: var(--accent-500);
  --color-on-accent:       var(--neutral-0);

  --color-success-solid: var(--success-solid); --color-success-subtle: var(--success-subtle-lt); --color-success-text: var(--success-text-lt);
  --color-warning-solid: var(--warning-solid); --color-warning-subtle: var(--warning-subtle-lt); --color-warning-text: var(--warning-text-lt);
  --color-danger-solid:  var(--danger-solid);  --color-danger-subtle:  var(--danger-subtle-lt);  --color-danger-text:  var(--danger-text-lt);
  --color-info-solid:    var(--info-solid);    --color-info-subtle:    var(--info-subtle-lt);    --color-info-text:    var(--info-text-lt);

  --color-clinical-normal-solid: var(--clinical-normal-solid); --color-clinical-normal-subtle: var(--clinical-normal-subtle-lt); --color-clinical-normal-text: var(--clinical-normal-text-lt);
  --color-clinical-borderline-solid: var(--clinical-borderline-solid); --color-clinical-borderline-subtle: var(--clinical-borderline-subtle-lt); --color-clinical-borderline-text: var(--clinical-borderline-text-lt);
  --color-clinical-abnormal-solid: var(--clinical-abnormal-solid); --color-clinical-abnormal-subtle: var(--clinical-abnormal-subtle-lt); --color-clinical-abnormal-text: var(--clinical-abnormal-text-lt);
  --color-clinical-critical-solid: var(--clinical-critical-solid); --color-clinical-critical-subtle: var(--clinical-critical-subtle-lt); --color-clinical-critical-text: var(--clinical-critical-text-lt);

  --color-dataviz-1: var(--dataviz-1-lt); --color-dataviz-2: var(--dataviz-2-lt); --color-dataviz-3: var(--dataviz-3-lt);
  --color-dataviz-4: var(--dataviz-4-lt); --color-dataviz-5: var(--dataviz-5-lt); --color-dataviz-6: var(--dataviz-6-lt);

  --color-focus-ring: var(--teal-600);
  --shadow-elevation-1: var(--shadow-xs);
  --shadow-elevation-2: var(--shadow-sm);
  --shadow-elevation-3: var(--shadow-md);
  --shadow-elevation-4: var(--shadow-lg);
}

/* ============================== dark theme: OS preference ============================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --color-surface-canvas:  var(--neutral-950);
    --color-surface-paper:   var(--neutral-900);
    --color-surface-sunken:  var(--neutral-800);
    --color-surface-raised:  var(--neutral-800);
    --color-surface-overlay: rgba(0, 0, 0, 0.6);

    --color-border-subtle:  var(--neutral-800);
    --color-border-default: var(--neutral-700);
    --color-border-strong:  var(--neutral-600);
    --color-border-input:   var(--neutral-600);

    --color-ink-primary:   var(--neutral-0);
    --color-ink-secondary: var(--neutral-300);
    --color-ink-muted:     var(--neutral-400);
    --color-ink-disabled:  var(--neutral-600);
    --color-ink-inverse:   var(--neutral-950);

    --color-brand-primary:        var(--teal-400);
    --color-brand-primary-hover:  var(--teal-300);
    --color-brand-primary-active: var(--teal-500);
    --color-brand-primary-subtle: var(--teal-900);
    --color-brand-primary-border: var(--teal-800);
    --color-brand-on-primary:     var(--neutral-950);

    --color-accent:          var(--accent-400);
    --color-accent-hover:    var(--accent-300);
    --color-accent-active:   var(--accent-500);
    --color-accent-subtle:   var(--accent-900);
    --color-accent-border:   var(--accent-800);
    --color-accent-decorative: var(--accent-500);
    --color-on-accent:       var(--neutral-950);

    --color-success-solid: var(--success-solid); --color-success-subtle: var(--success-subtle-dk); --color-success-text: var(--success-text-dk);
    --color-warning-solid: var(--warning-solid); --color-warning-subtle: var(--warning-subtle-dk); --color-warning-text: var(--warning-text-dk);
    --color-danger-solid:  var(--danger-solid);  --color-danger-subtle:  var(--danger-subtle-dk);  --color-danger-text:  var(--danger-text-dk);
    --color-info-solid:    var(--info-solid);    --color-info-subtle:    var(--info-subtle-dk);    --color-info-text:    var(--info-text-dk);

    --color-clinical-normal-solid: var(--clinical-normal-solid); --color-clinical-normal-subtle: var(--clinical-normal-subtle-dk); --color-clinical-normal-text: var(--clinical-normal-text-dk);
    --color-clinical-borderline-solid: var(--clinical-borderline-solid); --color-clinical-borderline-subtle: var(--clinical-borderline-subtle-dk); --color-clinical-borderline-text: var(--clinical-borderline-text-dk);
    --color-clinical-abnormal-solid: var(--clinical-abnormal-solid); --color-clinical-abnormal-subtle: var(--clinical-abnormal-subtle-dk); --color-clinical-abnormal-text: var(--clinical-abnormal-text-dk);
    --color-clinical-critical-solid: var(--clinical-critical-solid); --color-clinical-critical-subtle: var(--clinical-critical-subtle-dk); --color-clinical-critical-text: var(--clinical-critical-text-dk);

    --color-dataviz-1: var(--dataviz-1-dk); --color-dataviz-2: var(--dataviz-2-dk); --color-dataviz-3: var(--dataviz-3-dk);
    --color-dataviz-4: var(--dataviz-4-dk); --color-dataviz-5: var(--dataviz-5-dk); --color-dataviz-6: var(--dataviz-6-dk);

    --color-focus-ring: var(--teal-300);
    --shadow-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-elevation-2: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-elevation-3: 0 4px 10px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-elevation-4: 0 12px 24px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
  }
}

/* ============================== dark theme: explicit toggle ============================== */
:root[data-theme="dark"] {
  color-scheme: dark;

  --color-surface-canvas:  var(--neutral-950);
  --color-surface-paper:   var(--neutral-900);
  --color-surface-sunken:  var(--neutral-800);
  --color-surface-raised:  var(--neutral-800);
  --color-surface-overlay: rgba(0, 0, 0, 0.6);

  --color-border-subtle:  var(--neutral-800);
  --color-border-default: var(--neutral-700);
  --color-border-strong:  var(--neutral-600);
  --color-border-input:   var(--neutral-600);

  --color-ink-primary:   var(--neutral-0);
  --color-ink-secondary: var(--neutral-300);
  --color-ink-muted:     var(--neutral-400);
  --color-ink-disabled:  var(--neutral-600);
  --color-ink-inverse:   var(--neutral-950);

  --color-brand-primary:        var(--teal-400);
  --color-brand-primary-hover:  var(--teal-300);
  --color-brand-primary-active: var(--teal-500);
  --color-brand-primary-subtle: var(--teal-900);
  --color-brand-primary-border: var(--teal-800);
  --color-brand-on-primary:     var(--neutral-950);

  --color-accent:          var(--accent-400);
  --color-accent-hover:    var(--accent-300);
  --color-accent-active:   var(--accent-500);
  --color-accent-subtle:   var(--accent-900);
  --color-accent-border:   var(--accent-800);
  --color-accent-decorative: var(--accent-500);
  --color-on-accent:       var(--neutral-950);

  --color-success-solid: var(--success-solid); --color-success-subtle: var(--success-subtle-dk); --color-success-text: var(--success-text-dk);
  --color-warning-solid: var(--warning-solid); --color-warning-subtle: var(--warning-subtle-dk); --color-warning-text: var(--warning-text-dk);
  --color-danger-solid:  var(--danger-solid);  --color-danger-subtle:  var(--danger-subtle-dk);  --color-danger-text:  var(--danger-text-dk);
  --color-info-solid:    var(--info-solid);    --color-info-subtle:    var(--info-subtle-dk);    --color-info-text:    var(--info-text-dk);

  --color-clinical-normal-solid: var(--clinical-normal-solid); --color-clinical-normal-subtle: var(--clinical-normal-subtle-dk); --color-clinical-normal-text: var(--clinical-normal-text-dk);
  --color-clinical-borderline-solid: var(--clinical-borderline-solid); --color-clinical-borderline-subtle: var(--clinical-borderline-subtle-dk); --color-clinical-borderline-text: var(--clinical-borderline-text-dk);
  --color-clinical-abnormal-solid: var(--clinical-abnormal-solid); --color-clinical-abnormal-subtle: var(--clinical-abnormal-subtle-dk); --color-clinical-abnormal-text: var(--clinical-abnormal-text-dk);
  --color-clinical-critical-solid: var(--clinical-critical-solid); --color-clinical-critical-subtle: var(--clinical-critical-subtle-dk); --color-clinical-critical-text: var(--clinical-critical-text-dk);

  --color-dataviz-1: var(--dataviz-1-dk); --color-dataviz-2: var(--dataviz-2-dk); --color-dataviz-3: var(--dataviz-3-dk);
  --color-dataviz-4: var(--dataviz-4-dk); --color-dataviz-5: var(--dataviz-5-dk); --color-dataviz-6: var(--dataviz-6-dk);

  --color-focus-ring: var(--teal-300);
  --shadow-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-elevation-2: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-elevation-3: 0 4px 10px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-elevation-4: 0 12px 24px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   2b. HERITAGE BRAND — forest green + gold on warm paper, Fraunces headlines
   ----------------------------------------------------------------------------
   Sayem, 20 Sep 2026, after reviewing demo/sites/dr-rezaul/: "the green and gold/amber
   like combination gives an aristocratic premium feel". Decisions taken with him:
     - palette + serif HEADLINES move to the platform; Geist stays for UI and table text
       (Fraunces has no tabular figures — doses and money must stay column-aligned);
     - gold is the ACTION accent, not only decoration (his call, over the recommendation
       to keep it decorative), so the clinical amber it collided with has moved — see below.

   **This IS the brand** (Sayem, 20 Sep 2026, after seeing it live: "i like the heritage").
   Every selector here is `:root:not([data-brand="classic"])`, so it applies by default and
   steps aside only when a page explicitly asks for the old teal. That means the teal blocks
   in §2 above are not dead code — they ARE the "classic" definition, reached with
   `?brand=classic`, which keeps demo/_brand-compare.html honest and keeps the teal scale
   available to demo/sites/dr-anwar/ (a doctor website deliberately built in the old palette).

   COLLISION RESOLVED: the classic gold-amber warning (#8b6409) and clinical "borderline"
   (#976e11) sit ~2 degrees of hue from the brand gold (#a9822f) — unusable once gold became
   the action accent. Moving borderline naively landed it on "abnormal", two adjacent
   severities on one scale, which is a worse confusion. Final spread: borderline 32 deg /
   abnormal 9 deg / critical 337 deg — 23 and 32 apart, matching classic's own spread, every
   text value over 4.5:1 on the cream canvas. Residual: the gold is 9 deg from borderline,
   separated by saturation (57% vs 95%) and by form (solid fill vs pale wash), not by hue.
   Status is icon + label as well as colour (contract §4.5), so hue is never the only signal.
   ============================================================================ */
:root{
  /* -- Forest green (anchor 700 = #1e3d2f) -- */
  --forest-50:  #f2f6f3;  --forest-100: #e4ebe6; --forest-200: #c6d5cb; --forest-300: #9fb8a8;
  --forest-400: #6f9280;  --forest-500: #4a7360; --forest-600: #325a49; --forest-700: #1e3d2f;
  --forest-800: #163025;  --forest-900: #10241a; --forest-950: #081410;

  /* -- Antique gold. 600 (#a9822f) is the DECORATIVE metal: rules, numerals, seals.
        700 (#8a6a26) is the SOLID FILL, because #a9822f under white text is only 3.56:1
        and AA needs 4.5:1; #8a6a26 measures 5.05:1. -- */
  --gold-50:  #fbf8f0; --gold-100: #f4ecd9; --gold-200: #e8d6ad; --gold-300: #d9bc7c;
  --gold-400: #c8a154; --gold-500: #b8913f; --gold-600: #a9822f; --gold-700: #8a6a26;
  --gold-800: #6b521d; --gold-900: #4d3b15; --gold-950: #2b210c;

  /* -- Warm paper neutrals (the single biggest reason this reads "printed", not "software") -- */
  --paper-0:   #fffdf8; --paper-50:  #faf7f0; --paper-100: #f6f2ea; --paper-200: #ece3d0;
  --paper-300: #ddd2b8; --paper-400: #c7b997; --paper-500: #a99b78; --paper-600: #756d59;
  /* --paper-550 exists for one reason: an INPUT border is a UI component boundary and owes
     3:1 (WCAG 1.4.11). --paper-500 on the cream paper measures 2.70:1; this measures 3.33:1,
     matching the 3.18:1 the classic brand was solved to. Do not use it as a general border. */
  --paper-550: #9a8a61;
  --paper-700: #4a4536; --paper-800: #332f24; --paper-900: #24211a; --paper-950: #1c1a14;

  /* -- Heritage semantic hues. Three constraints at once, all measured:
        (a) "borderline"/"warning" must move off the brand gold (41 degrees);
        (b) but must NOT land on "abnormal" — they are adjacent severities on the same
            scale, so confusing THEM is worse than confusing either with a button;
        (c) every text value must clear 4.5:1 on the cream canvas (#f6f2ea).
        Result, light theme: borderline 32 deg / abnormal 9 deg / critical 337 deg —
        23 and 32 degrees apart, the same spread the default brand has. Warning is kept
        equal to borderline on purpose: they mean the same thing in two namespaces. -- */
  --h-warning-solid: #ae5d05; --h-warning-subtle-lt: #fdf5ec; --h-warning-text-lt: #9e5504;
  --h-warning-subtle-dk: #3f2409; --h-warning-text-dk: #eda15c;
  --h-borderline-solid: #ae5d05; --h-borderline-subtle-lt: #fdf5ec; --h-borderline-text-lt: #9e5504;
  --h-borderline-subtle-dk: #3f2409; --h-borderline-text-dk: #eda15c;
  --h-abnormal-solid: #c4351d; --h-abnormal-subtle-lt: #fbf1ef; --h-abnormal-text-lt: #b3301a;
  --h-abnormal-subtle-dk: #401a12; --h-abnormal-text-dk: #f0977c;
}

:root:not([data-brand="classic"]){
  color-scheme: light;
  --font-display: 'Fraunces Variable', var(--font-bn-serif), Georgia, 'Times New Roman', serif;
  /* --font-ui and --font-mono deliberately unchanged: Geist keeps the tables aligned. */

  /* one line re-skins every branded surface: ShifaID card, Rx sheet, lab report, receipt,
     queue board, the footer's giant wordmark, .surface-teal, .btn--inverse */
  --brand-50:var(--forest-50);   --brand-100:var(--forest-100); --brand-200:var(--forest-200);
  --brand-300:var(--forest-300); --brand-400:var(--forest-400); --brand-500:var(--forest-500);
  --brand-600:var(--forest-600); --brand-700:var(--forest-700); --brand-800:var(--forest-800);
  --brand-900:var(--forest-900); --brand-950:var(--forest-950);

  --color-surface-canvas:  var(--paper-100);
  --color-surface-paper:   var(--paper-0);
  --color-surface-sunken:  var(--paper-200);
  --color-surface-raised:  var(--paper-0);
  --color-surface-overlay: rgba(28, 26, 20, 0.55);

  --color-border-subtle:  var(--paper-300);
  --color-border-default: var(--paper-400);
  --color-border-strong:  var(--paper-500);
  --color-border-input:   var(--paper-550);   /* 3.33:1 — see --paper-550 */

  --color-ink-primary:   var(--paper-950);
  --color-ink-secondary: var(--paper-700);
  --color-ink-muted:     var(--paper-600);
  --color-ink-disabled:  var(--paper-500);
  --color-ink-inverse:   var(--paper-0);

  --color-brand-primary:        var(--forest-700);
  --color-brand-primary-hover:  var(--forest-800);
  --color-brand-primary-active: var(--forest-900);
  --color-brand-primary-subtle: var(--forest-50);
  --color-brand-primary-border: var(--forest-200);
  --color-brand-on-primary:     var(--paper-0);

  --color-accent:            var(--gold-700);
  --color-accent-hover:      var(--gold-800);
  --color-accent-active:     var(--gold-900);
  --color-accent-subtle:     var(--gold-50);
  --color-accent-border:     var(--gold-200);
  --color-accent-decorative: var(--gold-600);
  --color-on-accent:         var(--paper-0);

  --color-warning-solid: var(--h-warning-solid); --color-warning-subtle: var(--h-warning-subtle-lt); --color-warning-text: var(--h-warning-text-lt);
  --color-clinical-borderline-solid: var(--h-borderline-solid); --color-clinical-borderline-subtle: var(--h-borderline-subtle-lt); --color-clinical-borderline-text: var(--h-borderline-text-lt);
  --color-clinical-abnormal-solid: var(--h-abnormal-solid); --color-clinical-abnormal-subtle: var(--h-abnormal-subtle-lt); --color-clinical-abnormal-text: var(--h-abnormal-text-lt);
  /* dataviz: series 1 was teal (the old brand) and series 3 was the same gold as this brand's
     accent — a chart series must never read as the brand or as a CTA. Re-spread across the
     heritage palette, keeping the colour-blind-safe hue distance. */
  --color-dataviz-1: var(--forest-600);        /* 6.98:1 on cream */
  --color-dataviz-3: var(--h-borderline-solid); /* 4.31:1 on cream */
  /* series 6 deliberately keeps the classic slate: the brand gold measured 3.18:1 here and,
     worse, made a chart series read as the accent. */

  --color-focus-ring: var(--forest-600);
}

/* Fraunces is an optical-size + SOFT axis face: without these it renders as the flat default
   master and loses exactly the warmth it was chosen for. Latin only — Bengali display stays
   Noto Serif Bengali, which has neither axis. */
:root:not([data-brand="classic"]) .display-1,
:root:not([data-brand="classic"]) .display-2,
:root:not([data-brand="classic"]) .display-3,
:root:not([data-brand="classic"]) .display-4,
:root:not([data-brand="classic"]) .font-display{
  font-optical-sizing:auto;font-variation-settings:"SOFT" 40;letter-spacing:-0.022em;font-weight:600;
}
:root[lang="bn"]:not([data-brand="classic"]) .display-1,
:root[lang="bn"]:not([data-brand="classic"]) .display-2,
:root[lang="bn"]:not([data-brand="classic"]) .display-3,
:root[lang="bn"]:not([data-brand="classic"]) .display-4{font-variation-settings:normal;letter-spacing:0;}
/* .surface-teal's linear gradient already follows --brand-N; only its two hard-coded rgba
   highlights (cyan) and the pulse motif's stroke need re-tinting to gold + green. */
:root:not([data-brand="classic"]) .surface-teal{
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(201,161,84,.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(50,90,73,.34), transparent 60%),
    linear-gradient(160deg, var(--brand-800), var(--brand-950));
}
:root:not([data-brand="classic"]) .surface-teal::after{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='80' viewBox='0 0 240 80'%3E%3Cpath d='M0 40 L80 40 L92 22 L104 58 L116 40 L240 40' fill='none' stroke='%23c8a154' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  opacity:.16;
}
/* The symbol is an <img>, so it cannot read a CSS variable and stayed teal on the eight pages
   that embed it directly (the Rx sheet letterhead, the printed prescription, the style guide,
   the landing page…). content:url() re-points every one of them at the heritage artwork, and
   because a CSS url() resolves against the STYLESHEET it is correct from any folder depth —
   which the JS-side brandAsset() can only manage at the two shell call sites. */
:root[data-brand="classic"] img[src$="img/symbol.svg"]{content:url('img/symbol-classic.svg');}
:root:not([data-brand="classic"]) .pulse-rule{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='8' viewBox='0 0 120 8'%3E%3Cpath d='M0 4 L40 4 L46 1 L52 7 L58 4 L120 4' fill='none' stroke='%23a9822f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='0.45'/%3E%3C/svg%3E");
}
/* .btn--inverse already follows --brand-800 / --brand-50 via the alias; only the paper
   it sits on changes, and --neutral-0 is white in both brands, so nothing to override. */

/* -- heritage, dark theme: the paper goes to ink, green and gold lift to stay readable -- */
@media (prefers-color-scheme: dark){
  :root:not([data-brand="classic"]):not([data-theme="light"]){ color-scheme: dark;
    --color-surface-canvas:var(--paper-950); --color-surface-paper:var(--paper-900);
    --color-surface-sunken:var(--paper-800); --color-surface-raised:var(--paper-800);
    --color-border-subtle:var(--paper-800); --color-border-default:var(--paper-700); --color-border-strong:var(--paper-600); --color-border-input:var(--paper-600);
    --color-ink-primary:var(--paper-0); --color-ink-secondary:var(--paper-300); --color-ink-muted:var(--paper-400); --color-ink-disabled:var(--paper-600); --color-ink-inverse:var(--paper-950);
    --color-brand-primary:var(--forest-300); --color-brand-primary-hover:var(--forest-200); --color-brand-primary-active:var(--forest-400);
    --color-brand-primary-subtle:var(--forest-900); --color-brand-primary-border:var(--forest-800); --color-brand-on-primary:var(--paper-950);
    --color-accent:var(--gold-300); --color-accent-hover:var(--gold-200); --color-accent-active:var(--gold-400);
    --color-accent-subtle:var(--gold-950); --color-accent-border:var(--gold-800); --color-accent-decorative:var(--gold-400); --color-on-accent:var(--paper-950);
    --color-warning-subtle:var(--h-warning-subtle-dk); --color-warning-text:var(--h-warning-text-dk);
    --color-clinical-borderline-subtle:var(--h-borderline-subtle-dk); --color-clinical-borderline-text:var(--h-borderline-text-dk);
    --color-clinical-abnormal-subtle:var(--h-abnormal-subtle-dk); --color-clinical-abnormal-text:var(--h-abnormal-text-dk);
    --color-dataviz-1:var(--forest-400);      /* 5.08:1 on the dark canvas (was 2.23:1) */
    --color-dataviz-3:#c9803a;                /* 5.54:1 (was 3.62:1) */
    --color-dataviz-6:var(--dataviz-6-dk);    /* classic slate, 5.54:1 */
    --color-focus-ring:var(--forest-300);
  }
}
:root:not([data-brand="classic"])[data-theme="dark"]{ color-scheme: dark;
  --color-surface-canvas:var(--paper-950); --color-surface-paper:var(--paper-900);
  --color-surface-sunken:var(--paper-800); --color-surface-raised:var(--paper-800);
  --color-border-subtle:var(--paper-800); --color-border-default:var(--paper-700); --color-border-strong:var(--paper-600); --color-border-input:var(--paper-600);
  --color-ink-primary:var(--paper-0); --color-ink-secondary:var(--paper-300); --color-ink-muted:var(--paper-400); --color-ink-disabled:var(--paper-600); --color-ink-inverse:var(--paper-950);
  --color-brand-primary:var(--forest-300); --color-brand-primary-hover:var(--forest-200); --color-brand-primary-active:var(--forest-400);
  --color-brand-primary-subtle:var(--forest-900); --color-brand-primary-border:var(--forest-800); --color-brand-on-primary:var(--paper-950);
  --color-accent:var(--gold-300); --color-accent-hover:var(--gold-200); --color-accent-active:var(--gold-400);
  --color-accent-subtle:var(--gold-950); --color-accent-border:var(--gold-800); --color-accent-decorative:var(--gold-400); --color-on-accent:var(--paper-950);
  --color-warning-subtle:var(--h-warning-subtle-dk); --color-warning-text:var(--h-warning-text-dk);
  --color-clinical-borderline-subtle:var(--h-borderline-subtle-dk); --color-clinical-borderline-text:var(--h-borderline-text-dk);
  --color-clinical-abnormal-subtle:var(--h-abnormal-subtle-dk); --color-clinical-abnormal-text:var(--h-abnormal-text-dk);
  --color-dataviz-1:var(--forest-400);      /* 5.08:1 on the dark canvas (was 2.23:1) */
    --color-dataviz-3:#c9803a;                /* 5.54:1 (was 3.62:1) */
    --color-dataviz-6:var(--dataviz-6-dk);    /* classic slate, 5.54:1 */
  --color-focus-ring:var(--forest-300);
}

/* ============================== 3. COMPONENT (tokens.css) ============================== */
:root {
  --button-height-sm: 44px;
  --button-height-md: 44px;
  --button-height-lg: 48px;
  --button-radius: var(--radius-md);
  --button-gap: var(--space-2);
  --button-press-scale: 0.97;
  --button-press-duration: var(--duration-fast);

  --input-height: 44px;
  --input-radius: var(--radius-md);
  --input-border-width: 1px;

  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;

  --tap-target-min: 44px;
  --tap-target-primary-mobile: 48px;
}

/* ============================== demo-only layout tokens (contract §3) ============================== */
:root {
  --sidebar-w: 268px; --topbar-h: 60px; --content-max: 1360px; --gutter: clamp(16px, 3vw, 32px);
  --bottom-tabs-h: 64px; --phone-w: 390px; --phone-h: 844px;
}

/* ============================================================================
   3. RESET
   ============================================================================ */
*,*::before,*::after{box-sizing:border-box;}
html,body{height:100%;}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-behavior:smooth;}
body{
  margin:0;
  background:var(--color-surface-canvas);
  color:var(--color-ink-primary);
  font-family:var(--font-ui);
  font-size:var(--text-base);
  line-height:var(--leading-base);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}
html[lang="bn"] body{font-family:var(--font-bn-ui);}
h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd{margin:0;}
ul,ol{margin:0;padding:0;list-style:none;}
img,svg,video,canvas{display:block;max-width:100%;}
img{height:auto;}
a{color:inherit;text-decoration:none;}
button,input,textarea,select{font:inherit;color:inherit;background:none;border:none;}
button{cursor:pointer;}
button:disabled{cursor:not-allowed;}
table{border-collapse:collapse;width:100%;}
fieldset{border:none;margin:0;padding:0;}
hr{border:none;border-top:1px solid var(--color-border-subtle);margin:0;}
::selection{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary-active);}
:focus{outline:none;}
:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);border-radius:var(--radius-xs);}
[hidden]{display:none!important;}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.skip-link{position:absolute;left:8px;top:-48px;background:var(--color-brand-primary-active);color:#fff;padding:10px 16px;border-radius:var(--radius-sm);z-index:200;transition:top var(--duration-base);}
.skip-link:focus{top:8px;}

/* ============================================================================
   4. TYPOGRAPHY
   ============================================================================ */
/* Display scale — fluid, tight, confident. Display type is a visual element, not a label:
   the biggest step is the size difference between display-1 and body, not weight. */
.display-1,.display-2,.display-3,.display-4,.font-display{font-family:var(--font-display);color:var(--color-ink-primary);letter-spacing:-0.02em;text-wrap:balance;}
html[lang="bn"] .display-1,html[lang="bn"] .display-2,html[lang="bn"] .display-3,html[lang="bn"] .display-4,html[lang="bn"] .font-display{font-family:var(--font-bn-ui);letter-spacing:0;line-height:1.25;}
.display-1{font-size:clamp(2.5rem, 1.6rem + 3.4vw, 4.75rem);line-height:1.02;font-weight:var(--weight-semibold);letter-spacing:-0.035em;}
.display-2{font-size:clamp(1.9rem, 1.3rem + 2vw, 3rem);line-height:1.08;font-weight:var(--weight-semibold);letter-spacing:-0.03em;}
.display-3{font-size:clamp(1.4rem, 1.15rem + 0.9vw, 1.75rem);line-height:1.2;font-weight:var(--weight-semibold);}
.display-4{font-size:var(--text-lg);line-height:var(--leading-lg);font-weight:var(--weight-semibold);letter-spacing:-0.015em;}
.lede{font-size:clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);line-height:1.55;color:var(--color-ink-secondary);max-width:58ch;text-wrap:pretty;}
.measure{max-width:64ch;}
.text-body{font-size:var(--text-base);line-height:var(--leading-base);}
.text-sm{font-size:var(--text-sm);line-height:var(--leading-sm);}
.text-xs{font-size:var(--text-xs);line-height:var(--leading-xs);}
.text-2xs{font-size:var(--text-2xs);line-height:var(--leading-2xs);}
.text-muted{color:var(--color-ink-muted);}
.text-secondary{color:var(--color-ink-secondary);}
.text-brand{color:var(--color-brand-primary);}
.text-accent{color:var(--color-accent);}
.text-danger{color:var(--color-danger-text);}
.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;}
.tabular{font-variant-numeric:tabular-nums;}
.fw-500{font-weight:var(--weight-medium);}
.fw-600{font-weight:var(--weight-semibold);}
.fw-700{font-weight:var(--weight-bold);}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;}
/* eyebrow: a quiet sentence-case label in the brand colour (no tracked ALL-CAPS — that is template chrome) */
.eyebrow{font-size:var(--text-sm);font-weight:var(--weight-semibold);letter-spacing:0;text-transform:none;color:var(--color-brand-primary);display:inline-flex;align-items:center;gap:8px;}
.eyebrow::before{content:'';width:18px;height:2px;border-radius:2px;background:currentColor;opacity:.7;}

/* ============================================================================
   5. UTILITIES
   ============================================================================ */
.container{max-width:var(--content-max);margin-inline:auto;padding-inline:var(--gutter);}
.stack{display:flex;flex-direction:column;}
.row{display:flex;align-items:center;}
.gap-1{gap:var(--space-1);} .gap-2{gap:var(--space-2);} .gap-3{gap:var(--space-3);} .gap-4{gap:var(--space-4);} .gap-5{gap:var(--space-5);} .gap-6{gap:var(--space-6);}
.wrap{flex-wrap:wrap;}
.grow{flex:1 1 auto;}
.between{justify-content:space-between;}
.center{justify-content:center;align-items:center;}

/* pulse-line rule — the leaf-to-pulse symbol's pulse segment repeated as an SVG pattern at
   ~6% opacity, under the top header of every app (contract §1) */
.pulse-rule{
  height:1px;width:100%;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='8' viewBox='0 0 120 8'%3E%3Cpath d='M0 4 L40 4 L46 1 L52 7 L58 4 L120 4' fill='none' stroke='%230F766E' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='0.35'/%3E%3C/svg%3E");
  background-repeat:repeat-x;background-size:120px 8px;background-position:center;
  background-color:var(--color-border-subtle);
}

/* One quiet settle on page load (opacity + 4 px), not a parade of fade-ups: fast, tightly staggered,
   capped at 200 ms so the page feels ready, never "animating in". */
@keyframes hsa-reveal{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:translateY(0);}}
.reveal{animation:hsa-reveal 320ms var(--ease-decelerate) both;}
.reveal[data-reveal-index]{animation-delay:min(calc(var(--reveal-i,0) * 24ms), 200ms);}
.reveal-group>*{animation:hsa-reveal 320ms var(--ease-decelerate) both;}
.reveal-group>*:nth-child(1){animation-delay:24ms;} .reveal-group>*:nth-child(2){animation-delay:48ms;}
.reveal-group>*:nth-child(3){animation-delay:72ms;} .reveal-group>*:nth-child(4){animation-delay:96ms;}
.reveal-group>*:nth-child(5){animation-delay:120ms;} .reveal-group>*:nth-child(6){animation-delay:144ms;}
.reveal-group>*:nth-child(7){animation-delay:168ms;} .reveal-group>*:nth-child(n+8){animation-delay:200ms;}

.hover-lift{transition:transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard);}
.hover-lift:hover{transform:translateY(-2px);box-shadow:var(--shadow-elevation-3);}

.divider{border-top:1px solid var(--color-border-subtle);}

/* ---- section rhythm & surfaces for public pages ---- */
.band{padding-block:clamp(56px, 8vw, 112px);}
.band--tight{padding-block:clamp(40px, 5vw, 72px);}
.surface-tint{background:var(--color-brand-primary-subtle);}
.surface-sunken{background:var(--color-surface-sunken);}
/* deep teal as material: a full-bleed block with the pulse motif drawn faintly across it */
.surface-teal{
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(71,225,213,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(21,153,142,.28), transparent 60%),
    linear-gradient(160deg, var(--brand-900), var(--brand-950));
  color:var(--neutral-0);position:relative;isolation:isolate;
}
.surface-teal::after{
  content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:.10;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='80' viewBox='0 0 240 80'%3E%3Cpath d='M0 40 L80 40 L92 22 L104 58 L116 40 L240 40' fill='none' stroke='%2347e1d5' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size:240px 80px;background-repeat:repeat;
}
.surface-teal .display-1,.surface-teal .display-2,.surface-teal .display-3,.surface-teal .display-4,.surface-teal .lede{color:inherit;}
.surface-teal .lede{color:rgba(255,255,255,.78);}
.section-head{display:flex;flex-direction:column;gap:12px;margin-bottom:clamp(28px, 4vw, 48px);max-width:720px;}
.section-head .lede{margin:0;}

/* empty-state / loading glyph — the symbol, per contract §1 */
.hsa-symbol{color:var(--color-brand-primary);}

/* ============================================================================
   6. BUTTONS — RootSoft BUTTON STANDARD
   ============================================================================ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:var(--button-gap);
  min-height:var(--button-height-md);padding:0 16px;border-radius:var(--button-radius);
  font-family:var(--font-ui);font-size:var(--text-sm);font-weight:var(--weight-semibold);line-height:1;white-space:nowrap;letter-spacing:-0.005em;
  border:1px solid transparent;background:var(--color-surface-paper);color:var(--color-ink-primary);
  transition:transform var(--button-press-duration) var(--ease-standard), background var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
  user-select:none;position:relative;
}
.btn svg{width:18px;height:18px;flex:none;}
.btn:active{transform:scale(var(--button-press-scale));}
.btn:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}

.btn--primary{background:var(--color-brand-primary);color:var(--color-brand-on-primary);border-color:var(--color-brand-primary);box-shadow:inset 0 1px 0 rgba(255,255,255,.14), var(--shadow-elevation-1);}
.btn--primary:hover{background:var(--color-brand-primary-hover);border-color:var(--color-brand-primary-hover);box-shadow:inset 0 1px 0 rgba(255,255,255,.14), var(--shadow-elevation-2);}
.btn--primary:active{background:var(--color-brand-primary-active);}

.btn--secondary{background:var(--color-surface-paper);color:var(--color-ink-primary);border-color:var(--color-border-default);box-shadow:var(--shadow-elevation-1);}
.btn--secondary:hover{background:var(--color-surface-sunken);border-color:var(--color-border-strong);}
.btn--secondary svg{color:var(--color-brand-primary);}

.btn--ghost{background:transparent;color:var(--color-ink-secondary);border-color:transparent;}
.btn--ghost:hover{background:var(--color-surface-sunken);border-color:var(--color-border-subtle);}

.btn--accent{background:var(--color-accent);color:var(--color-on-accent);border-color:var(--color-accent);box-shadow:var(--shadow-elevation-1);}
.btn--accent:hover{background:var(--color-accent-hover);box-shadow:var(--shadow-elevation-2);}
.btn--accent:active{background:var(--color-accent-active);}

/* on deep-teal surfaces (.surface-teal): paper button with teal ink, and a hairline ghost */
.btn--inverse{background:var(--neutral-0);color:var(--brand-800);border-color:var(--neutral-0);box-shadow:var(--shadow-elevation-2);}
.btn--inverse:hover{background:var(--brand-50);border-color:var(--brand-50);}
.btn--ghost-inverse{background:rgba(255,255,255,.06);color:#fff;border-color:rgba(255,255,255,.34);}
.btn--ghost-inverse:hover{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.6);}

.btn--danger{background:var(--color-danger-solid);color:#fff;border-color:var(--color-danger-solid);box-shadow:var(--shadow-elevation-1);}
.btn--danger:hover{filter:brightness(.92);box-shadow:var(--shadow-elevation-2);}

.btn--link{background:transparent;border-color:transparent;color:var(--color-brand-primary);text-decoration:underline;text-underline-offset:3px;padding-inline:4px;min-height:var(--button-height-md);}
.btn--link:hover{color:var(--color-brand-primary-hover);}

.btn--lg{min-height:var(--button-height-lg);padding:0 22px;font-size:var(--text-base);}
.btn--compact{min-height:var(--button-height-sm);padding:0 12px;font-size:13px;}
.btn--sm{min-height:var(--button-height-sm);padding:0 12px;font-size:13px;}

.btn--icon{padding:0;width:44px;min-width:44px;}
.btn--icon.btn--lg{width:48px;min-width:48px;}
.btn--block{width:100%;}

.btn--busy{color:transparent!important;pointer-events:none;}
.btn--busy::after{
  content:'';position:absolute;width:18px;height:18px;left:50%;top:50%;margin:-9px 0 0 -9px;
  border-radius:50%;border:2.5px solid rgba(255,255,255,.5);border-top-color:#fff;animation:hsa-spin .7s linear infinite;
}
.btn--secondary.btn--busy::after,.btn--ghost.btn--busy::after,.btn--link.btn--busy::after{border-color:var(--color-brand-primary-subtle);border-top-color:var(--color-brand-primary);}
@keyframes hsa-spin{to{transform:rotate(360deg);}}

.btn[disabled]{opacity:.6;}

.btn-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;}
.btn-row--end{justify-content:flex-end;}
.btn-row--between{justify-content:space-between;}

/* ============================================================================
   7. FORMS — RootSoft NUMBER FIELD STANDARD
   ============================================================================ */
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:var(--space-4);}
.field__label{font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-secondary);}
.field__label .req{color:var(--color-danger-text);margin-left:2px;}
.field__control{position:relative;}
.hint{font-size:var(--text-xs);color:var(--color-ink-muted);}
.error{font-size:var(--text-xs);color:var(--color-danger-text);font-weight:var(--weight-medium);display:flex;align-items:center;gap:4px;}
.error svg{width:14px;height:14px;flex:none;}
.field.has-error .input,.field.has-error .select,.field.has-error .textarea{border-color:var(--color-danger-solid);background:var(--color-danger-subtle);}

.input,.select,.textarea{
  width:100%;min-height:var(--input-height);padding:0 14px;border:var(--input-border-width) solid var(--color-border-input);border-radius:var(--input-radius);
  background:var(--color-surface-paper);color:var(--color-ink-primary);font-size:var(--text-base);
  transition:border-color var(--duration-base), box-shadow var(--duration-base), background var(--duration-base);
}
.textarea{min-height:96px;padding:10px 14px;resize:vertical;line-height:var(--leading-base);}
.input::placeholder,.textarea::placeholder{color:var(--color-ink-muted);opacity:.85;}
.input:hover,.select:hover,.textarea:hover{border-color:var(--color-border-strong);}
.input:focus,.select:focus,.textarea:focus{border-color:var(--color-brand-primary);box-shadow:0 0 0 3px var(--color-brand-primary-subtle);}
.input[disabled],.select[disabled],.textarea[disabled]{background:var(--color-surface-sunken);color:var(--color-ink-disabled);cursor:not-allowed;}
.select{appearance:none;padding-right:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%235f7775' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;background-size:16px;
}

/* NUMBER FIELD STANDARD: hide native spinners — JS (HSA.guardNumberInputs) handles the wheel/arrow guard */
input[type=number]{appearance:textfield;-moz-appearance:textfield;}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0;}

.input-group{display:flex;align-items:stretch;min-height:var(--input-height);border:1px solid var(--color-border-input);border-radius:var(--input-radius);overflow:hidden;background:var(--color-surface-paper);transition:border-color var(--duration-base), box-shadow var(--duration-base);}
.input-group:focus-within{border-color:var(--color-brand-primary);box-shadow:0 0 0 3px var(--color-brand-primary-subtle);}
.input-group .input{border:none;min-height:42px;box-shadow:none!important;}
.input-group .input:focus{box-shadow:none;}
.input-group__unit{display:flex;align-items:center;padding:0 12px;background:var(--color-surface-sunken);color:var(--color-ink-muted);font-size:var(--text-sm);font-weight:var(--weight-semibold);white-space:nowrap;border-left:1px solid var(--color-border-subtle);}
.input-group__unit:first-child{border-left:none;border-right:1px solid var(--color-border-subtle);}

.check,.radio{display:inline-flex;align-items:center;gap:10px;min-height:44px;cursor:pointer;font-size:var(--text-sm);}
.check input,.radio input{appearance:none;width:20px;height:20px;flex:none;border:1.5px solid var(--color-border-input);background:var(--color-surface-paper);position:relative;cursor:pointer;transition:border-color var(--duration-base), background var(--duration-base);}
.check input{border-radius:5px;}
.radio input{border-radius:50%;}
.check input:checked,.radio input:checked{border-color:var(--color-brand-primary);background:var(--color-brand-primary);}
.check input:checked::after{content:'';position:absolute;left:5px;top:1px;width:6px;height:11px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);}
.radio input:checked::after{content:'';position:absolute;inset:5px;border-radius:50%;background:#fff;}
.check input:focus-visible,.radio input:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}

.switch{display:inline-flex;align-items:center;gap:10px;min-height:44px;cursor:pointer;font-size:var(--text-sm);}
.switch input{appearance:none;width:42px;height:24px;border-radius:var(--radius-full);background:var(--color-border-strong);position:relative;cursor:pointer;transition:background var(--duration-base);flex:none;}
.switch input::after{content:'';position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:var(--shadow-elevation-1);transition:transform var(--duration-base);}
.switch input:checked{background:var(--color-brand-primary);}
.switch input:checked::after{transform:translateX(18px);}
.switch input:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}

.file-drop{border:2px dashed var(--color-border-input);border-radius:var(--radius-md);padding:28px 16px;text-align:center;background:var(--color-surface-sunken);cursor:pointer;transition:border-color var(--duration-base), background var(--duration-base);}
.file-drop:hover,.file-drop--active{border-color:var(--color-brand-primary);background:var(--color-brand-primary-subtle);}
.file-drop svg{width:32px;height:32px;margin:0 auto 8px;color:var(--color-brand-primary);}
.file-drop__title{font-weight:var(--weight-semibold);color:var(--color-ink-primary);}
.file-drop__hint{font-size:var(--text-xs);color:var(--color-ink-muted);margin-top:2px;}
.file-list{display:flex;flex-direction:column;gap:8px;margin-top:12px;}
.file-item{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--color-border-subtle);border-radius:var(--radius-sm);background:var(--color-surface-paper);font-size:var(--text-sm);}
.file-item svg{width:18px;height:18px;color:var(--color-brand-primary);flex:none;}
.file-item__name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.file-item__size{color:var(--color-ink-muted);font-size:var(--text-xs);flex:none;}
.file-item__remove{flex:none;width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:var(--color-danger-text);transition:transform var(--button-press-duration) var(--ease-standard), background var(--duration-base);}
.file-item__remove:hover{background:var(--color-danger-subtle);}
.file-item__remove:active{transform:scale(var(--button-press-scale));}
.file-item__remove:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}

fieldset.field-group{border:1px solid var(--color-border-subtle);border-radius:var(--radius-md);padding:16px;margin-bottom:var(--space-4);}
fieldset.field-group legend{font-weight:var(--weight-semibold);padding:0 6px;color:var(--color-brand-primary);}

/* .otp — six-box code entry */
.otp{display:flex;gap:8px;}
.otp input{width:44px;min-height:52px;text-align:center;font-size:var(--text-xl);font-weight:var(--weight-bold);font-variant-numeric:tabular-nums;border:1px solid var(--color-border-input);border-radius:var(--radius-md);background:var(--color-surface-paper);color:var(--color-ink-primary);transition:border-color var(--duration-base), box-shadow var(--duration-base);}
.otp input:focus{border-color:var(--color-brand-primary);box-shadow:0 0 0 3px var(--color-brand-primary-subtle);}

/* .chips-input — one-tap chip groups (Rx builder exam findings, advice, follow-up) */
.chips-input{display:flex;flex-wrap:wrap;gap:8px;}
.chips-input .chip-opt{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px;border-radius:var(--radius-full);border:1px solid var(--color-border-input);background:var(--color-surface-paper);color:var(--color-ink-secondary);font-size:var(--text-sm);font-weight:var(--weight-medium);cursor:pointer;transition:background var(--duration-base), border-color var(--duration-base), color var(--duration-base), transform var(--button-press-duration);}
.chips-input .chip-opt:active{transform:scale(.97);}
.chips-input .chip-opt svg{width:15px;height:15px;}
.chips-input .chip-opt:hover{border-color:var(--color-brand-primary);}
.chips-input .chip-opt.is-selected{background:var(--color-brand-primary);border-color:var(--color-brand-primary);color:var(--color-brand-on-primary);}
.chips-input .chip-opt:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}
/* .chip-opt__x — the remove control on a SELECTED chip. It must take its ink from the chip,
   not from .btn--ghost: ghost resolves to --color-ink-secondary, which on the teal selected
   chip is a ~1.3:1 slate-on-teal smudge (reported by Sayem, 20 Sep 2026 — the × looked missing
   on every selected diagnosis and investigation). 26 px visually, 44 px of hit area via ::after,
   so it still meets the RootSoft button standard inside a 44 px chip. */
.chips-input .chip-opt.is-selected .btn,.chip-opt__x{color:var(--color-brand-on-primary);border-color:transparent;background:transparent;}
.chip-opt__x{position:relative;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;min-width:26px;min-height:26px;padding:0;margin-left:2px;border-radius:50%;opacity:.75;cursor:pointer;transition:background var(--duration-base),opacity var(--duration-base);}
.chip-opt__x::after{content:'';position:absolute;inset:-9px;}
.chip-opt__x svg{width:13px;height:13px;}
.chips-input .chip-opt.is-selected .btn:hover,.chip-opt__x:hover{background:rgba(255,255,255,.22);border-color:transparent;opacity:1;}
.chip-opt__x:focus-visible{outline:2px solid var(--color-brand-on-primary);outline-offset:1px;opacity:1;}

/* .search-select — type-ahead list (medicines, ICD-10, patients) */
.search-select{position:relative;}
.search-select__input{width:100%;}
.search-select__panel{position:absolute;top:calc(100% + 4px);left:0;right:0;max-height:280px;overflow-y:auto;background:var(--color-surface-paper);border:1px solid var(--color-border-default);border-radius:var(--radius-md);box-shadow:var(--shadow-elevation-3);z-index:60;}
.search-select__opt{display:flex;flex-direction:column;gap:1px;width:100%;text-align:left;padding:10px 14px;min-height:44px;justify-content:center;border-bottom:1px solid var(--color-border-subtle);}
.search-select__opt:last-child{border-bottom:none;}
.search-select__opt:hover,.search-select__opt.is-active{background:var(--color-brand-primary-subtle);}
.search-select__opt-title{font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-primary);}
.search-select__opt-sub{font-size:var(--text-2xs);color:var(--color-ink-muted);}

/* ============================================================================
   8. LAYOUT SHELLS
   ============================================================================ */

/* ---------- Public shell ---------- */
.shell-public{min-height:100%;display:flex;flex-direction:column;}
/* glass header: paper at 78 % over whatever scrolls beneath, hairline below, pulse-rule kept as the signature */
.pub-header{background:color-mix(in srgb, var(--color-surface-paper) 80%, transparent);-webkit-backdrop-filter:blur(14px) saturate(1.4);backdrop-filter:blur(14px) saturate(1.4);position:sticky;top:0;z-index:40;}
@supports not (background:color-mix(in srgb, #fff 80%, transparent)){.pub-header{background:var(--color-surface-paper);}}
.pub-header__bar{display:flex;align-items:center;gap:16px;min-height:68px;padding-block:8px;}
.pub-header__brand{display:flex;align-items:center;gap:10px;flex:none;}
.pub-header__brand img{width:30px;height:30px;flex:none;}
.pub-header__wordmark{font-family:var(--font-display);font-size:19px;font-weight:600;color:var(--color-ink-primary);letter-spacing:-.025em;}
.pub-header__wordmark b{color:var(--color-brand-primary);font-weight:600;}
.pub-nav{display:flex;align-items:center;gap:2px;margin-left:12px;flex:1;flex-wrap:nowrap;min-width:0;}
.pub-nav a{display:inline-flex;align-items:center;min-height:40px;padding:0 12px;border-radius:var(--radius-full);font-size:var(--text-sm);font-weight:var(--weight-medium);color:var(--color-ink-secondary);white-space:nowrap;transition:background var(--duration-base), color var(--duration-base);}
.pub-nav a:hover{background:var(--color-surface-sunken);color:var(--color-ink-primary);}
.pub-nav a.is-active{color:var(--color-brand-primary);background:var(--color-brand-primary-subtle);font-weight:var(--weight-semibold);}
.pub-header__actions{display:flex;align-items:center;gap:10px;flex:none;margin-left:auto;}
.pub-header__toggle{display:none;}
.shell-public .pulse-rule{flex:none;}
.shell-public main{flex:1;}

.pub-drawer{position:fixed;inset:0;z-index:80;display:none;}
.pub-drawer.is-open{display:block;}
.pub-drawer__scrim{position:absolute;inset:0;background:var(--color-surface-overlay);}
.pub-drawer__panel{position:absolute;top:0;left:0;bottom:0;width:82%;max-width:320px;background:var(--color-surface-paper);box-shadow:var(--shadow-elevation-4);padding:var(--space-5);overflow-y:auto;display:flex;flex-direction:column;gap:4px;}
.pub-drawer__panel a{display:flex;align-items:center;gap:10px;min-height:48px;padding:0 12px;border-radius:var(--radius-md);font-weight:var(--weight-semibold);color:var(--color-ink-secondary);}
.pub-drawer__panel a:hover,.pub-drawer__panel a.is-active{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);}
.pub-drawer__panel a svg{width:20px;height:20px;}

.pub-hero{padding-block:56px;position:relative;overflow:hidden;}
.pub-hero__inner{position:relative;z-index:1;max-width:720px;}

.pub-footer{background:var(--neutral-950);color:var(--neutral-200);margin-top:auto;position:relative;overflow:hidden;}
.pub-footer .container{padding-block:56px 24px;position:relative;z-index:1;}
.pub-footer__grid{display:grid;grid-template-columns:1.3fr 1fr 1fr 1fr;gap:32px;}
.pub-footer h4{font-family:var(--font-display);font-size:15px;font-weight:600;color:#fff;margin-bottom:14px;letter-spacing:-.01em;}
/* the quiet giant wordmark — 6 % teal, cropped by the footer's bottom edge */
.pub-footer__mark{position:absolute;left:50%;bottom:-0.28em;transform:translateX(-50%);font-family:var(--font-display);font-weight:600;font-size:clamp(96px, 18vw, 280px);line-height:1;letter-spacing:-.05em;color:var(--brand-400);opacity:.07;white-space:nowrap;pointer-events:none;user-select:none;z-index:0;}
.pub-footer p{font-size:var(--text-sm);color:var(--neutral-300);line-height:var(--leading-base);}
.pub-footer ul{display:flex;flex-direction:column;gap:8px;}
.pub-footer a{font-size:var(--text-sm);color:var(--neutral-300);}
.pub-footer a:hover{color:#fff;text-decoration:underline;}
.pub-footer__bottom{border-top:1px solid rgba(255,255,255,.12);margin-top:28px;padding-top:18px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;font-size:var(--text-xs);color:var(--neutral-300);}
.pub-footer__made{text-align:center;padding:10px 0;background:var(--neutral-900);font-size:var(--text-xs);color:var(--neutral-300);}

/* ---------- Portal shell (patient / doctor / hospital / lab / pharmacy / admin) ---------- */
.shell-portal{min-height:100%;display:grid;grid-template-columns:var(--sidebar-w) 1fr;grid-template-rows:100%;}

.sidebar{grid-column:1;background:var(--color-surface-paper);border-right:1px solid var(--color-border-subtle);color:var(--color-ink-primary);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto;z-index:50;}
:root[data-theme="dark"] .sidebar{background:var(--color-surface-sunken);}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .sidebar{background:var(--color-surface-sunken);}}
.sidebar__head{display:flex;align-items:center;gap:10px;padding:16px 18px 14px;border-bottom:1px solid var(--color-border-subtle);}
.sidebar__head img{width:28px;height:28px;flex:none;}
.sidebar__app{font-family:var(--font-display);font-weight:600;font-size:15px;letter-spacing:-.015em;color:var(--color-ink-primary);line-height:1.25;}
.sidebar__app small{display:block;font-family:var(--font-ui);font-weight:400;font-size:11px;color:var(--color-ink-muted);}
.sidebar__user{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--color-border-subtle);}
.sidebar__user-name{font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-primary);line-height:1.3;}
.sidebar__user-role{font-size:11px;color:var(--color-ink-muted);display:flex;align-items:center;gap:6px;}
.sidebar__role-badge{display:inline-flex;align-items:center;padding:1px 8px;border-radius:var(--radius-full);background:var(--color-accent-subtle);color:var(--color-accent);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;}
.sidebar__nav{flex:1;padding:10px 10px;display:flex;flex-direction:column;gap:2px;}
.sidebar__group{font-size:12px;font-weight:var(--weight-medium);letter-spacing:0;text-transform:none;color:var(--color-ink-muted);padding:16px 10px 6px;}
.sidebar__link{display:flex;align-items:center;gap:12px;min-height:44px;padding:0 10px;border-radius:var(--radius-md);font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-secondary);position:relative;transition:background var(--duration-base), color var(--duration-base);}
.sidebar__link svg{width:19px;height:19px;flex:none;color:var(--color-ink-muted);}
.sidebar__link:hover{background:var(--color-surface-sunken);color:var(--color-ink-primary);}
.sidebar__link.is-active{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);}
.sidebar__link.is-active svg{color:var(--color-brand-primary);}
.sidebar__link.is-active::before{content:'';position:absolute;left:-10px;top:6px;bottom:6px;width:3px;border-radius:var(--radius-full);background:var(--color-brand-primary);}
.sidebar__link--primary{background:var(--color-accent);color:var(--color-on-accent);margin-bottom:6px;}
.sidebar__link--primary svg{color:var(--color-on-accent);}
.sidebar__link--primary:hover{background:var(--color-accent-hover);color:var(--color-on-accent);}
.sidebar__link .badge{margin-left:auto;}
.sidebar__wallets{display:flex;flex-direction:column;gap:6px;padding:12px 14px;margin:6px 10px;border-radius:var(--radius-md);background:var(--color-surface-sunken);}
.sidebar__wallet{display:flex;align-items:center;justify-content:space-between;font-size:12px;}
.sidebar__wallet-label{display:flex;align-items:center;gap:6px;color:var(--color-ink-muted);}
.sidebar__wallet-label svg{width:14px;height:14px;}
.sidebar__wallet-value{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-weight:700;color:var(--color-ink-primary);}
.sidebar__logout{padding:10px 12px 4px;margin-top:auto;}
.sidebar__logout-btn.btn{color:var(--color-ink-secondary);border-color:var(--color-border-default);background:transparent;justify-content:flex-start;}
.sidebar__logout-btn.btn:hover{background:var(--color-surface-sunken);}
.sidebar__foot{padding:12px 18px;border-top:1px solid var(--color-border-subtle);font-size:11px;color:var(--color-ink-muted);}

.sidebar-scrim{position:fixed;inset:0;background:var(--color-surface-overlay);z-index:49;display:none;}
.sidebar-scrim.is-open{display:block;}

.portal-main{grid-column:2;display:flex;flex-direction:column;min-width:0;min-height:100vh;}
.topbar{background:var(--color-surface-paper);position:sticky;top:0;z-index:30;}
.topbar__bar{display:flex;align-items:center;gap:14px;min-height:var(--topbar-h);padding-inline:var(--gutter);}
.topbar__menu-btn{display:none;}
.topbar__titles{display:flex;flex-direction:column;line-height:1.25;min-width:0;}
.topbar__title{font-family:var(--font-display);font-weight:600;font-size:18px;letter-spacing:-.02em;color:var(--color-ink-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;}
.topbar__search{flex:1;max-width:360px;position:relative;display:none;}
.topbar__search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:17px;height:17px;color:var(--color-ink-muted);}
.topbar__search input{padding-left:36px;background:var(--color-surface-sunken);border-color:transparent;border-radius:var(--radius-full);}
.topbar__actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex:none;}
.topbar__icon-btn{position:relative;}
.topbar__badge{position:absolute;top:4px;right:4px;min-width:16px;height:16px;padding:0 3px;border-radius:var(--radius-full);background:var(--color-danger-solid);color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1;}

.portal-content{flex:1;padding:var(--space-5) var(--gutter) 48px;max-width:var(--content-max);width:100%;margin-inline:auto;}

.bottom-tab-bar{display:none;position:fixed;left:0;right:0;bottom:0;height:var(--bottom-tabs-h);background:var(--color-surface-paper);border-top:1px solid var(--color-border-subtle);z-index:45;box-shadow:0 -4px 14px rgba(14,24,23,.08);}
.bottom-tab-bar__inner{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;height:100%;}
.bottom-tab-bar a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:var(--color-ink-muted);font-size:10px;font-weight:600;min-height:44px;}
.bottom-tab-bar a svg{width:21px;height:21px;}
.bottom-tab-bar a.is-active{color:var(--color-brand-primary);}

/* user menu / notifications dropdown */
.menu-pop{position:absolute;top:calc(100% + 8px);right:0;min-width:220px;background:var(--color-surface-paper);border:1px solid var(--color-border-default);border-radius:var(--radius-md);box-shadow:var(--shadow-elevation-4);z-index:60;overflow:hidden;display:none;}
.menu-pop.is-open{display:block;}
.menu-pop__head{padding:14px 16px;border-bottom:1px solid var(--color-border-subtle);}
.menu-pop__name{font-weight:700;font-size:var(--text-sm);}
.menu-pop__role{font-size:var(--text-xs);color:var(--color-ink-muted);}
.menu-pop a,.menu-pop button{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:0 16px;font-size:var(--text-sm);color:var(--color-ink-secondary);text-align:left;}
.menu-pop a:hover,.menu-pop button:hover{background:var(--color-surface-sunken);}
.menu-pop a svg,.menu-pop button svg{width:17px;height:17px;color:var(--color-ink-muted);}
.menu-pop--wide{min-width:320px;max-height:420px;overflow-y:auto;}
.notif-item{display:flex;gap:10px;padding:12px 16px;border-bottom:1px solid var(--color-border-subtle);align-items:flex-start;}
.notif-item:last-child{border-bottom:none;}
.notif-item__dot{width:8px;height:8px;border-radius:50%;background:var(--color-brand-primary);margin-top:6px;flex:none;}
.notif-item.is-read .notif-item__dot{background:var(--color-border-default);}
.notif-item__title{font-size:var(--text-sm);font-weight:var(--weight-semibold);}
.notif-item__time{font-size:11px;color:var(--color-ink-muted);}

/* ============================================================================
   9. COMPONENTS
   ============================================================================ */

/* ---------- card ---------- */
/* cards hold repeatable records; a hairline and the faintest shadow, never a floating slab */
.card{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);box-shadow:var(--shadow-elevation-1);overflow:hidden;}
.card__head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--color-border-subtle);}
.card__title{font-family:var(--font-ui);font-weight:600;font-size:15px;letter-spacing:-.01em;flex:1;min-width:0;}
.card--flat{border-color:transparent;box-shadow:none;background:var(--color-surface-sunken);}
.card--outline{box-shadow:none;}
.card__subtitle{font-size:var(--text-xs);color:var(--color-ink-muted);margin-top:2px;}
.card__actions{display:flex;gap:8px;flex:none;}
.card__body{padding:20px;}
.card__body--flush{padding:0;}
.card__foot{padding:14px 20px;border-top:1px solid var(--color-border-subtle);background:var(--color-surface-sunken);display:flex;justify-content:flex-end;gap:10px;}
.card--pad-sm .card__body{padding:14px;}
.card--interactive{cursor:pointer;transition:box-shadow var(--duration-base), transform var(--duration-base);}
.card--interactive:hover{box-shadow:var(--shadow-elevation-3);transform:translateY(-2px);}

/* ---------- stat ---------- */
.stat{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);padding:16px 18px;box-shadow:var(--shadow-elevation-1);display:flex;flex-direction:column;gap:8px;}
.stat__label{font-size:var(--text-xs);font-weight:var(--weight-medium);color:var(--color-ink-muted);display:flex;align-items:center;gap:6px;}
.stat__label svg{width:15px;height:15px;color:var(--color-brand-primary);}
.stat__value{font-family:var(--font-display);font-variant-numeric:tabular-nums;font-size:32px;font-weight:var(--weight-semibold);color:var(--color-ink-primary);line-height:1;letter-spacing:-.03em;}
.stat__row{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;}
.stat__delta{display:inline-flex;align-items:center;gap:3px;font-size:var(--text-xs);font-weight:700;padding:2px 7px;border-radius:var(--radius-full);}
.stat__delta svg{width:12px;height:12px;}
.stat__delta--up{background:var(--color-success-subtle);color:var(--color-success-text);}
.stat__delta--down{background:var(--color-danger-subtle);color:var(--color-danger-text);}
.stat__spark{margin-top:4px;}

/* ---------- grid ---------- */
.grid{display:grid;gap:var(--space-5);}
.grid--2{grid-template-columns:repeat(2,1fr);}
.grid--3{grid-template-columns:repeat(3,1fr);}
.grid--4{grid-template-columns:repeat(4,1fr);}
.grid--auto{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));}

/* ---------- badge ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:var(--radius-full);font-size:11px;font-weight:700;letter-spacing:.02em;background:var(--color-surface-sunken);color:var(--color-ink-secondary);white-space:nowrap;}
.badge svg{width:12px;height:12px;}
.badge--brand{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);}
.badge--accent{background:var(--color-accent-subtle);color:var(--color-accent);}
.badge--success{background:var(--color-success-subtle);color:var(--color-success-text);}
.badge--danger{background:var(--color-danger-subtle);color:var(--color-danger-text);}
.badge--warning{background:var(--color-warning-subtle);color:var(--color-warning-text);}
.badge--info{background:var(--color-info-subtle);color:var(--color-info-text);}
.badge--outline{background:transparent;border:1px solid var(--color-border-default);color:var(--color-ink-secondary);}
.badge--phase{background:var(--color-surface-sunken);color:var(--color-ink-muted);border:1px dashed var(--color-border-strong);}

/* ---------- chip (status) — the ONLY allowed status colours, per contract §3 ---------- */
.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:var(--radius-full);font-size:13px;font-weight:600;white-space:nowrap;line-height:1.3;}
.chip svg{width:14px;height:14px;flex:none;}
.chip::before{content:'';width:7px;height:7px;border-radius:50%;background:currentColor;flex:none;}
.chip--icon-only::before{display:none;}
/* neutral */
.chip--draft,.chip--scheduled,.chip--trial,.chip--pending,.chip--not_started,.chip--archived,.chip--closed,.chip--planned{background:var(--color-surface-sunken);color:var(--color-ink-secondary);}
/* info */
.chip--cleaning,.chip--booked,.chip--ordered,.chip--placed,.chip--submitted,.chip--needs_info,.chip--in_review,.chip--sample_collected,.chip--packed,.chip--shared,.chip--uploaded{background:var(--color-info-subtle);color:var(--color-info-text);}
/* warning */
.chip--occupied,.chip--monitoring,.chip--waiting,.chip--in_progress,.chip--in_room,.chip--past_due,.chip--out_for_delivery,.chip--on_hold,.chip--awaiting_payment,.chip--overdue,.chip--admitted,.chip--open{background:var(--color-warning-subtle);color:var(--color-warning-text);}
/* success */
.chip--vacant,.chip--resolved,.chip--verified,.chip--active,.chip--completed,.chip--done,.chip--finalised,.chip--dispensed,.chip--delivered,.chip--resulted,.chip--reviewed,.chip--paid,.chip--granted,.chip--sponsored,.chip--confirmed,.chip--checked_in,.chip--documented,.chip--published,.chip--approved,.chip--discharged,.chip--fulfilled,.chip--live{background:var(--color-success-subtle);color:var(--color-success-text);}
/* danger */
.chip--rejected,.chip--suspended,.chip--cancelled,.chip--no_show,.chip--failed,.chip--revoked,.chip--expired,.chip--returned,.chip--refunded,.chip--skipped{background:var(--color-danger-subtle);color:var(--color-danger-text);}

/* clinical status chips — separate namespace, ALWAYS icon + label (contract §3, brand guideline §4.3) */
.chip--clinical{font-weight:700;}
.chip--clinical::before{display:none;}
.chip--clinical-normal{background:var(--color-clinical-normal-subtle);color:var(--color-clinical-normal-text);}
.chip--clinical-borderline{background:var(--color-clinical-borderline-subtle);color:var(--color-clinical-borderline-text);}
.chip--clinical-abnormal{background:var(--color-clinical-abnormal-subtle);color:var(--color-clinical-abnormal-text);}
.chip--clinical-critical{background:var(--color-clinical-critical-subtle);color:var(--color-clinical-critical-text);}

/* ---------- tabs ---------- */
.tabs{display:flex;align-items:center;gap:4px;border-bottom:1px solid var(--color-border-subtle);overflow-x:auto;}
.tabs [role=tab]{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-muted);border-bottom:2.5px solid transparent;white-space:nowrap;transition:color var(--duration-base), border-color var(--duration-base);background:transparent;}
.tabs [role=tab] svg{width:16px;height:16px;}
.tabs [role=tab]:hover{color:var(--color-ink-primary);}
.tabs [role=tab][aria-selected=true]{color:var(--color-brand-primary);border-bottom-color:var(--color-brand-primary);}
.tab-panel{padding-top:18px;}
.tab-panel[hidden]{display:none;}

/* ---------- stepper ---------- */
.stepper{display:flex;align-items:flex-start;}
.stepper__summary{display:none;}
.stepper__step{display:flex;align-items:center;flex:1;min-width:0;}
.stepper__step:last-child{flex:none;}
.stepper__bubble{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex:none;background:var(--color-surface-sunken);color:var(--color-ink-muted);border:2px solid var(--color-surface-sunken);}
.stepper__label{margin-left:10px;font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-muted);white-space:nowrap;}
.stepper__line{flex:1;height:2px;background:var(--color-border-subtle);margin:0 10px;min-width:16px;}
.stepper__step--done .stepper__bubble{background:var(--color-brand-primary);border-color:var(--color-brand-primary);color:var(--color-brand-on-primary);}
.stepper__step--done .stepper__label{color:var(--color-ink-primary);}
.stepper__step--done .stepper__line{background:var(--color-brand-primary-border);}
.stepper__step--current .stepper__bubble{background:var(--color-surface-paper);border-color:var(--color-accent);color:var(--color-accent);box-shadow:0 0 0 4px var(--color-accent-subtle);}
.stepper__step--current .stepper__label{color:var(--color-ink-primary);font-weight:700;}

/* ---------- timeline ---------- */
.timeline{display:flex;flex-direction:column;}
.timeline__item{display:flex;gap:14px;padding-bottom:22px;position:relative;}
.timeline__item::before{content:'';position:absolute;left:9px;top:22px;bottom:0;width:2px;background:var(--color-border-subtle);}
.timeline__item:last-child::before{display:none;}
.timeline__dot{width:20px;height:20px;border-radius:50%;background:var(--color-brand-primary-subtle);border:2px solid var(--color-brand-primary);flex:none;display:flex;align-items:center;justify-content:center;z-index:1;}
.timeline__dot svg{width:11px;height:11px;color:var(--color-brand-primary);}
.timeline__item--danger .timeline__dot{background:var(--color-danger-subtle);border-color:var(--color-danger-solid);}
.timeline__item--danger .timeline__dot svg{color:var(--color-danger-text);}
.timeline__item--accent .timeline__dot{background:var(--color-accent-subtle);border-color:var(--color-accent);}
.timeline__item--accent .timeline__dot svg{color:var(--color-accent);}
.timeline__item--muted .timeline__dot{background:var(--color-surface-sunken);border-color:var(--color-border-default);}
.timeline__item--muted .timeline__dot svg{color:var(--color-ink-muted);}
.timeline__body{flex:1;min-width:0;padding-top:1px;}
.timeline__head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;}
.timeline__actor{font-weight:700;font-size:var(--text-sm);}
.timeline__time{font-size:11px;color:var(--color-ink-muted);}
.timeline__note{font-size:var(--text-sm);color:var(--color-ink-secondary);margin-top:3px;}

/* ---------- table ---------- */
.table-wrap{width:100%;overflow-x:auto;border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);background:var(--color-surface-paper);}
.table{width:100%;font-size:var(--text-sm);}
.table thead th{position:sticky;top:0;background:var(--color-surface-sunken);text-align:left;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--color-ink-muted);padding:12px 16px;border-bottom:1px solid var(--color-border-subtle);white-space:nowrap;z-index:1;}
.table tbody td{padding:13px 16px;border-bottom:1px solid var(--color-border-subtle);vertical-align:middle;min-height:44px;font-variant-numeric:tabular-nums;}
.table tbody tr:last-child td{border-bottom:none;}
.table tbody tr:nth-child(even){background:var(--color-surface-sunken);}
.table tbody tr:hover{background:var(--color-brand-primary-subtle);}
.table tbody tr.is-link{cursor:pointer;}
.table tbody tr.is-link:hover{background:var(--color-brand-primary-subtle);}
.table tbody tr.is-link:focus-visible{outline:2px solid var(--color-brand-primary);outline-offset:-2px;}
.table__actions{display:flex;gap:6px;justify-content:flex-end;}
.table--compact td,.table--compact th{padding:9px 12px;}

/* ---------- toolbar ---------- */
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:14px 16px;background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);margin-bottom:var(--space-4);}
.toolbar__search{position:relative;flex:1;min-width:200px;max-width:320px;}
.toolbar__search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:17px;height:17px;color:var(--color-ink-muted);}
.toolbar__search input{padding-left:36px;}
.toolbar__spacer{flex:1;}
.toolbar__group{display:flex;gap:8px;flex-wrap:wrap;flex:1 1 auto;align-items:flex-end;}
.toolbar__group>.select,.toolbar__group>.input{width:auto;flex:1 1 160px;min-width:150px;max-width:240px;}
.filter-field{display:flex;flex-direction:column;gap:4px;flex:1 1 160px;min-width:150px;max-width:240px;}
.filter-field__label{font-size:var(--text-xs);font-weight:var(--weight-semibold);color:var(--color-ink-muted);letter-spacing:.01em;white-space:nowrap;}
.filter-field .select,.filter-field .input{width:100%;}
.toolbar__count{font-size:var(--text-sm);color:var(--color-ink-muted);white-space:nowrap;}

/* ---------- pagination ---------- */
.pagination{display:flex;align-items:center;justify-content:center;gap:6px;padding-top:16px;flex-wrap:wrap;}
.pagination button{min-width:44px;height:44px;padding:0 8px;border-radius:var(--radius-sm);font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-secondary);border:1px solid transparent;transition:transform var(--button-press-duration) var(--ease-standard), background var(--duration-base);}
.pagination button:active{transform:scale(var(--button-press-scale));}
.pagination button:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}
.pagination button:hover{background:var(--color-surface-sunken);}
.pagination button.is-active{background:var(--color-brand-primary);color:var(--color-brand-on-primary);}
.pagination button[disabled]{opacity:.4;cursor:not-allowed;}
.pagination__info{font-size:var(--text-xs);color:var(--color-ink-muted);margin-right:8px;}

/* ---------- empty state ---------- */
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;padding:56px 24px;color:var(--color-ink-muted);}
.empty svg{width:44px;height:44px;color:var(--color-brand-primary);opacity:.5;margin-bottom:14px;}
.empty__title{font-weight:700;color:var(--color-ink-primary);font-size:var(--text-base);margin-bottom:4px;}
.empty__text{font-size:var(--text-sm);max-width:360px;margin-bottom:18px;}

/* ---------- skeleton ---------- */
.skeleton{position:relative;overflow:hidden;background:var(--color-surface-sunken);border-radius:var(--radius-sm);}
.skeleton::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.4),transparent);animation:hsa-shimmer 1.4s infinite;}
:root[data-theme="dark"] .skeleton::after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.08),transparent);}
@keyframes hsa-shimmer{from{transform:translateX(-100%);}to{transform:translateX(100%);}}
.skeleton--text{height:14px;margin-bottom:8px;width:100%;}
.skeleton--title{height:22px;width:60%;margin-bottom:12px;}
.skeleton--avatar{width:40px;height:40px;border-radius:50%;}
.skeleton--block{height:120px;width:100%;border-radius:var(--radius-md);}

/* ---------- alert ---------- */
.alert{display:flex;gap:12px;padding:14px 16px;border-radius:var(--radius-md);border:1px solid transparent;font-size:var(--text-sm);align-items:flex-start;}
.alert svg{width:19px;height:19px;flex:none;margin-top:1px;}
.alert__title{font-weight:700;margin-bottom:2px;}
.alert--info{background:var(--color-info-subtle);color:var(--color-info-text);border-color:var(--color-info-solid);}
.alert--success{background:var(--color-success-subtle);color:var(--color-success-text);border-color:var(--color-success-solid);}
.alert--warning{background:var(--color-warning-subtle);color:var(--color-warning-text);border-color:var(--color-warning-solid);}
.alert--danger{background:var(--color-danger-subtle);color:var(--color-danger-text);border-color:var(--color-danger-solid);}

/* ---------- breadcrumb ---------- */
.breadcrumb{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:var(--text-xs);color:var(--color-ink-muted);}
.breadcrumb a{color:var(--color-ink-muted);font-weight:600;}
.breadcrumb a:hover{color:var(--color-brand-primary);text-decoration:underline;}
.breadcrumb__sep{width:13px;height:13px;color:var(--color-border-strong);}
.breadcrumb__current{color:var(--color-ink-primary);font-weight:700;}

/* ---------- avatar ---------- */
.avatar{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;background:var(--color-brand-primary);color:var(--color-brand-on-primary);font-weight:700;flex:none;font-size:14px;line-height:1;overflow:hidden;}
.avatar img{width:100%;height:100%;object-fit:cover;}
.avatar--sm{width:28px;height:28px;font-size:11px;}
.avatar--md{width:36px;height:36px;font-size:13px;}
.avatar--lg{width:52px;height:52px;font-size:18px;}
.avatar--accent{background:var(--color-accent);color:var(--color-on-accent);}
.avatar-group{display:flex;}
.avatar-group .avatar{border:2px solid var(--color-surface-paper);margin-left:-10px;}
.avatar-group .avatar:first-child{margin-left:0;}

/* ---------- kbd ---------- */
.kbd{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 6px;border-radius:5px;background:var(--color-surface-sunken);border:1px solid var(--color-border-default);border-bottom-width:2px;font-family:var(--font-mono);font-size:11px;font-weight:600;color:var(--color-ink-secondary);}

/* ---------- tooltip ---------- */
.tooltip{position:relative;display:inline-flex;}
.tooltip__bubble{position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);background:var(--neutral-950);color:#fff;font-size:11px;font-weight:600;padding:6px 10px;border-radius:var(--radius-sm);white-space:nowrap;opacity:0;pointer-events:none;transition:opacity var(--duration-base);z-index:70;}
.tooltip__bubble::after{content:'';position:absolute;top:100%;left:50%;transform:translateX(-50%);border:5px solid transparent;border-top-color:var(--neutral-950);}
.tooltip:hover .tooltip__bubble,.tooltip:focus-within .tooltip__bubble{opacity:1;}

/* ---------- progress ---------- */
.progress{width:100%;height:8px;border-radius:var(--radius-full);background:var(--color-border-subtle);overflow:hidden;}
.progress__bar{height:100%;background:var(--color-brand-primary);border-radius:var(--radius-full);transition:width var(--duration-base);}
.progress--accent .progress__bar{background:var(--color-accent);}
.progress--danger .progress__bar{background:var(--color-danger-solid);}
.progress-label{display:flex;justify-content:space-between;font-size:var(--text-xs);color:var(--color-ink-muted);margin-bottom:6px;}

/* ---------- kv (definition list) ---------- */
.kv{display:grid;grid-template-columns:200px 1fr;gap:10px 16px;}
.kv dt{font-size:var(--text-sm);color:var(--color-ink-muted);font-weight:var(--weight-semibold);}
.kv dd{font-size:var(--text-sm);color:var(--color-ink-primary);font-weight:var(--weight-medium);word-break:break-word;}
.kv--divided dt,.kv--divided dd{padding-bottom:10px;border-bottom:1px solid var(--color-border-subtle);}

/* ---------- phone frame ---------- */
.phone{width:var(--phone-w);height:var(--phone-h);max-width:100%;border-radius:44px;background:#0c0c0c;padding:14px;box-shadow:var(--shadow-elevation-4);position:relative;margin-inline:auto;}
.phone__screen{width:100%;height:100%;background:var(--color-surface-canvas);border-radius:32px;overflow:hidden;position:relative;display:flex;flex-direction:column;}
.phone__notch{position:absolute;top:0;left:50%;transform:translateX(-50%);width:120px;height:28px;background:#0c0c0c;border-radius:0 0 18px 18px;z-index:5;}
.phone__content{flex:1;overflow-y:auto;}
.phone__caption{text-align:center;margin-top:14px;font-size:var(--text-sm);color:var(--color-ink-muted);}
/* phone SCREEN — a complete app screen inside .phone: status bar, header, scrolling body, tab bar.
   Used by demo/mobile/*.html; class prefix .m / .m-* (v2, 20 Sep 2026) */
.phone .m{display:flex;flex-direction:column;height:100%;background:var(--color-surface-canvas);color:var(--color-ink-primary);font-size:14px;}
.phone .m__status{display:flex;justify-content:space-between;align-items:center;padding:14px 22px 0;font-size:13px;font-weight:600;height:44px;flex:none;}
.phone .m__status span:last-child{display:inline-flex;gap:5px;align-items:center;}
.phone .m__status i{display:inline-block;width:16px;height:9px;border:1.5px solid currentColor;border-radius:3px;position:relative;opacity:.9;}
.phone .m__status i::after{content:'';position:absolute;left:1.5px;top:1.5px;bottom:1.5px;width:9px;background:currentColor;border-radius:1px;}
.phone .m__head{display:flex;align-items:center;gap:10px;padding:8px 18px 10px;flex:none;}
.phone .m__title{font-weight:600;font-size:20px;letter-spacing:-.02em;flex:1;min-width:0;}
.phone .m__title small{display:block;font-size:12px;font-weight:400;color:var(--color-ink-muted);letter-spacing:0;margin-top:1px;}
.phone .m__body{flex:1;overflow-y:auto;overflow-x:hidden;padding:0 16px 12px;display:flex;flex-direction:column;gap:12px;min-height:0;scrollbar-width:none;}
.phone .m__body::-webkit-scrollbar{display:none;}
.phone .m__tabs{flex:none;display:grid;grid-template-columns:repeat(5,1fr);height:64px;border-top:1px solid var(--color-border-subtle);background:var(--color-surface-paper);padding-bottom:6px;}
.phone .m__tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:10px;font-weight:500;color:var(--color-ink-muted);}
.phone .m__tab svg{width:21px;height:21px;}
.phone .m__tab.is-on{color:var(--color-brand-primary);font-weight:600;}
.phone .m__home{width:120px;height:4px;border-radius:2px;background:var(--color-ink-primary);opacity:.55;margin:0 auto;}
/* pieces */
.phone .m .health-id-card{max-width:none;}
.phone .m-panel{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:16px;padding:12px 14px;}
.phone .m-panel__title{font-size:12px;color:var(--color-ink-muted);font-weight:500;margin-bottom:8px;display:flex;justify-content:space-between;gap:8px;}
.phone .m-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--color-border-subtle);}
.phone .m-row:first-of-type{border-top:none;padding-top:0;}
.phone .m-row__ic{width:34px;height:34px;border-radius:10px;background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);display:flex;align-items:center;justify-content:center;flex:none;}
.phone .m-row__ic svg{width:16px;height:16px;}
.phone .m-row__ic--ok{background:var(--color-success-subtle);color:var(--color-success-text);}
.phone .m-row__t{flex:1;min-width:0;}
.phone .m-row__n{font-weight:600;font-size:13.5px;}
.phone .m-row__s{font-size:11px;color:var(--color-ink-muted);font-family:var(--font-mono);}
.phone .m-check{width:22px;height:22px;border-radius:7px;border:1.5px solid var(--color-border-strong);flex:none;display:flex;align-items:center;justify-content:center;}
.phone .m-check.is-on{background:var(--color-success-solid);border-color:var(--color-success-solid);color:#fff;}
.phone .m-check svg{width:13px;height:13px;}
.phone .m-next{display:flex;align-items:center;gap:10px;padding:12px;border-radius:14px;background:var(--color-brand-primary-subtle);border:1px solid var(--color-brand-primary-border);}
.phone .m-next__ic{width:36px;height:36px;border-radius:10px;background:var(--color-brand-primary);color:#fff;display:flex;align-items:center;justify-content:center;flex:none;}
.phone .m-next__ic svg{width:16px;height:16px;}
.phone .m-qa{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.phone .m-qa__t{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:14px;border:1px solid var(--color-border-subtle);background:var(--color-surface-paper);font-size:12.5px;font-weight:600;min-height:52px;}
.phone .m-qa__t svg{width:18px;height:18px;color:var(--color-brand-primary);flex:none;}
.phone .m-qa__t--danger svg{color:var(--color-danger-text);}
.phone .m-chips{display:flex;gap:6px;flex-wrap:wrap;}
.phone .m-chip{display:inline-flex;align-items:center;min-height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--color-border-default);background:var(--color-surface-paper);font-size:12px;font-weight:500;}
.phone .m-chip.is-on{background:var(--color-brand-primary);border-color:var(--color-brand-primary);color:#fff;}
.phone .m-days{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;}
.phone .m-day{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 0;border-radius:12px;border:1px solid var(--color-border-subtle);background:var(--color-surface-paper);font-size:11px;color:var(--color-ink-muted);}
.phone .m-day b{font-size:15px;color:var(--color-ink-primary);font-weight:600;}
.phone .m-day.is-on{background:var(--color-brand-primary);border-color:var(--color-brand-primary);color:rgba(255,255,255,.8);}
.phone .m-day.is-on b{color:#fff;}
.phone .m-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
.phone .m-slot{min-height:40px;display:flex;align-items:center;justify-content:center;border-radius:10px;border:1px solid var(--color-border-default);background:var(--color-surface-paper);font-family:var(--font-mono);font-size:12.5px;}
.phone .m-slot.is-on{border-color:var(--color-brand-primary);background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);font-weight:600;}
.phone .m-slot.is-off{opacity:.4;text-decoration:line-through;}
.phone .m-video{flex:1;border-radius:18px;background:linear-gradient(160deg,var(--brand-800),var(--brand-950));position:relative;overflow:hidden;color:#fff;display:flex;align-items:center;justify-content:center;min-height:0;}
.phone .m-video__big{width:96px;height:96px;border-radius:50%;background:rgba(255,255,255,.14);display:flex;align-items:center;justify-content:center;font-size:32px;font-weight:600;letter-spacing:-.02em;}
.phone .m-video__name{position:absolute;left:14px;bottom:14px;font-size:13px;font-weight:600;}
.phone .m-video__name small{display:block;font-weight:400;opacity:.75;font-size:11px;}
.phone .m-video__timer{position:absolute;left:14px;top:12px;font-family:var(--font-mono);font-size:12px;background:rgba(0,0,0,.3);padding:4px 8px;border-radius:999px;}
.phone .m-video__self{position:absolute;right:12px;top:12px;width:84px;height:112px;border-radius:12px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.25);display:flex;align-items:center;justify-content:center;font-weight:600;}
.phone .m-video__third{position:absolute;right:12px;top:134px;width:84px;height:64px;border-radius:12px;background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.2);display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:10px;line-height:1.2;text-align:center;padding:4px;}
.phone .m-video__third b{font-size:14px;}
.phone .m-ctrls{display:flex;justify-content:center;gap:14px;padding:6px 0 2px;}
.phone .m-ctrl{width:52px;height:52px;border-radius:50%;background:var(--color-surface-paper);border:1px solid var(--color-border-default);display:flex;align-items:center;justify-content:center;color:var(--color-ink-primary);}
.phone .m-ctrl svg{width:20px;height:20px;}
.phone .m-ctrl--end{background:var(--color-danger-solid);border-color:var(--color-danger-solid);color:#fff;}
.phone .m-group{font-size:11px;color:var(--color-ink-muted);font-weight:600;margin:2px 0 -4px;}
.phone .m-sos{min-height:64px;border-radius:18px;background:var(--color-danger-solid);color:#fff;display:flex;align-items:center;justify-content:center;gap:10px;font-weight:700;font-size:18px;letter-spacing:.02em;box-shadow:0 12px 24px -10px rgba(180,30,30,.55);}
.phone .m-sos svg{width:22px;height:22px;}
.phone .m-chat{flex:1;display:flex;flex-direction:column;gap:8px;overflow:hidden;min-height:0;}
.phone .m-msg{max-width:86%;padding:10px 12px;border-radius:16px;font-size:13px;line-height:1.4;}
.phone .m-msg--user{align-self:flex-end;background:var(--color-brand-primary);color:#fff;border-bottom-right-radius:6px;}
.phone .m-msg--bot{align-self:flex-start;background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-bottom-left-radius:6px;}
.phone .m-msg__adv{font-size:10.5px;color:var(--color-ink-muted);margin-top:6px;font-style:italic;}
.phone .m-input{display:flex;align-items:center;gap:8px;border:1px solid var(--color-border-default);border-radius:999px;padding:6px 6px 6px 14px;background:var(--color-surface-paper);color:var(--color-ink-muted);font-size:13px;}
.phone .m-input span{flex:1;}
.phone .m-input i{width:36px;height:36px;border-radius:50%;background:var(--color-brand-primary);color:#fff;display:flex;align-items:center;justify-content:center;}
.phone .m-input i svg{width:16px;height:16px;}
.phone .m-progress{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--color-ink-muted);}
.phone .m-progress .progress{flex:1;height:5px;}
.phone .m-pillbtn{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 12px;border-radius:999px;background:var(--color-surface-sunken);font-size:12px;font-weight:600;}
.phone .m-pillbtn svg{width:14px;height:14px;}


/* ---------- map placeholder ---------- */
.map{position:relative;width:100%;aspect-ratio:16/9;border-radius:var(--radius-lg);overflow:hidden;border:1px solid var(--color-border-subtle);
  background-color:var(--color-surface-sunken);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%235f7775' stroke-opacity='0.14' stroke-width='1'%3E%3Cpath d='M0 0h60M0 15h60M0 30h60M0 45h60M0 60h60M0 0v60M15 0v60M30 0v60M45 0v60M60 0v60'/%3E%3C/g%3E%3C/svg%3E");
}
.map__placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--color-ink-muted);text-align:center;padding:16px;}
.map__placeholder svg{width:34px;height:34px;color:var(--color-brand-primary);}
.map__pin{position:absolute;width:28px;height:28px;color:var(--color-danger-solid);transform:translate(-50%,-100%);filter:drop-shadow(0 2px 3px rgba(0,0,0,.3));}

/* ---------- queue-board — waiting-room live serial display ---------- */
.queue-board{background:var(--neutral-950);color:#fff;border-radius:var(--radius-xl);padding:28px;}
.queue-board__head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:20px;}
.queue-board__title{font-family:var(--font-display);font-size:22px;font-weight:700;}
.queue-board__clock{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-size:20px;color:var(--brand-300);}
.queue-board__now{background:rgba(255,255,255,.06);border-radius:var(--radius-lg);padding:24px;text-align:center;margin-bottom:16px;}
.queue-board__now-label{font-size:13px;letter-spacing:.08em;text-transform:uppercase;color:var(--brand-300);margin-bottom:8px;}
.queue-board__now-serial{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-size:64px;font-weight:800;line-height:1;}
.queue-board__now-name{font-size:18px;margin-top:8px;color:rgba(255,255,255,.85);}
.queue-board__list{display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:10px;}
.queue-board__item{background:rgba(255,255,255,.05);border-radius:var(--radius-md);padding:10px;text-align:center;font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-weight:700;font-size:18px;color:rgba(255,255,255,.7);}

/* ---------- calendar — month/week grid ---------- */
.calendar{border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);overflow:hidden;background:var(--color-surface-paper);}
.calendar__head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--color-border-subtle);}
.calendar__title{font-family:var(--font-display);font-weight:700;font-size:16px;}
.calendar__grid{display:grid;grid-template-columns:repeat(7,1fr);}
.calendar__dow{text-align:center;font-size:11px;font-weight:700;color:var(--color-ink-muted);text-transform:uppercase;padding:8px 0;border-bottom:1px solid var(--color-border-subtle);}
.calendar__cell{min-height:84px;border-right:1px solid var(--color-border-subtle);border-bottom:1px solid var(--color-border-subtle);padding:6px;display:flex;flex-direction:column;gap:3px;}
.calendar__cell:nth-child(7n){border-right:none;}
.calendar__cell--muted{background:var(--color-surface-sunken);color:var(--color-ink-disabled);}
.calendar__date{font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;}
.calendar__date--today{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--color-brand-primary);color:var(--color-brand-on-primary);}
.calendar__event{font-size:10px;padding:2px 5px;border-radius:4px;background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.calendar__event--accent{background:var(--color-accent-subtle);color:var(--color-accent);}

/* ---------- trend — line chart container (uses HSA.sparkline) ---------- */
.trend{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);padding:18px 20px;}
.trend__head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:10px;}
.trend__title{font-weight:700;font-size:var(--text-sm);}
.trend__range{font-size:var(--text-xs);color:var(--color-ink-muted);}
.trend__chart{width:100%;}
.trend__band{fill:var(--color-clinical-normal-subtle);opacity:.6;}

/* ---------- vitals — grid of unit inputs ---------- */
.vitals{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;}
.vitals__field{display:flex;flex-direction:column;gap:4px;}
.vitals__field label{font-size:var(--text-xs);font-weight:var(--weight-semibold);color:var(--color-ink-muted);}

/* ---------- rx-builder — two-column: sections left, live preview right ---------- */
.rx-builder{display:grid;grid-template-columns:1fr 420px;gap:20px;align-items:start;}
.rx-builder__col{display:flex;flex-direction:column;gap:16px;}
.rx-builder__preview{position:sticky;top:calc(var(--topbar-h) + 16px);}
.rx-section{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);}
.rx-section__head{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--color-border-subtle);font-weight:700;font-size:var(--text-sm);}
.rx-section__head svg{width:17px;height:17px;color:var(--color-brand-primary);}
.rx-section__req{color:var(--color-danger-text);font-size:11px;font-weight:700;margin-left:auto;text-transform:uppercase;letter-spacing:.03em;}
.rx-section__body{padding:16px;}
.rx-item-row{display:flex;align-items:flex-start;gap:10px;padding:12px 0;border-bottom:1px solid var(--color-border-subtle);}
.rx-item-row:last-child{border-bottom:none;}
.rx-item-row__num{width:24px;height:24px;border-radius:50%;background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;flex:none;margin-top:2px;}
.rx-item-row__body{flex:1;min-width:0;}
.rx-item-row__name{font-weight:700;font-size:var(--text-sm);}
.rx-item-row__meta{font-size:var(--text-xs);color:var(--color-ink-muted);margin-top:2px;}
.rx-interaction-warning{display:flex;gap:10px;align-items:flex-start;background:var(--color-warning-subtle);color:var(--color-warning-text);border:1px solid var(--color-warning-solid);border-radius:var(--radius-md);padding:12px 14px;font-size:var(--text-sm);margin-top:10px;}
.rx-interaction-warning svg{width:18px;height:18px;flex:none;margin-top:1px;}

/* ---------- rx-sheet — A4/A5 prescription print sheet ---------- */
.rx-sheet{background:#fff;color:#12211f;width:100%;max-width:794px;margin-inline:auto;padding:20mm 16mm;position:relative;box-shadow:var(--shadow-elevation-2);border:1px solid var(--color-border-subtle);font-family:var(--font-ui);}
.rx-sheet--a5{max-width:559px;padding:10mm 8mm;}
.rx-sheet__letterhead{display:flex;align-items:center;gap:14px;padding-bottom:12px;border-bottom:2px solid var(--brand-700);}
.rx-sheet__letterhead img{width:48px;height:48px;flex:none;}
.rx-sheet__clinic{font-family:var(--font-display);font-size:16px;font-weight:700;color:var(--brand-800);}
.rx-sheet__doctor{font-size:12px;font-weight:600;color:#12211f;margin-top:2px;}
.rx-sheet__reg{font-size:10px;color:#5f7775;display:flex;align-items:center;gap:4px;}
.rx-sheet__reg svg{width:12px;height:12px;color:var(--brand-700);}
.rx-sheet__chamber{margin-left:auto;text-align:right;font-size:10px;color:#5f7775;}
.rx-sheet__meta{display:flex;justify-content:space-between;font-size:11px;color:#36423c;margin:10px 0;font-family:var(--font-mono);}
.rx-sheet__patient{display:grid;grid-template-columns:repeat(3,1fr);gap:4px 16px;font-size:11px;padding:10px 0;border-top:1px dashed #cdd3cb;border-bottom:1px dashed #cdd3cb;margin-bottom:10px;}
.rx-sheet__patient b{font-weight:700;}
.rx-sheet__vitals{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:10.5px;margin-bottom:10px;font-variant-numeric:tabular-nums;}
.rx-sheet__allergy{background:#f9f1f1;color:#8f1c19;border:1px solid #d9382a;border-radius:4px;padding:6px 10px;font-weight:700;font-size:10.5pt;margin-bottom:10px;display:flex;align-items:center;gap:6px;}
.rx-sheet__allergy svg{width:14px;height:14px;flex:none;}
.rx-sheet__cols{display:grid;grid-template-columns:1fr 1.3fr;gap:16px;}
.rx-sheet__section-title{font-weight:700;font-size:9.5pt;color:var(--brand-800);text-transform:uppercase;letter-spacing:.03em;margin:10px 0 4px;}
.rx-sheet__section-title:first-child{margin-top:0;}
.rx-sheet__body-text{font-size:9.5pt;line-height:1.5;color:#1a2420;}
.rx-sheet__rx-mark{font-family:var(--font-display);font-size:22px;font-weight:700;color:var(--brand-700);float:left;margin-right:6px;line-height:1;}
.rx-sheet__drug{margin-bottom:8px;}
.rx-sheet__drug-name{font-weight:700;font-size:11pt;text-transform:uppercase;}
.rx-sheet__drug-generic{font-size:9pt;color:#5f7775;text-transform:lowercase;}
.rx-sheet__drug-dosing{font-size:9.5pt;color:#1a2420;margin-top:1px;}
.rx-sheet__footer{display:flex;justify-content:space-between;align-items:flex-end;margin-top:16px;padding-top:12px;border-top:1px dashed #cdd3cb;}
.rx-sheet__qr{display:flex;align-items:center;gap:8px;}
.rx-sheet__qr img{width:64px;height:64px;border:1px solid #cdd3cb;}
.rx-sheet__qr-text{font-size:8pt;color:#5f7775;max-width:160px;}
.rx-sheet__sign{text-align:center;}
.rx-sheet__sign-line{border-top:1px solid #1a2420;padding-top:4px;font-size:9pt;font-weight:700;min-width:140px;}
.rx-sheet__patient-copy{margin-top:16px;padding-top:12px;border-top:2px dashed var(--brand-300);font-family:'Noto Sans Bengali',sans-serif;font-size:9.5pt;color:#1a2420;}
.rx-sheet__made-with{text-align:center;font-size:8pt;color:#7e9593;margin-top:10px;}

/* ---------- lab-report — A4 with reference ranges and flags ---------- */
.lab-report{background:#fff;color:#12211f;width:100%;max-width:794px;margin-inline:auto;padding:18mm 16mm;box-shadow:var(--shadow-elevation-2);border:1px solid var(--color-border-subtle);font-family:var(--font-ui);}
.lab-report__head{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:2px solid var(--brand-700);padding-bottom:12px;}
.lab-report__org{font-family:var(--font-display);font-size:16px;font-weight:700;color:var(--brand-800);}
.lab-report__title{text-align:center;font-family:var(--font-display);font-size:15px;font-weight:700;margin:14px 0 4px;}
.lab-report__table{width:100%;font-size:10pt;border-collapse:collapse;margin-top:10px;}
.lab-report__table th{text-align:left;font-size:8.5pt;text-transform:uppercase;letter-spacing:.03em;color:#5f7775;padding:6px 8px;border-bottom:1.5px solid #12211f;}
.lab-report__table td{padding:7px 8px;border-bottom:1px solid #e5ebeb;font-variant-numeric:tabular-nums;}
.lab-report__flag{font-weight:700;}
.lab-report__flag--abnormal{color:var(--clinical-abnormal-text-lt);}
.lab-report__flag--critical{color:var(--clinical-critical-text-lt);}
.lab-report__flag--borderline{color:var(--clinical-borderline-text-lt);}

/* ---------- receipt ---------- */
.receipt{background:#fff;color:#12211f;width:100%;max-width:420px;margin-inline:auto;padding:20px;box-shadow:var(--shadow-elevation-2);border:1px dashed var(--color-border-strong);font-family:var(--font-ui);}
.receipt__head{text-align:center;margin-bottom:12px;}
.receipt__title{font-family:var(--font-display);font-weight:700;font-size:16px;color:var(--brand-800);}
.receipt__row{display:flex;justify-content:space-between;font-size:12px;padding:4px 0;border-bottom:1px dashed #e5ebeb;}
.receipt__row--total{font-weight:700;font-size:14px;border-bottom:none;border-top:1.5px solid #12211f;margin-top:6px;padding-top:8px;}

/* ---------- health-id-card — credit-card ratio ---------- */
.health-id-card{width:100%;max-width:400px;aspect-ratio:1.586/1;border-radius:var(--radius-lg);background:linear-gradient(135deg,var(--brand-700),var(--brand-900));color:#fff;padding:20px;position:relative;overflow:hidden;box-shadow:var(--shadow-elevation-3);display:flex;flex-direction:column;justify-content:space-between;}
.health-id-card::after{content:'';position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M19 49C8 42 8 27 20 19C25 15 30 19 31 26C31.8 30 31 32.5 33 35L37 35L41 20L46 49L50 35L56 35' fill='none' stroke='white' stroke-width='4' opacity='0.08'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right -10px bottom -10px;background-size:140px;pointer-events:none;}
.health-id-card__top{display:flex;justify-content:space-between;align-items:flex-start;position:relative;z-index:1;}
.health-id-card__brand{font-family:var(--font-display);font-size:13px;font-weight:700;letter-spacing:.02em;}
.health-id-card__qr{width:52px;height:52px;background:#fff;border-radius:6px;padding:3px;}
.health-id-card__name{font-family:var(--font-display);font-size:19px;font-weight:700;position:relative;z-index:1;}
.health-id-card__meta{display:flex;justify-content:space-between;align-items:flex-end;position:relative;z-index:1;}
.health-id-card__id{font-family:ui-monospace,monospace;font-size:15px;letter-spacing:.06em;font-weight:700;}
.health-id-card__blood{background:rgba(255,255,255,.16);border-radius:6px;padding:3px 10px;font-size:12px;font-weight:700;}

/* ---------- emergency-card ---------- */
.emergency-card{background:var(--color-danger-subtle);border:2px solid var(--color-danger-solid);border-radius:var(--radius-lg);padding:20px;}
.emergency-card__head{display:flex;align-items:center;gap:10px;color:var(--color-danger-text);font-weight:700;font-size:var(--text-lg);margin-bottom:12px;}
.emergency-card__head svg{width:22px;height:22px;}
.emergency-card__row{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid rgba(217,56,42,.18);font-size:var(--text-sm);}
.emergency-card__row:last-child{border-bottom:none;}
.emergency-card__row dt{color:var(--color-ink-secondary);font-weight:600;}
.emergency-card__row dd{font-weight:700;color:var(--color-ink-primary);}

/* ---------- media-grid + lightbox (surgery vault) ---------- */
.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px;}
.media-grid__item{position:relative;aspect-ratio:1/1;border-radius:var(--radius-md);overflow:hidden;cursor:pointer;border:1px solid var(--color-border-subtle);}
.media-grid__thumb{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:#fff;}
.media-grid__thumb svg{width:28px;height:28px;}
.media-grid__badge{position:absolute;top:6px;left:6px;background:rgba(14,24,23,.6);color:#fff;font-size:10px;font-weight:700;padding:2px 6px;border-radius:4px;}
.media-grid__play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(14,24,23,.28);}
.media-grid__play svg{width:32px;height:32px;color:#fff;}
.lightbox{position:fixed;inset:0;z-index:96;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.85);}
.lightbox__frame{max-width:90vw;max-height:80vh;border-radius:var(--radius-md);overflow:hidden;display:flex;align-items:center;justify-content:center;}
.lightbox__close{position:absolute;top:20px;right:20px;}
.lightbox__caption{position:absolute;bottom:20px;left:0;right:0;text-align:center;color:#fff;font-size:var(--text-sm);}

/* ---------- upload-progress ---------- */
.upload-progress{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--color-border-subtle);border-radius:var(--radius-md);background:var(--color-surface-paper);}
.upload-progress__icon{width:36px;height:36px;border-radius:var(--radius-sm);background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);display:flex;align-items:center;justify-content:center;flex:none;}
.upload-progress__body{flex:1;min-width:0;}
.upload-progress__name{font-size:var(--text-sm);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.upload-progress__meta{font-size:11px;color:var(--color-ink-muted);margin-top:2px;}

/* ---------- plan-card — pricing tiers ---------- */
.plan-card{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-xl);padding:24px;display:flex;flex-direction:column;gap:14px;position:relative;}
.plan-card--featured{border-color:var(--color-accent);box-shadow:var(--shadow-elevation-3);}
.plan-card__ribbon{position:absolute;top:-12px;left:50%;transform:translateX(-50%);background:var(--color-accent);color:var(--color-on-accent);font-size:11px;font-weight:700;padding:4px 14px;border-radius:var(--radius-full);white-space:nowrap;}
.plan-card__name{font-family:var(--font-display);font-weight:700;font-size:18px;}
.plan-card__price{font-size:32px;font-weight:800;font-variant-numeric:tabular-nums;}
.plan-card__price small{font-size:13px;font-weight:600;color:var(--color-ink-muted);}
.plan-card__list{display:flex;flex-direction:column;gap:8px;font-size:var(--text-sm);}
.plan-card__list li{display:flex;align-items:flex-start;gap:8px;}
.plan-card__list svg{width:16px;height:16px;color:var(--color-success-text);flex:none;margin-top:2px;}

/* ---------- site-preview — doctor website template thumbnail ---------- */
.site-preview{border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);overflow:hidden;background:var(--color-surface-paper);cursor:pointer;transition:box-shadow var(--duration-base), transform var(--duration-base);}
.site-preview:hover{box-shadow:var(--shadow-elevation-3);transform:translateY(-2px);}
.site-preview__thumb{aspect-ratio:4/3;background:var(--color-surface-sunken);display:flex;align-items:center;justify-content:center;color:var(--color-brand-primary);}
.site-preview__thumb svg{width:36px;height:36px;}
.site-preview__body{padding:14px 16px;}
.site-preview__name{font-weight:700;font-size:var(--text-sm);}
.site-preview.is-selected{outline:2px solid var(--color-brand-primary);outline-offset:2px;}

/* ---------- video-room ---------- */
.video-room{background:var(--neutral-950);border-radius:var(--radius-xl);overflow:hidden;color:#fff;}
.video-room__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:6px;padding:6px;min-height:280px;}
.video-room__tile{background:#1d2b2a;border-radius:var(--radius-md);position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;aspect-ratio:4/3;}
.video-room__tile-label{position:absolute;bottom:8px;left:8px;background:rgba(0,0,0,.5);font-size:11px;padding:3px 8px;border-radius:4px;}
.video-room__waveform{width:80%;opacity:.5;}
.video-room__controls{display:flex;align-items:center;justify-content:center;gap:10px;padding:14px;background:rgba(255,255,255,.04);}
.video-room__controls .btn--icon{background:rgba(255,255,255,.1);color:#fff;border-color:transparent;}
.video-room__controls .btn--icon:hover{background:rgba(255,255,255,.18);}
.video-room__controls .btn--danger{background:var(--color-danger-solid);}
.video-room__captions{padding:10px 16px;text-align:center;font-size:var(--text-sm);color:rgba(255,255,255,.85);min-height:20px;}

/* ---------- chat — Ask conversation with source chips ---------- */
.chat{display:flex;flex-direction:column;gap:12px;padding:4px;}
.chat__msg{max-width:85%;padding:12px 16px;border-radius:var(--radius-lg);font-size:var(--text-sm);line-height:var(--leading-base);white-space:pre-wrap;overflow-wrap:break-word;}
.chat__msg--user{align-self:flex-end;background:var(--color-brand-primary);color:var(--color-brand-on-primary);border-bottom-right-radius:var(--radius-xs);}
.chat__msg--bot{align-self:flex-start;background:var(--color-surface-sunken);color:var(--color-ink-primary);border-bottom-left-radius:var(--radius-xs);}
.chat__cites{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;}
.chat__cites .chip{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);font-size:12px;padding:3px 10px;}
.chat__cites .chip::before{display:none;}
.chat__advisory{font-size:11px;color:var(--color-ink-muted);margin-top:8px;font-style:italic;}
.chat__starters{display:flex;flex-wrap:wrap;gap:8px;}
.chat__starters .btn{white-space:normal;text-align:left;height:auto;min-height:44px;padding-block:10px;align-items:flex-start;line-height:1.35;max-width:100%;}
.chat__composer{display:flex;gap:10px;align-items:flex-end;padding-top:12px;border-top:1px solid var(--color-border-subtle);}
.chat__composer .textarea{flex:1;max-height:140px;}

/* ============================================================================
   9b. PORTAL v2 — the shared vocabulary every portal page opens with
   (docs/design/DESIGN_LANGUAGE_V2.md §3 "Portal dashboard"; promoted out of
   demo/doctor/dashboard.html so ~100 pages say it the same way instead of each
   page inventing its own .pg-*. Rendered by HSA.pageHead / nowStrip / needsList
   / miniBars / listRow in assets/app.js.)
   ============================================================================ */

/* ---- .page-head — title, one-line subtitle, actions. Every portal page opens with it. ---- */
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:var(--space-5);}
.page-head__text{min-width:0;flex:1 1 320px;}
.page-head__title{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:4px;}
.page-head__title h1{margin:0;}
.page-head__sub{font-size:var(--text-sm);line-height:var(--leading-sm);color:var(--color-ink-secondary);max-width:72ch;}
/* NOT flex:none. Bengali labels run ~40% longer than English, and two of them
   ("রোগী নিবন্ধন করুন" + "CSV আমদানি করুন" = 384px) could not shrink or wrap, so the page
   scrolled sideways at 390px in বাং while passing in English. Caught by the doctor-app
   worker's sweep on doctor/patients.html; fixed here because .page-head is now on ~100 pages. */
.page-head__actions{display:flex;gap:10px;flex-wrap:wrap;flex:0 1 auto;min-width:0;align-items:center;}
@media (max-width:640px){
  .page-head__actions{width:100%;}
  .page-head__actions>.btn{flex:1 1 auto;justify-content:center;}
}

/* .cell-name — a table's first cell: the name in bold with its code/mobile as a mono sub-line.
   Six pages had independently re-declared this identical pair under their own .pg-* prefix. */
.cell-name{font-weight:var(--weight-semibold);}
.cell-name small{display:block;font-weight:400;font-size:12px;color:var(--color-ink-muted);font-family:var(--font-mono);margin-top:1px;}

/* ---- .now-strip — "the one thing that needs you now", a portal page's hero.
   A brand rule down the left, a live dot, the figure that matters, its action.
   Never a wall of equal stat tiles. ---- */
.now-strip{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:var(--space-4);margin-bottom:var(--space-5);align-items:stretch;}
.now-strip--wide{grid-template-columns:minmax(0,1fr);}
.now-panel{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-xl);padding:22px 24px;display:flex;flex-direction:column;gap:16px;position:relative;overflow:hidden;box-shadow:var(--shadow-elevation-1);}
.now-panel::before{content:'';position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--color-brand-primary);}
.now-panel--warn::before{background:var(--color-warning-text);}
.now-panel--calm::before{background:var(--color-border-strong,var(--color-border-subtle));}
.now-panel__label{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:var(--weight-semibold);color:var(--color-brand-primary);}
.now-panel--warn .now-panel__label{color:var(--color-warning-text);}
.now-panel--calm .now-panel__label{color:var(--color-ink-muted);}
/* the dot is a LIVE signal (a patient is in the room now); a calm panel is just a state
   label, so it gets a static dot rather than a heartbeat that means nothing. */
.now-panel--calm .now-panel__label i{animation:none;opacity:.55;}
.now-panel__label i{width:8px;height:8px;border-radius:50%;background:currentColor;display:inline-block;animation:hsa-now-pulse 1.8s ease-in-out infinite;flex:none;}
@keyframes hsa-now-pulse{0%,100%{box-shadow:0 0 0 0 rgba(15,118,110,.45);}60%{box-shadow:0 0 0 8px rgba(15,118,110,0);}}
.now-panel__body{display:flex;align-items:center;gap:16px;flex-wrap:wrap;}
/* the figure that matters — display type, not a stat tile */
.now-panel__figure{font-family:var(--font-display);font-weight:var(--weight-semibold);font-size:44px;line-height:1;letter-spacing:-.04em;font-variant-numeric:tabular-nums;color:var(--color-ink-primary);}
.now-panel__figure small{display:block;font-family:var(--font-ui);font-size:11px;font-weight:var(--weight-medium);color:var(--color-ink-muted);letter-spacing:0;margin-top:4px;}
.now-panel__name{font-size:var(--text-xl);font-weight:var(--weight-semibold);letter-spacing:-.02em;}
.now-panel__meta{font-size:var(--text-sm);color:var(--color-ink-secondary);margin-top:2px;display:flex;gap:14px;flex-wrap:wrap;}
.now-panel__meta span{display:inline-flex;align-items:center;gap:5px;}
.now-panel__meta svg{width:14px;height:14px;color:var(--color-ink-muted);flex:none;}
.now-panel__foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:var(--text-sm);color:var(--color-ink-secondary);}
.now-panel__foot b{font-family:var(--font-mono);font-weight:var(--weight-medium);background:var(--color-surface-sunken);border-radius:var(--radius-full);padding:4px 10px;color:var(--color-ink-primary);}

/* ---- .needs — the compact "needs you" list that sits beside the now panel ---- */
.needs{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-xl);padding:6px 8px;display:flex;flex-direction:column;box-shadow:var(--shadow-elevation-1);}
.needs__title{font-size:12px;font-weight:var(--weight-semibold);color:var(--color-ink-muted);padding:12px 12px 6px;}
.needs__item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--radius-md);color:inherit;min-height:52px;transition:background var(--duration-base);text-decoration:none;}
.needs__item:hover{background:var(--color-surface-sunken);}
.needs__item:focus-visible{outline:2px solid var(--color-brand-primary);outline-offset:-2px;}
.needs__icon{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:none;background:var(--color-surface-sunken);color:var(--color-ink-secondary);}
.needs__icon--warn{background:var(--color-warning-subtle);color:var(--color-warning-text);}
.needs__icon--brand{background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);}
.needs__icon--danger{background:var(--color-danger-subtle);color:var(--color-danger-text);}
.needs__icon--success{background:var(--color-success-subtle);color:var(--color-success-text);}
.needs__icon svg{width:17px;height:17px;}
.needs__text{flex:1;min-width:0;font-size:var(--text-sm);font-weight:var(--weight-medium);line-height:1.3;}
.needs__text small{display:block;font-weight:var(--weight-regular,400);color:var(--color-ink-muted);font-size:12px;margin-top:1px;}
.needs__count{font-family:var(--font-display);font-weight:var(--weight-semibold);font-size:20px;letter-spacing:-.03em;font-variant-numeric:tabular-nums;}
.needs__item>svg:last-child{width:16px;height:16px;color:var(--color-ink-muted);flex:none;}
.needs__empty{padding:14px 12px 18px;font-size:var(--text-sm);color:var(--color-ink-muted);display:flex;align-items:center;gap:8px;}
.needs__empty svg{width:17px;height:17px;color:var(--color-success-text);flex:none;}

/* ---- .list-row — a dense clickable record row: bold first cell, muted middle,
   mono date, chip at the end. Use instead of a grid of cards for repeatable records. ---- */
.list-rows{display:flex;flex-direction:column;}
.list-row{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1.6fr) auto auto;gap:12px;align-items:center;padding:10px 0;min-height:44px;border-top:1px solid var(--color-border-subtle);font-size:var(--text-sm);color:inherit;text-decoration:none;}
.list-rows>.list-row:first-child{border-top:none;}
.list-row:hover{background:var(--color-surface-sunken);}
.list-row:focus-visible{outline:2px solid var(--color-brand-primary);outline-offset:-2px;}
.list-row__main{font-weight:var(--weight-semibold);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.list-row__main small{display:block;font-weight:var(--weight-regular,400);font-size:12px;color:var(--color-ink-muted);margin-top:1px;}
.list-row__sub{color:var(--color-ink-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.list-row__meta{font-family:var(--font-mono);font-size:12px;color:var(--color-ink-muted);white-space:nowrap;}
.list-row--pad{padding-inline:16px;}
.list-row--2{grid-template-columns:minmax(0,1fr) auto;}
.list-row--3{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto;}

/* ---- .tile-grid — small state tiles (beds, rooms, counters, slots).
   Hairline, no shadow, auto-fill: a state board, never a wall of cards. ---- */
.tile-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px;}
.tile{background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-md);padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-height:64px;color:inherit;text-decoration:none;transition:border-color var(--duration-base),background var(--duration-base);}
a.tile:hover,.tile--interactive:hover{border-color:var(--color-brand-primary);background:var(--color-brand-primary-subtle);}
/* A clickable tile is a button and owes the same press response as one (RootSoft BUTTON
   STANDARD): ~100ms and a 0.97 scale, so the control answers the finger immediately.
   Flagged by the patient-app worker, which had to hand-roll this locally for sponsor.html. */
a.tile,button.tile,.tile--interactive{cursor:pointer;transition:border-color var(--duration-base),background var(--duration-base),transform var(--button-press-duration);}
a.tile:active,button.tile:active,.tile--interactive:active{transform:scale(var(--button-press-scale));}
a.tile:focus-visible,button.tile:focus-visible,.tile--interactive:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:var(--focus-ring-offset);}
.tile__id{font-family:var(--font-mono);font-size:12px;font-weight:var(--weight-semibold);color:var(--color-ink-primary);}
.tile__name{font-size:12px;color:var(--color-ink-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.tile .chip{align-self:flex-start;}
.tile--free{border-left:3px solid var(--color-success-text);}
.tile--busy{border-left:3px solid var(--color-info-text,var(--color-brand-primary));}
.tile--hold{border-left:3px solid var(--color-warning-text);}

/* ---- .minibar — a labelled horizontal bar that carries its value.
   Charts never ship as unlabelled squiggles (v2 §3.3). ---- */
.minibars{display:flex;flex-direction:column;gap:8px;}
.minibar{display:grid;grid-template-columns:minmax(88px,34%) 1fr auto;gap:10px;align-items:center;font-size:12px;}
.minibar__label{color:var(--color-ink-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.minibar__track{background:var(--color-surface-sunken);border-radius:var(--radius-full);height:8px;overflow:hidden;}
.minibar__fill{background:var(--color-brand-primary);height:100%;border-radius:var(--radius-full);}
.minibar__fill--accent{background:var(--color-accent);}
.minibar__fill--warn{background:var(--color-warning-text);}
.minibar__fill--danger{background:var(--color-danger-text);}
.minibar__value{font-family:var(--font-mono);font-variant-numeric:tabular-nums;color:var(--color-ink-primary);white-space:nowrap;}

/* ---- portal column rhythm: main work list 2/3, side context 1/3 ---- */
.portal-cols{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:var(--space-4);align-items:start;}
.portal-cols>*{min-width:0;display:flex;flex-direction:column;gap:var(--space-4);}
.portal-cols--even{grid-template-columns:repeat(2,minmax(0,1fr));}
.panel-title{font-size:13px;font-weight:var(--weight-semibold);color:var(--color-ink-secondary);margin-bottom:12px;display:flex;justify-content:space-between;align-items:center;gap:8px;}
/* one row of four stats, the only place stat tiles belong */
.stat-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-4);margin-bottom:var(--space-5);}
.stat-row--3{grid-template-columns:repeat(3,minmax(0,1fr));}
.stat-row .stat__spark svg{width:100%;height:36px;}

@media (max-width:1100px){
  .now-strip,.portal-cols{grid-template-columns:1fr;}
  .stat-row,.stat-row--3{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width:640px){
  .stat-row,.stat-row--3,.portal-cols--even{grid-template-columns:1fr;}
  .now-panel{padding:18px;}
  .now-panel__figure{font-size:36px;}
  .list-row,.list-row--3{grid-template-columns:minmax(0,1fr) auto;}
  .list-row__sub,.list-row__meta{display:none;}
  .tile-grid{grid-template-columns:repeat(auto-fill,minmax(108px,1fr));}
  .minibar{grid-template-columns:minmax(72px,40%) 1fr auto;}
}
@media (prefers-reduced-motion:reduce){.now-panel__label i{animation:none;}}

/* ============================================================================
   9c. BROWSE — departments and symptoms
   ----------------------------------------------------------------------------
   The directory's front door, on the landing page and on find-a-doctor.
   The SYMPTOM tiles are the point: a patient in Sylhet searches "গ্যাস্ট্রিক",
   not "Gastroenterology", so those tiles are larger and lead with the phrase.
   Rendered by HSA.browseTiles / browseTabs (assets/app.js).
   ============================================================================ */
.browse-tabs{display:inline-flex;padding:4px;gap:4px;background:var(--color-surface-sunken);border:1px solid var(--color-border-subtle);border-radius:var(--radius-full);}
.browse-tabs button{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:0 18px;border-radius:var(--radius-full);font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-ink-secondary);background:transparent;border:0;cursor:pointer;white-space:nowrap;transition:background var(--duration-base),color var(--duration-base),box-shadow var(--duration-base);}
.browse-tabs button svg{width:16px;height:16px;}
.browse-tabs button:hover{color:var(--color-ink-primary);}
.browse-tabs button[aria-selected="true"]{background:var(--color-surface-paper);color:var(--color-brand-primary);box-shadow:var(--shadow-elevation-1);}
.browse-tabs button:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:2px;}

.browse-group{margin-bottom:var(--space-5);}
.browse-group__label{display:flex;align-items:center;gap:10px;font-size:12px;font-weight:var(--weight-semibold);color:var(--color-ink-muted);margin-bottom:10px;}
.browse-group__label::after{content:'';flex:1;height:1px;background:var(--color-border-subtle);}

/* ---- department tile: dense, scannable, and honest about coverage ---- */
.browse-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;}
.browse-tile{display:flex;align-items:flex-start;gap:12px;padding:14px;min-height:76px;background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-lg);color:inherit;text-decoration:none;position:relative;
  transition:border-color var(--duration-base),background var(--duration-base),transform var(--button-press-duration),box-shadow var(--duration-base);}
.browse-tile:hover{border-color:var(--color-brand-primary);box-shadow:var(--shadow-elevation-2);}
.browse-tile:active{transform:scale(var(--button-press-scale));}
.browse-tile:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:2px;}
.browse-tile__icon{width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;flex:none;background:var(--color-brand-primary-subtle);color:var(--color-brand-primary);}
.browse-tile__icon svg{width:21px;height:21px;}
/* name and blurb are <span>s, so they need to be blocks or they run together as one
   sentence — "CardiologyHeart, blood pressure and rhythm". The symptom tile hid this
   because it is already a flex column. */
.browse-tile__body{min-width:0;flex:1;display:flex;flex-direction:column;align-items:flex-start;}
.browse-tile__name{display:block;font-size:var(--text-sm);font-weight:var(--weight-semibold);line-height:1.25;}
.browse-tile__blurb{display:block;font-size:12px;color:var(--color-ink-muted);line-height:1.35;margin-top:3px;}
/* the live doctor count — a tile that leads nowhere should say so before it is tapped */
.browse-tile__count{font-family:var(--font-mono);font-size:11px;font-weight:var(--weight-medium);color:var(--color-brand-primary);background:var(--color-brand-primary-subtle);border-radius:var(--radius-full);padding:2px 8px;flex:none;align-self:center;}
.browse-tile--empty .browse-tile__icon{background:var(--color-surface-sunken);color:var(--color-ink-muted);}
.browse-tile--empty .browse-tile__count{color:var(--color-ink-muted);background:var(--color-surface-sunken);}

/* ---- symptom tile: bigger, phrase-led, gold ground — this is the entry point ---- */
.browse-grid--symptoms{grid-template-columns:repeat(auto-fill,minmax(232px,1fr));gap:12px;}
.browse-symptom{display:flex;flex-direction:column;gap:10px;padding:16px;min-height:132px;background:var(--color-surface-paper);border:1px solid var(--color-border-subtle);border-radius:var(--radius-xl);color:inherit;text-decoration:none;position:relative;overflow:hidden;
  transition:border-color var(--duration-base),box-shadow var(--duration-base),transform var(--button-press-duration);}
.browse-symptom::after{content:'';position:absolute;right:-28px;top:-28px;width:96px;height:96px;border-radius:50%;background:var(--color-accent-subtle);opacity:.55;transition:transform var(--duration-base);}
.browse-symptom:hover{border-color:var(--color-accent);box-shadow:var(--shadow-elevation-2);}
.browse-symptom:hover::after{transform:scale(1.25);}
.browse-symptom:active{transform:scale(var(--button-press-scale));}
.browse-symptom:focus-visible{outline:var(--focus-ring-width) solid var(--color-focus-ring);outline-offset:2px;}
.browse-symptom__icon{width:44px;height:44px;border-radius:14px;display:flex;align-items:center;justify-content:center;flex:none;background:var(--color-accent-subtle);color:var(--color-accent);position:relative;z-index:1;}
.browse-symptom__icon svg{width:23px;height:23px;}
.browse-symptom__name{font-size:var(--text-base);font-weight:var(--weight-semibold);line-height:1.3;letter-spacing:-.01em;position:relative;z-index:1;text-wrap:balance;}
.browse-symptom__to{margin-top:auto;font-size:12px;color:var(--color-ink-muted);display:flex;align-items:center;gap:5px;position:relative;z-index:1;min-width:0;}
/* one line only: "Plastic & Reconstructive Surgery" wrapped and knocked the tile's
   baseline out of alignment with its neighbours. */
.browse-symptom__to span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.browse-symptom__to svg{width:13px;height:13px;flex:none;}

.browse-empty{padding:18px;font-size:var(--text-sm);color:var(--color-ink-muted);}

@media (max-width:640px){
  .browse-grid{grid-template-columns:1fr;}
  .browse-grid--symptoms{grid-template-columns:1fr 1fr;gap:8px;}
  .browse-symptom{min-height:120px;padding:13px;}
  .browse-symptom__name{font-size:var(--text-sm);}
  .browse-tabs{width:100%;}
  .browse-tabs button{flex:1;justify-content:center;padding:0 10px;}
}
@media (prefers-reduced-motion:reduce){.browse-symptom::after{transition:none;}}

/* ============================================================================
   10. OVERLAYS — modal, drawer, toast, confirm
   ============================================================================ */
.overlay-scrim{position:fixed;inset:0;background:var(--color-surface-overlay);z-index:90;opacity:0;transition:opacity var(--duration-base);}
.overlay-scrim.is-open{opacity:1;}

.modal-wrap{position:fixed;inset:0;z-index:91;display:flex;align-items:center;justify-content:center;padding:20px;}
.modal{background:var(--color-surface-paper);border-radius:var(--radius-xl);box-shadow:var(--shadow-elevation-4);width:100%;max-width:520px;max-height:90vh;display:flex;flex-direction:column;transform:translateY(12px) scale(.98);opacity:0;transition:transform var(--duration-base) var(--ease-standard), opacity var(--duration-base) var(--ease-standard);}
.modal-wrap.is-open .modal{transform:translateY(0) scale(1);opacity:1;}
.modal--sm{max-width:400px;}
.modal--lg{max-width:760px;}
.modal__head{display:flex;align-items:center;gap:12px;padding:18px 22px;border-bottom:1px solid var(--color-border-subtle);}
.modal__title{font-family:var(--font-display);font-weight:700;font-size:18px;flex:1;}
.modal__close{flex:none;}
.modal__body{padding:22px;overflow-y:auto;font-size:var(--text-sm);line-height:var(--leading-base);}
.modal__foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 22px;border-top:1px solid var(--color-border-subtle);background:var(--color-surface-sunken);}

.drawer-wrap{position:fixed;inset:0;z-index:91;display:flex;justify-content:flex-end;}
.drawer{background:var(--color-surface-paper);box-shadow:var(--shadow-elevation-4);width:100%;max-width:460px;height:100%;display:flex;flex-direction:column;transform:translateX(100%);transition:transform var(--duration-base) var(--ease-standard);}
.drawer-wrap.is-open .drawer{transform:translateX(0);}
.drawer__head{display:flex;align-items:center;gap:12px;padding:18px 22px;border-bottom:1px solid var(--color-border-subtle);}
.drawer__title{font-family:var(--font-display);font-weight:700;font-size:18px;flex:1;}
.drawer__body{padding:22px;overflow-y:auto;flex:1;font-size:var(--text-sm);}
.drawer__foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 22px;border-top:1px solid var(--color-border-subtle);background:var(--color-surface-sunken);}

.toast-region{position:fixed;bottom:24px;right:24px;z-index:95;display:flex;flex-direction:column;gap:10px;max-width:360px;}
.toast{display:flex;align-items:flex-start;gap:10px;background:var(--neutral-950);color:#fff;padding:14px 16px;border-radius:var(--radius-md);box-shadow:var(--shadow-elevation-4);font-size:var(--text-sm);transform:translateY(8px);opacity:0;transition:transform var(--duration-base) var(--ease-standard), opacity var(--duration-base) var(--ease-standard);}
.toast.is-open{transform:translateY(0);opacity:1;}
.toast svg{width:18px;height:18px;flex:none;margin-top:1px;}
.toast--success svg{color:var(--clinical-normal-text-dk);}
.toast--danger svg{color:#ff8b85;}
.toast--warn svg{color:var(--brand-300);}
.toast--info svg{color:#9dc2e8;}
.toast__close{flex:none;margin-left:auto;color:rgba(255,255,255,.6);}

@media (max-width:480px){
  .toast-region{left:16px;right:16px;bottom:16px;max-width:none;}
}

/* ============================================================================
   11. RESPONSIVE BREAKPOINTS — 640 / 960 / 1280
   ============================================================================ */
@media (min-width:640px){
  .topbar__search{display:block;}
}

@media (min-width:960px){
  .pub-header__toggle{display:none;}
  .topbar__menu-btn{display:none;}
  .bottom-tab-bar{display:none;}
}

@media (max-width:959px){
  .shell-portal{grid-template-columns:1fr;}
  .sidebar{position:fixed;left:0;top:0;bottom:0;transform:translateX(-100%);transition:transform var(--duration-base) var(--ease-standard);width:280px;}
  .sidebar.is-open{transform:translateX(0);}
  .portal-main{grid-column:1;}
  .topbar__menu-btn{display:inline-flex;}
  .bottom-tab-bar{display:block;}
  .portal-content{padding-bottom:calc(var(--bottom-tabs-h) + 24px);}
  .rx-builder{grid-template-columns:1fr;}
  .rx-builder__preview{position:static;}
}

@media (max-width:1279px){
  .pub-nav{display:none;}
  .pub-header__toggle{display:inline-flex;}
}

@media (max-width:959px){
  .pub-header__actions .btn--secondary,
  .pub-header__actions .btn--primary,
  .pub-header__actions .btn--accent{display:none;}
  .pub-header__brand{min-width:0;}
}

@media (max-width:639px){
  /* portal topbar on a phone: show only the language you can switch TO, so the page title keeps its room */
  .topbar__actions [data-lang][aria-pressed="true"]{display:none;}
  .topbar__actions [data-lang][aria-pressed="false"]{border-radius:var(--radius-md);margin-left:0;}
  .grid--2,.grid--3,.grid--4,.grid--auto{grid-template-columns:1fr;}
  .pub-footer__grid{grid-template-columns:1fr;gap:24px;}
  .kv{grid-template-columns:1fr;}
  .kv dt{padding-bottom:0;}
  .stepper{flex-direction:row;flex-wrap:wrap;align-items:center;}
  .stepper__summary{display:block;flex:0 0 100%;font-size:var(--text-sm);font-weight:700;color:var(--color-ink-primary);margin-bottom:10px;}
  .stepper__step{flex:1 1 34px;flex-direction:row;align-items:center;min-width:34px;}
  .stepper__step:last-child{flex:0 0 28px;min-width:28px;}
  .stepper__bubble{width:28px;height:28px;font-size:12px;}
  .stepper__label{display:none;}
  .stepper__line{flex:1;width:auto;height:2px;margin:0 4px;min-width:6px;}
  .rx-sheet,.lab-report{padding:16px 14px;}
  .rx-sheet__cols{grid-template-columns:1fr;}
  .rx-sheet__patient{grid-template-columns:1fr 1fr;}
  .card__head{flex-wrap:wrap;}
  .modal-wrap,.drawer-wrap{padding:0;}
  .modal{max-height:100vh;border-radius:var(--radius-lg) var(--radius-lg) 0 0;align-self:flex-end;margin-top:auto;}
  .modal-wrap{align-items:flex-end;}
  .toolbar{flex-direction:column;align-items:stretch;}
  .toolbar__search{max-width:none;}
  .toolbar__group>.select,.toolbar__group>.input,.filter-field{max-width:none;flex-basis:100%;}
  .video-room__grid{grid-template-columns:1fr;}
  .plan-card{padding:20px;}

  /* table -> stacked cards */
  .table--cards thead{display:none;}
  .table--cards,.table--cards tbody,.table--cards tr,.table--cards td{display:block;width:100%;}
  .table--cards tr{border:1px solid var(--color-border-subtle);border-radius:var(--radius-md);margin-bottom:12px;padding:6px 14px;background:var(--color-surface-paper);}
  .table--cards tbody tr:nth-child(even){background:var(--color-surface-paper);}
  .table--cards td{border-bottom:1px solid var(--color-border-subtle);padding:10px 0;display:flex;justify-content:space-between;align-items:center;gap:12px;text-align:right;}
  .table--cards td:last-child{border-bottom:none;}
  .table--cards td::before{content:attr(data-label);font-weight:700;color:var(--color-ink-muted);font-size:11px;text-transform:uppercase;letter-spacing:.03em;text-align:left;}
  .table--cards .table__actions{justify-content:flex-end;}
}

@media (min-width:1280px){
  .grid--4{grid-template-columns:repeat(4,1fr);}
}

/* ============================================================================
   12. PRINT — .rx-sheet / .lab-report / .receipt print exactly; printables force light
   ============================================================================ */
@media print{
  @page{size:A4;margin:0;}
  html,body{background:#fff;}
  .sidebar,.topbar,.pub-header,.pub-footer,.bottom-tab-bar,.btn-row,.no-print,
  .toolbar,.pagination,.overlay-scrim,.modal-wrap,.drawer-wrap,.toast-region{display:none!important;}
  .portal-content{padding:0;max-width:none;}
  .shell-portal{display:block;}
  .rx-sheet,.lab-report,.receipt{box-shadow:none;border:none;width:210mm;min-height:297mm;margin:0;padding:14mm 16mm;max-width:none;
    background:#fff!important;color:#12211f!important;}
  .rx-sheet--a5{width:148mm;min-height:210mm;padding:10mm 8mm;}
  .card{box-shadow:none;}
}
@page rx-a5{size:A5;margin:0;}
.rx-sheet--a5{ }

/* ============================================================================
   13. REDUCED MOTION
   ============================================================================ */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important;}
  .reveal,.reveal-group>*{animation:none!important;opacity:1!important;transform:none!important;}
}
