/* ============================================================================
   ORCHID — MATERIAL 3 DESIGN SYSTEM (single authority)
   File: static/orchid-m3.css          loaded by templates/base.html

   Every colour, type step, shape, elevation, spacing step and motion curve the
   product is allowed to use lives here. Screens COMPOSE these classes; they
   never invent a colour, a radius or a font size. If a value is not here, it
   does not ship. (The legacy static/orchid.css is retired: nothing may use the
   old .btn/.badge/.card/.metric-* class names any more.)

   01 tokens   colour roles · type ramp · shape · elevation · spacing · state · motion
   02 shell    app bar · navigation drawer · content frame
   03 parts    buttons · cards · chips · stats · tables · fields · feedback · lists · nav
   04 utils    layout + text helpers
   ========================================================================= */

/* ---------------------------------------------------------------- 00 type */

/* One self-hosted family (Inter, SIL OFL) — no third-party font CDN, works
   offline, and renders the same on every machine. Variable weight 100-900. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}

/* ---------------------------------------------------------------- 01 tokens */

:root {
  /* tonal palettes — Material 3, ORCHID BRAND seed #7C3AED (one accent, one grey family) */
  --p-10: #2b0a50; --p-20: #43126d; --p-30: #5e1f8f; --p-40: #7c3aed;
  --p-50: #9753f0; --p-60: #a96ef4; --p-70: #bd8bf7; --p-80: #d3b1fb;
  --p-90: #ead6ff; --p-95: #f5ebff; --p-99: #fdf9ff;
  --s-10: #0b1f2a; --s-20: #20343f; --s-30: #364b57; --s-40: #4e626f;
  --s-50: #667b88; --s-60: #8095a2; --s-70: #9aafbd; --s-80: #b6cbd9;
  --s-90: #d2e7f6; --s-95: #e5f2ff; --s-99: #f7f9ff;
  --t-10: #2a1700; --t-20: #452b00; --t-30: #624000; --t-40: #7f5600;
  --t-50: #9e6d00; --t-60: #be8500; --t-70: #df9e00; --t-80: #ffb94c;
  --t-90: #ffddb3; --t-95: #ffeedc;
  --n-0: #ffffff; --n-4: #f5f8fa; --n-6: #f0f4f8; --n-10: #e6eaee;
  --n-12: #dfe3e7; --n-17: #d3d7db; --n-22: #bdc1c7; --n-24: #b4b8be;
  --n-30: #a3a7ad; --n-40: #8a8f95; --n-50: #73777d; --n-60: #5c6066;
  --n-70: #45494e; --n-80: #2f3337; --n-87: #202428; --n-90: #1a1e22;
  --n-92: #15191d; --n-94: #11151a; --n-95: #0f1317; --n-96: #0c1014;
  --n-98: #080c10; --n-100: #000000;
  --nv-10: #191c1f; --nv-20: #2e3134; --nv-30: #44474a; --nv-40: #5c5f61;
  --nv-50: #74777a; --nv-60: #8e9193; --nv-70: #a9acae; --nv-80: #c4c7c9;
  --nv-90: #e0e3e5; --nv-95: #eff1f3; --nv-99: #fcfcfe;
  --g-20: #0b3b21; --g-30: #14532f; --g-40: #1e6b45; --g-70: #4cc38a; --g-90: #bdf0d5;
  --a-20: #4d2c00; --a-30: #6b3f00; --a-40: #8a5300; --a-70: #f2b544; --a-90: #ffe6bd;
  --r-20: #690005; --r-30: #93000a; --r-40: #ba1a1a; --r-70: #ff897d; --r-90: #ffdad6;

  /* colour roles — light scheme */
  --md-sys-color-primary: var(--p-40);
  --md-sys-color-on-primary: var(--n-0);
  --md-sys-color-primary-container: var(--p-90);
  --md-sys-color-on-primary-container: var(--p-10);
  --md-sys-color-secondary: var(--s-40);
  --md-sys-color-on-secondary: var(--n-0);
  --md-sys-color-secondary-container: var(--s-90);
  --md-sys-color-on-secondary-container: var(--s-10);
  --md-sys-color-tertiary: var(--t-40);
  --md-sys-color-on-tertiary: var(--n-0);
  --md-sys-color-tertiary-container: var(--t-90);
  --md-sys-color-on-tertiary-container: var(--t-10);
  --md-sys-color-error: var(--r-40);
  --md-sys-color-on-error: var(--n-0);
  --md-sys-color-error-container: var(--r-90);
  --md-sys-color-on-error-container: var(--r-30);
  --md-sys-color-success: var(--g-40);
  --md-sys-color-on-success: var(--n-0);
  --md-sys-color-success-container: var(--g-90);
  --md-sys-color-on-success-container: var(--g-20);
  --md-sys-color-warning: var(--a-40);
  --md-sys-color-on-warning: var(--n-0);
  --md-sys-color-warning-container: var(--a-90);
  --md-sys-color-on-warning-container: var(--a-20);
  --md-sys-color-background: var(--n-6);
  --md-sys-color-on-background: var(--nv-10);
  --md-sys-color-surface: var(--n-6);
  --md-sys-color-on-surface: var(--nv-10);
  --md-sys-color-surface-variant: var(--nv-90);
  --md-sys-color-on-surface-variant: var(--nv-30);
  --md-sys-color-surface-container-lowest: var(--n-0);
  --md-sys-color-surface-container-low: var(--nv-99);
  --md-sys-color-surface-container: var(--nv-95);
  --md-sys-color-surface-container-high: var(--nv-90);
  --md-sys-color-surface-container-highest: var(--nv-90);
  --md-sys-color-inverse-surface: var(--nv-20);
  --md-sys-color-inverse-on-surface: var(--nv-95);
  --md-sys-color-outline: var(--nv-50);
  --md-sys-color-outline-variant: var(--nv-80);
  --md-sys-color-control-border: transparent;
  --md-sys-color-scrim: var(--n-100);
  --md-sys-color-shadow: var(--n-100);

  /* type: one family, one ramp */
  --md-sys-typescale-font: "Inter", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-sys-typescale-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --md-sys-typescale-display-large-size: 57px;   --md-sys-typescale-display-large-line: 64px;
  --md-sys-typescale-display-medium-size: 45px;  --md-sys-typescale-display-medium-line: 52px;
  --md-sys-typescale-display-small-size: 36px;   --md-sys-typescale-display-small-line: 44px;
  --md-sys-typescale-headline-large-size: 32px;  --md-sys-typescale-headline-large-line: 40px;
  --md-sys-typescale-headline-medium-size: 28px; --md-sys-typescale-headline-medium-line: 36px;
  --md-sys-typescale-headline-small-size: 24px;  --md-sys-typescale-headline-small-line: 32px;
  --md-sys-typescale-title-large-size: 22px;     --md-sys-typescale-title-large-line: 28px;
  --md-sys-typescale-title-medium-size: 16px;    --md-sys-typescale-title-medium-line: 24px;
  --md-sys-typescale-title-small-size: 14px;     --md-sys-typescale-title-small-line: 20px;
  --md-sys-typescale-body-large-size: 16px;      --md-sys-typescale-body-large-line: 24px;
  --md-sys-typescale-body-medium-size: 14px;     --md-sys-typescale-body-medium-line: 20px;
  --md-sys-typescale-body-small-size: 12px;      --md-sys-typescale-body-small-line: 16px;
  --md-sys-typescale-label-large-size: 14px;     --md-sys-typescale-label-large-line: 20px;
  --md-sys-typescale-label-medium-size: 12px;    --md-sys-typescale-label-medium-line: 16px;
  --md-sys-typescale-label-small-size: 11px;     --md-sys-typescale-label-small-line: 16px;
  --md-sys-typescale-weight-regular: 400;
  --md-sys-typescale-weight-medium: 500;
  --md-sys-typescale-weight-semibold: 600;
  --md-sys-typescale-weight-bold: 700;

  /* shape: one radius scale, stated as a rule
     actions are pills · fields 4 · cards/lists 12 · sheets/hero 16-28 */
  --md-sys-shape-corner-none: 0;
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-sm: 8px;
  --md-sys-shape-corner-md: 12px;
  --md-sys-shape-corner-lg: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 999px;

  /* elevation: one system, for hierarchy not decoration */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, .08), 0 1px 3px 1px rgba(0, 0, 0, .06);
  --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, .10), 0 2px 6px 2px rgba(0, 0, 0, .06);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .07), 0 1px 3px rgba(0, 0, 0, .10);
  --md-sys-elevation-4: 0 6px 10px 4px rgba(0, 0, 0, .08), 0 2px 3px rgba(0, 0, 0, .10);

  /* spacing: 4px rhythm */
  --md-sys-space-1: 4px;  --md-sys-space-2: 8px;  --md-sys-space-3: 12px;
  --md-sys-space-4: 16px; --md-sys-space-5: 20px; --md-sys-space-6: 24px;
  --md-sys-space-8: 32px; --md-sys-space-10: 40px; --md-sys-space-12: 48px;
  --md-sys-layout-content-max: 1240px;
  --md-sys-layout-drawer-width: 264px;
  --md-sys-layout-appbar-height: 64px;

  /* state layers */
  --md-sys-state-hover-opacity: .08;
  --md-sys-state-focus-opacity: .10;
  --md-sys-state-pressed-opacity: .10;

  /* motion: named, under 300ms, strong ease-out */
  --md-sys-motion-short: 150ms;
  --md-sys-motion-medium: 250ms;
  --md-sys-motion-long: 400ms;
  --md-sys-motion-easing-standard: cubic-bezier(.2, 0, 0, 1);
  --md-sys-motion-easing-exit: cubic-bezier(.4, 0, 1, 1);
}

/* dark scheme — follows the system unless the user pinned a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --md-dark-scheme: 1; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-sys-color-primary: var(--p-80); --md-sys-color-on-primary: var(--p-20);
    --md-sys-color-primary-container: var(--p-30); --md-sys-color-on-primary-container: var(--p-90);
    --md-sys-color-secondary: var(--s-80); --md-sys-color-on-secondary: var(--s-20);
    --md-sys-color-secondary-container: var(--s-30); --md-sys-color-on-secondary-container: var(--s-90);
    --md-sys-color-tertiary: var(--t-80); --md-sys-color-on-tertiary: var(--t-20);
    --md-sys-color-tertiary-container: var(--t-30); --md-sys-color-on-tertiary-container: var(--t-90);
    --md-sys-color-error: var(--r-70); --md-sys-color-on-error: var(--r-20);
    --md-sys-color-error-container: var(--r-30); --md-sys-color-on-error-container: var(--r-90);
    --md-sys-color-success: var(--g-70); --md-sys-color-on-success: var(--g-20);
    --md-sys-color-success-container: var(--g-30); --md-sys-color-on-success-container: var(--g-90);
    --md-sys-color-warning: var(--a-70); --md-sys-color-on-warning: var(--a-20);
    --md-sys-color-warning-container: var(--a-30); --md-sys-color-on-warning-container: var(--a-90);
    --md-sys-color-background: var(--n-95); --md-sys-color-on-background: var(--nv-90);
    --md-sys-color-surface: var(--n-95); --md-sys-color-on-surface: var(--nv-90);
    --md-sys-color-surface-variant: var(--nv-30); --md-sys-color-on-surface-variant: var(--nv-80);
    --md-sys-color-surface-container-lowest: var(--n-98);
    --md-sys-color-surface-container-low: var(--n-94);
    --md-sys-color-surface-container: var(--n-92);
    --md-sys-color-surface-container-high: var(--n-90);
    --md-sys-color-surface-container-highest: var(--n-87);
    --md-sys-color-inverse-surface: var(--nv-90); --md-sys-color-inverse-on-surface: var(--nv-20);
    --md-sys-color-outline: var(--nv-60); --md-sys-color-outline-variant: var(--nv-30);
    --md-sys-color-control-border: color-mix(in srgb, var(--md-sys-color-on-secondary-container) 40%, transparent);
  }
}
:root[data-theme="dark"] {
  --md-sys-color-primary: var(--p-80); --md-sys-color-on-primary: var(--p-20);
  --md-sys-color-primary-container: var(--p-30); --md-sys-color-on-primary-container: var(--p-90);
  --md-sys-color-secondary: var(--s-80); --md-sys-color-on-secondary: var(--s-20);
  --md-sys-color-secondary-container: var(--s-30); --md-sys-color-on-secondary-container: var(--s-90);
  --md-sys-color-tertiary: var(--t-80); --md-sys-color-on-tertiary: var(--t-20);
  --md-sys-color-tertiary-container: var(--t-30); --md-sys-color-on-tertiary-container: var(--t-90);
  --md-sys-color-error: var(--r-70); --md-sys-color-on-error: var(--r-20);
  --md-sys-color-error-container: var(--r-30); --md-sys-color-on-error-container: var(--r-90);
  --md-sys-color-success: var(--g-70); --md-sys-color-on-success: var(--g-20);
  --md-sys-color-success-container: var(--g-30); --md-sys-color-on-success-container: var(--g-90);
  --md-sys-color-warning: var(--a-70); --md-sys-color-on-warning: var(--a-20);
  --md-sys-color-warning-container: var(--a-30); --md-sys-color-on-warning-container: var(--a-90);
  --md-sys-color-background: var(--n-95); --md-sys-color-on-background: var(--nv-90);
  --md-sys-color-surface: var(--n-95); --md-sys-color-on-surface: var(--nv-90);
  --md-sys-color-surface-variant: var(--nv-30); --md-sys-color-on-surface-variant: var(--nv-80);
  --md-sys-color-surface-container-lowest: var(--n-98);
  --md-sys-color-surface-container-low: var(--n-94);
  --md-sys-color-surface-container: var(--n-92);
  --md-sys-color-surface-container-high: var(--n-90);
  --md-sys-color-surface-container-highest: var(--n-87);
  --md-sys-color-inverse-surface: var(--nv-90); --md-sys-color-inverse-on-surface: var(--nv-20);
  --md-sys-color-outline: var(--nv-60); --md-sys-color-outline-variant: var(--nv-30);
  --md-sys-color-control-border: color-mix(in srgb, var(--md-sys-color-on-secondary-container) 40%, transparent);
}

/* ---------------------------------------------------------------- 02 reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--md-sys-typescale-font);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-background);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, p, dl, dd, figure { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--md-sys-color-primary); text-decoration: none; border-radius: var(--md-sys-shape-corner-xs); }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
:focus-visible { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }

/* type roles — the only sizes the product uses */
.md-display-l { font-size: var(--md-sys-typescale-display-large-size); line-height: var(--md-sys-typescale-display-large-line); font-weight: var(--md-sys-typescale-weight-regular); letter-spacing: -.25px; }
.md-display-m { font-size: var(--md-sys-typescale-display-medium-size); line-height: var(--md-sys-typescale-display-medium-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-display-s { font-size: var(--md-sys-typescale-display-small-size); line-height: var(--md-sys-typescale-display-small-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-headline-l { font-size: var(--md-sys-typescale-headline-large-size); line-height: var(--md-sys-typescale-headline-large-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-headline-m { font-size: var(--md-sys-typescale-headline-medium-size); line-height: var(--md-sys-typescale-headline-medium-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-headline-s { font-size: var(--md-sys-typescale-headline-small-size); line-height: var(--md-sys-typescale-headline-small-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-title-l { font-size: var(--md-sys-typescale-title-large-size); line-height: var(--md-sys-typescale-title-large-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-title-m { font-size: var(--md-sys-typescale-title-medium-size); line-height: var(--md-sys-typescale-title-medium-line); font-weight: var(--md-sys-typescale-weight-medium); }
.md-title-s { font-size: var(--md-sys-typescale-title-small-size); line-height: var(--md-sys-typescale-title-small-line); font-weight: var(--md-sys-typescale-weight-medium); }
.md-body-l { font-size: var(--md-sys-typescale-body-large-size); line-height: var(--md-sys-typescale-body-large-line); }
.md-body-m { font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line); }
.md-body-s { font-size: var(--md-sys-typescale-body-small-size); line-height: var(--md-sys-typescale-body-small-line); }
.md-label-l { font-size: var(--md-sys-typescale-label-large-size); line-height: var(--md-sys-typescale-label-large-line); font-weight: var(--md-sys-typescale-weight-medium); }
.md-label-m { font-size: var(--md-sys-typescale-label-medium-size); line-height: var(--md-sys-typescale-label-medium-line); font-weight: var(--md-sys-typescale-weight-medium); letter-spacing: .5px; }
.md-label-s { font-size: var(--md-sys-typescale-label-small-size); line-height: var(--md-sys-typescale-label-small-line); font-weight: var(--md-sys-typescale-weight-medium); letter-spacing: .5px; }

/* ---------------------------------------------------------------- 02 shell */

.md-app-shell {
  display: grid; grid-template-columns: var(--md-sys-layout-drawer-width) 1fr; min-height: 100vh;
  /* the drawer's surface runs the whole page height, so the rail never appears
     to stop below the fold on a long screen */
  background: linear-gradient(to right,
    var(--md-sys-color-surface-container-low) 0 var(--md-sys-layout-drawer-width),
    var(--md-sys-color-background) var(--md-sys-layout-drawer-width));
}

.md-nav-drawer {
  background: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  padding: var(--md-sys-space-4) var(--md-sys-space-3);
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
/* only the nav list scrolls: the brand and the signed-in user stay pinned, so a
   long IA never clips the account block off the bottom of the viewport */
.md-nav-drawer > nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
}
.md-nav-drawer__brand { display: flex; align-items: center; gap: var(--md-sys-space-3); padding: var(--md-sys-space-2) var(--md-sys-space-3) var(--md-sys-space-3); }
.md-nav-drawer__mark {
  width: 40px; height: 40px; flex: none; display: block;
  object-fit: contain; border-radius: var(--md-sys-shape-corner-md);
}
span.md-nav-drawer__mark {
  display: grid; place-items: center;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font-size: var(--md-sys-typescale-title-large-size); font-weight: var(--md-sys-typescale-weight-bold);
}
.md-nav-drawer__name { font-size: var(--md-sys-typescale-title-medium-size); font-weight: var(--md-sys-typescale-weight-semibold); line-height: 1.15; }
.md-nav-drawer__caption { font-size: var(--md-sys-typescale-label-small-size); color: var(--md-sys-color-on-surface-variant); }
.md-nav-section { margin-top: var(--md-sys-space-4); padding: 0 var(--md-sys-space-4) var(--md-sys-space-1); font-size: var(--md-sys-typescale-label-small-size); font-weight: var(--md-sys-typescale-weight-semibold); letter-spacing: .8px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); }
.md-nav-item {
  display: flex; align-items: center; gap: var(--md-sys-space-3);
  min-height: 44px; padding: 0 var(--md-sys-space-4); border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-large-size); font-weight: var(--md-sys-typescale-weight-medium);
  transition: background var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md-nav-item:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-opacity), transparent); text-decoration: none; }
.md-nav-item[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-weight: var(--md-sys-typescale-weight-semibold); }
.md-nav-item__icon { flex: none; }
.md-nav-drawer__user { padding: var(--md-sys-space-4) var(--md-sys-space-3) 0; border-top: 1px solid var(--md-sys-color-outline-variant); }

.md-main { display: flex; flex-direction: column; min-width: 0; }
.md-app-bar {
  position: sticky; top: 0; z-index: 5; min-height: var(--md-sys-layout-appbar-height);
  display: flex; align-items: center; gap: var(--md-sys-space-4);
  padding: var(--md-sys-space-3) var(--md-sys-space-6);
  background: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md-app-bar__title { font-size: var(--md-sys-typescale-title-large-size); font-weight: var(--md-sys-typescale-weight-regular); }
.md-app-bar__spacer { flex: 1; }
.md-content { padding: var(--md-sys-space-6); display: flex; flex-direction: column; gap: var(--md-sys-space-6); max-width: var(--md-sys-layout-content-max); width: 100%; }
.md-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--md-sys-space-4); flex-wrap: wrap; }
.md-page-header__eyebrow { font-size: var(--md-sys-typescale-label-small-size); font-weight: var(--md-sys-typescale-weight-semibold); letter-spacing: .8px; text-transform: uppercase; color: var(--md-sys-color-primary); }
.md-page-header__title { font-size: var(--md-sys-typescale-headline-medium-size); line-height: var(--md-sys-typescale-headline-medium-line); font-weight: var(--md-sys-typescale-weight-regular); }
.md-page-header__sub { color: var(--md-sys-color-on-surface-variant); max-width: 76ch; }
.md-page-header__actions { display: flex; align-items: center; gap: var(--md-sys-space-2); flex-wrap: wrap; }
.md-breadcrumb { display: flex; align-items: center; gap: var(--md-sys-space-2); font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }
.md-breadcrumb__sep { opacity: .55; }

/* ---------------------------------------------------------------- 03 buttons */

.md-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--md-sys-space-2); min-height: 40px; padding: 0 var(--md-sys-space-5);
  border: 1px solid transparent; border-radius: var(--md-sys-shape-corner-full);
  background: transparent; color: var(--md-sys-color-primary);
  font-size: var(--md-sys-typescale-label-large-size); font-weight: var(--md-sys-typescale-weight-medium);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: box-shadow var(--md-sys-motion-short) var(--md-sys-motion-easing-standard),
              background var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md-btn:hover { text-decoration: none; }
.md-btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); box-shadow: var(--md-sys-elevation-1); }
.md-btn--filled:hover { box-shadow: var(--md-sys-elevation-2); }
.md-btn--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  /* a hairline boundary: in the dark scheme the container sits close to the app-bar
     surface, and a control's edge must stay visible (WCAG 1.4.11) */
  border-color: var(--md-sys-color-control-border);
}
.md-btn--outlined { border-color: var(--md-sys-color-outline); color: var(--md-sys-color-primary); }
.md-btn--outlined:hover { background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-opacity), transparent); }
.md-btn--text { padding: 0 var(--md-sys-space-3); }
.md-btn--text:hover { background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-opacity), transparent); }
.md-btn--danger { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
.md-btn--danger-outlined { border-color: var(--md-sys-color-error); color: var(--md-sys-color-error); }
.md-btn--sm { min-height: 32px; padding: 0 var(--md-sys-space-4); font-size: var(--md-sys-typescale-label-medium-size); }
.md-btn--block { width: 100%; }
.md-btn--start { justify-content: flex-start; }
.md-btn[disabled], .md-btn[aria-disabled="true"] { opacity: .38; pointer-events: none; box-shadow: none; }
.md-icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: none; border-radius: var(--md-sys-shape-corner-full); background: transparent;
  color: var(--md-sys-color-on-surface-variant); cursor: pointer; text-decoration: none;
}
.md-icon-btn:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-opacity), transparent); text-decoration: none; }
.md-btn-group { display: inline-flex; gap: var(--md-sys-space-2); flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- 03 cards */

.md-card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md);
  padding: var(--md-sys-space-5);
  display: flex; flex-direction: column; gap: var(--md-sys-space-4);
}
.md-card--elevated { background: var(--md-sys-color-surface-container-lowest); border-color: transparent; box-shadow: var(--md-sys-elevation-1); }
.md-card--filled { background: var(--md-sys-color-surface-container-high); border-color: transparent; }
.md-card--outlined { background: var(--md-sys-color-surface-container-lowest); }
.md-card--flush { padding: 0; overflow: hidden; }
.md-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--md-sys-space-3); }
.md-card__title { font-size: var(--md-sys-typescale-title-medium-size); line-height: var(--md-sys-typescale-title-medium-line); font-weight: var(--md-sys-typescale-weight-medium); }
.md-card__eyebrow { font-size: var(--md-sys-typescale-label-small-size); font-weight: var(--md-sys-typescale-weight-semibold); letter-spacing: .8px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); }
.md-card__body { color: var(--md-sys-color-on-surface-variant); }
.md-card__actions { display: flex; align-items: center; gap: var(--md-sys-space-2); flex-wrap: wrap; }
.md-card__footer { border-top: 1px solid var(--md-sys-color-outline-variant); padding-top: var(--md-sys-space-3); color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-small-size); }

/* ---------------------------------------------------------------- 03 chips */

.md-chip {
  display: inline-flex; align-items: center; gap: var(--md-sys-space-2);
  min-height: 28px; padding: 0 var(--md-sys-space-3);
  border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-sm);
  background: transparent; color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-medium-size); font-weight: var(--md-sys-typescale-weight-medium);
  white-space: nowrap;
}
.md-chip--neutral { background: var(--md-sys-color-surface-container-high); border-color: transparent; }
.md-chip--info { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border-color: transparent; }
.md-chip--ok { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); border-color: transparent; }
.md-chip--warn { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); border-color: transparent; }
.md-chip--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); border-color: transparent; }
.md-chip--accent { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); border-color: transparent; }
.md-chip--selected { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; }
.md-dot { width: 8px; height: 8px; border-radius: var(--md-sys-shape-corner-full); background: currentColor; flex: none; }

/* ---------------------------------------------------------------- 03 stats */

.md-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--md-sys-space-4); }
.md-stat {
  display: flex; flex-direction: column; gap: var(--md-sys-space-1);
  background: var(--md-sys-color-surface-container-low); border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md); padding: var(--md-sys-space-4); color: inherit;
}
a.md-stat:hover { text-decoration: none; border-color: var(--md-sys-color-primary); }
.md-stat__top { display: flex; align-items: center; justify-content: space-between; gap: var(--md-sys-space-2); }
.md-stat__icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--md-sys-shape-corner-sm); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.md-stat__label { font-size: var(--md-sys-typescale-label-medium-size); font-weight: var(--md-sys-typescale-weight-semibold); letter-spacing: .5px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); }
.md-stat__value { font-size: var(--md-sys-typescale-headline-medium-size); line-height: 1.15; font-weight: var(--md-sys-typescale-weight-semibold); font-variant-numeric: tabular-nums; }
.md-stat__support { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }

/* ---------------------------------------------------------------- 03 tables */

.md-table-wrap { overflow-x: auto; border-radius: var(--md-sys-shape-corner-md); }
.md-table { width: 100%; border-collapse: collapse; font-size: var(--md-sys-typescale-body-medium-size); }
.md-table caption { text-align: left; padding: 0; color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-small-size); }
.md-table th {
  text-align: left; padding: var(--md-sys-space-3) var(--md-sys-space-4);
  font-size: var(--md-sys-typescale-label-medium-size); font-weight: var(--md-sys-typescale-weight-semibold);
  letter-spacing: .5px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant); white-space: nowrap;
}
.md-table td { padding: var(--md-sys-space-3) var(--md-sys-space-4); border-bottom: 1px solid var(--md-sys-color-outline-variant); vertical-align: top; }
.md-table tbody tr:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 4%, transparent); }
.md-table tbody tr:last-child td { border-bottom: none; }
.md-table--numeric td.md-num, .md-table th.md-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.md-table__primary { font-weight: var(--md-sys-typescale-weight-medium); }
.md-table__secondary { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-small-size); }
.md-table--compact td, .md-table--compact th { padding: var(--md-sys-space-2) var(--md-sys-space-3); }
/* a select inside a row must show its whole option ("Submitted to scheme"), never clip */
.md-table .md-select { width: auto; min-width: 11rem; }

/* ---------------------------------------------------------------- 03 forms */

.md-field { display: flex; flex-direction: column; gap: var(--md-sys-space-1); }
.md-field__label { font-size: var(--md-sys-typescale-body-small-size); font-weight: var(--md-sys-typescale-weight-medium); color: var(--md-sys-color-on-surface-variant); }
.md-field__helper { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }
.md-field__error { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-error); }
.md-input, .md-select, .md-textarea {
  width: 100%; min-height: 48px; padding: var(--md-sys-space-3) var(--md-sys-space-4);
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-xs);
  color: var(--md-sys-color-on-surface);
  transition: border-color var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md-input:hover, .md-select:hover, .md-textarea:hover { border-color: var(--md-sys-color-on-surface); }
.md-input:focus, .md-select:focus, .md-textarea:focus { outline: none; border-color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-primary); }
.md-input--error { border-color: var(--md-sys-color-error); }
/* a trailing action inside a text field (e.g. show/hide a password) */
.md-field__control { position: relative; display: block; }
.md-field__control .md-input { padding-right: var(--md-sys-space-12); }
.md-field__control .md-icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.md-textarea { min-height: 120px; resize: vertical; }
.md-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--md-sys-space-4); }
.md-check { display: flex; align-items: flex-start; gap: var(--md-sys-space-3); font-size: var(--md-sys-typescale-body-medium-size); }
/* the class may sit on the input itself or on a wrapping label — both must look right */
.md-check[type="checkbox"], .md-check[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--md-sys-color-primary); flex: none; }

/* a preformatted body (a correspondence letter, a source's full text): preserves
   alignment and wraps, without pretending to be code */
.md-pre {
  font-family: var(--md-sys-typescale-mono);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 32rem;
  overflow: auto;
  margin: 0;
  padding: var(--md-sys-space-4);
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-sm);
  color: var(--md-sys-color-on-surface);
}
.md-check input[type="checkbox"], .md-check input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--md-sys-color-primary); flex: none; }
.md-filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--md-sys-space-3);
  background: var(--md-sys-color-surface-container-low); border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md); padding: var(--md-sys-space-4);
}
.md-filter-bar .md-field { min-width: 190px; }
.md-inline-form { display: inline-flex; align-items: center; gap: var(--md-sys-space-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- 03 feedback */

.md-banner {
  display: flex; align-items: flex-start; gap: var(--md-sys-space-3);
  padding: var(--md-sys-space-3) var(--md-sys-space-4);
  border-radius: var(--md-sys-shape-corner-sm);
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-body-medium-size);
}
.md-banner--info { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.md-banner--ok { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.md-banner--warn { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.md-banner--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.md-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--md-sys-space-2);
  padding: var(--md-sys-space-10) var(--md-sys-space-6); text-align: center;
  border: 1px dashed var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-md);
  color: var(--md-sys-color-on-surface-variant);
}
.md-empty__title { font-size: var(--md-sys-typescale-title-medium-size); font-weight: var(--md-sys-typescale-weight-medium); color: var(--md-sys-color-on-surface); }
.md-empty__icon { color: var(--md-sys-color-outline); }
.md-skeleton { background: var(--md-sys-color-surface-container-high); border-radius: var(--md-sys-shape-corner-xs); height: 14px; animation: md-pulse 1.4s ease-in-out infinite; }
@keyframes md-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.md-progress { height: 4px; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-surface-container-high); overflow: hidden; }
.md-progress__bar { height: 100%; background: var(--md-sys-color-primary); }
.md-snackbar-stack { position: fixed; bottom: var(--md-sys-space-6); left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: var(--md-sys-space-2); width: min(560px, calc(100vw - 32px)); }
.md-snackbar-stack .md-banner { box-shadow: var(--md-sys-elevation-3); }
@media (prefers-reduced-motion: reduce) {
  .md-skeleton { animation: none; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------------------------------------------------------------- 03 lists + nav */

.md-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.md-list-item { display: flex; align-items: center; gap: var(--md-sys-space-3); padding: var(--md-sys-space-3) 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.md-list-item:last-child { border-bottom: none; }
.md-list-item__trailing { margin-left: auto; color: var(--md-sys-color-on-surface-variant); }
.md-kv { display: grid; grid-template-columns: minmax(140px, 210px) 1fr; gap: var(--md-sys-space-2) var(--md-sys-space-5); font-size: var(--md-sys-typescale-body-medium-size); }
.md-kv dt { color: var(--md-sys-color-on-surface-variant); }
.md-kv dd { margin: 0; font-weight: var(--md-sys-typescale-weight-medium); overflow-wrap: anywhere; }
.md-tabs { display: flex; gap: var(--md-sys-space-2); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.md-tab { padding: var(--md-sys-space-3) var(--md-sys-space-4); color: var(--md-sys-color-on-surface-variant); font-weight: var(--md-sys-typescale-weight-medium); }
.md-tab[aria-current="page"] { color: var(--md-sys-color-primary); box-shadow: inset 0 -3px 0 0 var(--md-sys-color-primary); }
.md-segmented { display: inline-flex; border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-full); overflow: hidden; }
.md-segmented > * { padding: var(--md-sys-space-2) var(--md-sys-space-4); font-size: var(--md-sys-typescale-label-large-size); color: var(--md-sys-color-on-surface); }
.md-segmented > *[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-pagination { display: flex; align-items: center; gap: var(--md-sys-space-2); font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }

/* ---------------------------------------------------------------- 04 utilities */

.md-stack { display: flex; flex-direction: column; gap: var(--md-sys-space-4); }
.md-stack--tight { gap: var(--md-sys-space-2); }
.md-stack--loose { gap: var(--md-sys-space-6); }
.md-row { display: flex; align-items: center; gap: var(--md-sys-space-3); flex-wrap: wrap; }
.md-row--between { justify-content: space-between; }
.md-grid { display: grid; gap: var(--md-sys-space-4); align-items: start; }
.md-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.md-grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.md-grid--wide-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1080px) { .md-grid--wide-side { grid-template-columns: 1fr; } }
.md-muted { color: var(--md-sys-color-on-surface-variant); }
.md-num { font-variant-numeric: tabular-nums; }
.md-truncate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-divider { height: 1px; background: var(--md-sys-color-outline-variant); border: none; margin: 0; }
.md-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.md-code { font-family: var(--md-sys-typescale-mono); font-size: var(--md-sys-typescale-body-small-size); background: var(--md-sys-color-surface-container-high); padding: 1px var(--md-sys-space-1); border-radius: var(--md-sys-shape-corner-xs); }
.md-nowrap { white-space: nowrap; }
.md-mt-0 { margin-top: 0; }

/* ---------------------------------------------------------------- 05 app additions */

/* icons are inline SVG from the in-repo set (no icon font, no emoji in chrome) */
.md-icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }

/* anonymous shell (sign-in and other unauthenticated screens) */
.md-auth {
  min-height: 100vh; display: grid; place-items: center; padding: var(--md-sys-space-6);
  background:
    radial-gradient(1100px 520px at 12% -8%, var(--md-sys-color-primary-container), transparent 60%),
    var(--md-sys-color-background);
}
.md-auth-card { width: min(420px, 100%); }

/* a status chip used as a row-level indicator should not stretch */
.md-chip--tight { padding: 0 var(--md-sys-space-2); }

@media (max-width: 1024px) {
  .md-app-shell { grid-template-columns: 1fr; }
  .md-nav-drawer { position: static; height: auto; }
  .md-content { padding: var(--md-sys-space-4); }
}
@media print {
  .md-nav-drawer, .md-app-bar { display: none; }
  .md-app-shell { display: block; }
}

/* ============================================================
   Telehealth screens — doxy.me-style video-first layout (ADR-19)
   Patient waiting room + provider consult room share the stage idiom.
   ============================================================ */
.tl-stage-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 340px;
  border: 0;
  border-radius: var(--radius-m, 12px);
  background: #0e1116;
  display: block;
}

.tl-room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: stretch;
  /* doxy layout: notes tuck up under the stage, nothing waits on the rail */
  grid-template-areas:
    "stage rail"
    "notes rail2";
}
.tl-slot-stage { grid-area: stage; }
.tl-slot-rail { grid-area: rail; }
.tl-slot-notes { grid-area: notes; }
.tl-slot-sessions { grid-area: rail2; }
@media (max-width: 1080px) {
  .tl-room-grid { grid-template-columns: 1fr; grid-template-areas: "stage" "rail" "notes" "rail2"; }
}

/* Provider stage: video is the page, controls orbit it */
.tl-stage-card .md-card__footer {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}
.tl-selftest {
  color: var(--md-muted, #6b6f76);
  font-size: var(--font-s, 13px);
}

/* Patient reception hero (doxy waiting-room reception) */
.tl-reception {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--p-40, #7c3aed);
  color: #fff;
  border-radius: var(--radius-m, 12px);
  padding: var(--space-4);
}
.tl-reception img { border-radius: 50%; background: transparent; }
.tl-reception__body h1 { margin: 0; font-size: var(--font-l, 20px); }
.tl-reception__body p { margin: 4px 0 0; opacity: .92; font-size: var(--font-m, 14px); }

.tl-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.tl-tips li { display: flex; gap: var(--space-2); align-items: flex-start; }
.tl-tips li > span:first-child { color: var(--p-40, #7c3aed); margin-top: 3px; }
.tl-tips li > span:first-child svg { width: 18px; height: 18px; }
.tl-reception img { border-radius: 50%; flex: 0 0 auto; max-width: 48px; max-height: 48px; background: #fff; padding: 5px; box-sizing: border-box; }

/* ============================================================
   Telehealth CALL UI — Dribbble 15253652 layout + PHP lobby phases.
   The call is the page: full-bleed video, floating translucent chrome,
   slide-over drawer (right rail on desktop, bottom sheet on mobile).
   Daily's prebuilt owns the in-call controls; Orchid owns the room chrome.
   ============================================================ */
.tl-full { position: fixed; inset: 0; z-index: 80; background: #0e1116; }
.tl-full iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tl-chip { display: inline-flex; gap: 6px; align-items: center;
  background: rgba(20, 22, 31, .72); color: #fff; border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; backdrop-filter: blur(8px); }
.tl-chip svg { width: 16px; height: 16px; }
.tl-chip--warn { border-color: rgba(245, 196, 74, .5); color: #ffd88a; }

/* floating panel/open buttons (translucent dark rounded squares) */
.tl-floatbtn { width: 44px; height: 44px; border-radius: 12px;
  background: rgba(20, 22, 31, .72); color: #fff; border: 1px solid rgba(255,255,255,.16);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  backdrop-filter: blur(8px); }
.tl-floatbtn svg { width: 20px; height: 20px; }
.tl-floatbtn:hover { background: rgba(20, 22, 31, .9); }

/* the slide-over panel: right drawer desktop / bottom sheet mobile */
.tl-drawer { position: absolute; top: 52px; right: 0; bottom: 0; width: min(400px, 94vw);
  background: #fff; color: var(--ink, #2b3038); transform: translateX(104%);
  transition: transform .22s ease; overflow-y: auto; padding: 16px;
  border-radius: 18px 0 0 18px; box-shadow: -18px 0 44px rgba(6,8,14,.5); z-index: 4; }
.tl-drawer[data-open="1"] { transform: none; }
.tl-drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tl-drawer__close { background: #f2f3f7; border: 0; border-radius: 10px; width: 36px; height: 36px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 640px) {
  .tl-drawer { top: 52px; left: 0; right: 0; width: 100%; max-height: calc(76vh - 52px);
    transform: translateY(104%); border-radius: 18px 18px 0 0; box-shadow: 0 -18px 44px rgba(6,8,14,.4); }
  .tl-drawer[data-open="1"] { transform: none; }
}

/* the patient's report, framed in the drawer beside the call. A 400px rail is narrow for
   a mammogram, so the card also carries a full-size link. */
.tl-report-frame { width: 100%; height: 320px; border: 0; border-radius: 12px;
  background: #f2f3f7; display: block; }

/* readiness chips inside the drawer (honest device-test result) */
.tl-ready { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-ready .tl-pill { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.tl-pill-ok { background: #e5f4ea; color: #14452b; }
.tl-pill-bad { background: #fdeaea; color: #7a1d1d; }
.tl-pill-untested { background: #f2f3f7; color: #6b6f76; }

.device-test-card { display: none; }

/* PHASE A: the device-test card (patient), auto-runs on arrival */
.tl-devcard {
  position: absolute; inset: 52px 0 0 0; z-index: 5; overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(10, 12, 16, .82); backdrop-filter: blur(3px);
}
.tl-devcard[hidden] { display: none; }
.tl-devcard__inner { width: min(560px, 100%); background: #fff; border-radius: 18px; padding: 22px; color: #2b3038; }
.tl-devcard__inner video { width: 100%; border-radius: 12px; background: #101216; margin: 12px 0; display: block; }
.tl-audiobar { height: 8px; border-radius: 999px; background: #eceef4; overflow: hidden; margin: 10px 0; }
.tl-audiobar > div { height: 100%; width: 0; background: #2fa96c; transition: width .12s; }
.tl-devbtns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.tl-devbtns .md-btn--filled { background: var(--p-40, #7c3aed); }
.tl-devline { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #6b6f76; margin-top: 8px; }
.tl-devline svg { width: 16px; height: 16px; color: var(--p-40, #7c3aed); flex: 0 0 auto; }
.tl-audiocap { font-size: 12px; color: #9aa0ac; }

/* patient info sheet (Good to know) hidden behind the info chip */
.tl-infosheet { position: absolute; left: 16px; right: 16px; bottom: 16px; max-width: 560px;
  background: rgba(20, 22, 31, .92); color: #e8eaf0; border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px; padding: 16px; backdrop-filter: blur(8px); z-index: 3; }
.tl-infosheet[hidden] { display: none; }
.tl-infosheet ul { margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; font-size: 13px; color: #c9cdd8; }

/* chrome-bar stripe: a real bar ABOVE the video — no overlay collisions
   with Daily's in-iframe chrome; the video still dominates below it */
.tl-chromebar { position: absolute; top: 0; left: 0; right: 0; height: 52px; z-index: 3;
  background: rgba(14, 17, 22, .94); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; }
.tl-chromebar .tl-chiprow { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
  align-items: center; scrollbar-width: none; }
.tl-chromebar .tl-chip { flex: 0 0 auto; }
.tl-chromebar .tl-floatbtn { position: static; margin-left: auto; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 10px; }
.tl-full iframe { top: 52px; }         /* video below the bar, still dominant */
@media (max-width: 640px) {
  .tl-full iframe { top: 52px; }
}

/* v3 fixes: no page scrollbars under the call (chiprow's scrollbar showed as a white strip) */
body:has(.tl-full) { overflow: hidden; }
.tl-chiprow::-webkit-scrollbar { display: none; }
@media (max-width: 480px) {
  .tl-chromebar .tl-chip { font-size: 12px; padding: 5px 10px; }
  .tl-wide { display: none; }
  .tl-slim { display: inline; }
}
.tl-slim { display: none; }
@media (max-width: 640px) {
  .tl-wide { display: none; }
  .tl-slim { display: inline; }
}
/* self-view slot placeholder (never a dead black box) */
.tl-selfview-wrap { position: relative; }
.tl-selfview-wrap .tl-selfplaceholder { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: #8a9098; font-size: 13px; text-align: center;
  background: repeating-linear-gradient(135deg, #101216 0 14px, #16191f 14px 28px); border-radius: 12px; }
.tl-selfview-wrap .tl-selfplaceholder[hidden] { display: none; }

/* ============================================================
   Call shell — the panel reserves space, it never covers the call.
   Replaces the old overlay panels (.tl-drawer / .tl-infosheet), which slid over the video
   and hid ~400px of it: opening the patient record obstructed the consult.

   Absolute insets, deliberately. Measured failures of the alternatives:
     - grid placement: later rules in this file re-placed the panels (phone panel 32px,
       video 0x191);
     - flex row: the stage was handed 483px of ~970px available, so the video was far
       smaller than the space allowed (flex-basis 0% gave it 0px wide).
   With insets the rail is RESERVED: the call's `right` is exactly the rail width, so a
   panel can never overlap it and the call always gets all remaining space.
   ============================================================ */
.tl-shell {
  position: fixed; inset: 0; z-index: 80; background: #0e1116; overflow: hidden;
  --rail: 0px;    /* desktop: width taken by the docked record when open */
  --sheet: 0px;   /* phone:   height taken by the docked tips sheet when open */
}
/* the drawer branch keys off data-open; the sheet branch must not also match the drawer
   (it has both classes), or the rail stays reserved while the record is closed */
.tl-shell:has(> .tl-drawer[data-open="1"]) { --rail: 380px; }
.tl-shell:has(> .tl-panel:not([hidden]):not(.tl-drawer)) { --rail: 380px; }
.tl-shell:has(> .tl-drawer[data-open="0"]) { --rail: 0px; }

/* the chrome bar floats over the top 52px; the call clears it with top padding */
.tl-shell .tl-chromebar {
  position: absolute; top: 0; left: 0; right: 0; height: 52px; z-index: 3;
}

/* the call fills every pixel the rail does not */
.tl-shell__stage {
  position: absolute; top: 0; left: 0; right: var(--rail); bottom: 0;
  padding: 60px 8px 8px 8px;
  display: flex; align-items: center; justify-content: center;
}
.tl-shell__stage > iframe,
.tl-shell__stage > .tl-stage-frame {
  flex: none; width: 100%; height: 100%;   /* pre-JS fallback; fitStage() sets exact px */
  border: 0; border-radius: var(--radius-m, 12px); background: #0e1116; display: block;
  position: static; inset: auto; top: auto; margin: 0;
  aspect-ratio: auto; max-width: none; max-height: none;
}
.tl-shell__stage .tl-stage-note { max-width: 520px; text-align: center; color: #c9cdd4; }

/* the panel lives IN the reserved rail. Closed ⇒ display:none ⇒ it reserves nothing. */
.tl-shell .tl-panel,
.tl-shell .tl-drawer,
.tl-shell .tl-infosheet {
  position: absolute; top: 0; right: 0; bottom: 0; left: auto;
  width: 380px; max-width: 100%; margin: 0; transform: none;
  overflow-y: auto; overscroll-behavior: contain;
  background: #fff; color: var(--ink, #2b3038); padding: 16px;
  box-shadow: -18px 0 44px rgba(6,8,14,.35); border-radius: 0;
}
.tl-shell .tl-panel[hidden],
.tl-shell .tl-drawer[data-open="0"] { display: none; }
.tl-shell > *:not(.tl-shell__stage):not(.tl-chromebar):not(.tl-panel):not(.tl-drawer):not(.tl-infosheet) {
  position: absolute;
}

@media (max-width: 900px) {
  /* phone/tablet: the panel docks UNDER the call and is capped, so the video keeps the top */
  .tl-shell:has(> .tl-drawer[data-open="1"]),
  .tl-shell:has(> .tl-panel:not([hidden])) { --rail: 0px; --sheet: min(46vh, 360px); }
  .tl-shell:has(> .tl-drawer[data-open="0"]) { --rail: 0px; --sheet: 0px; }
  .tl-shell__stage { right: 0; bottom: var(--sheet); padding: 60px 6px 6px 6px; }
  .tl-shell .tl-panel,
  .tl-shell .tl-drawer,
  .tl-shell .tl-infosheet {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: var(--sheet); max-height: var(--sheet);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 34px rgba(6,8,14,.35);
  }
}

/* the pre-call device card is the one true overlay — it is a STEP, not a panel */
.tl-devcard { overflow: auto; }
.tl-devcard__inner { max-height: calc(100vh - 48px); overflow-y: auto; }
/* Overlays (device card, toasts) are children of the shell but must NOT be flex items:
   left in the flex line they take width from the call (measured: the stage shrank to
   483px of an available 986px on a 1366 laptop). They are positioned anyway. */
.tl-shell > *:not(.tl-shell__stage):not(.tl-chromebar):not(.tl-panel):not(.tl-drawer):not(.tl-infosheet) {
  position: absolute;
}
/* Pseudo-elements are flex items too. A scrim/gradient ::before|::after on the shell was
   eating ~503px of the flex line (measured: 483px stage + 380px rail = 863 of 1366, with
   the rest unused). Take them out of flow so the call gets the whole line. */
.tl-shell::before, .tl-shell::after { position: absolute; }

/* The call-frame host: daily-js mounts its own iframe inside this element, so the host is
   what fitStage() sizes and the inner frame simply fills it. */
.tl-shell__stage > .tl-daily-frame { position: relative; }
/* !important on purpose: daily-js writes an inline pixel size onto its own iframe
   (measured: style="width:375px;height:450px" inside a correctly sized 970x546 host), and
   only an author-important rule outranks an inline style — without this the video sits in a
   portrait box in the corner of the stage. */
.tl-shell__stage > .tl-daily-frame > iframe {
  position: absolute !important; inset: 0 !important;
  width: 100% !important; height: 100% !important;
  border: 0; display: block;
}
