@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/inter-latin-400-normal.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/inter-latin-500-normal.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/inter-latin-600-normal.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/inter-latin-700-normal.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2")}
/* GistCrypt UI type: Inter (variable, Google Fonts CDN).
   No brand font binaries were supplied with the logo upload — the logo wordmark
   itself is a geometric display face we could not identify; see readme.md. */

:root{
  --font-sans:"Inter",ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --font-ui:var(--font-sans);
  --font-data:var(--font-mono);
}

/* tokens/colors.css */
:root{
  /* ---- Brand: electric blue (precision accent, ~5% of any screen) ---- */
  --color-brand-50:#E8F2FF;
  --color-brand-100:#CCE3FF;
  --color-brand-200:#9CCAFF;
  --color-brand-300:#66ADFF;
  --color-brand-400:#3B96FF;
  --color-brand-500:#1683FF;
  --color-brand-600:#0A6AD9;
  --color-brand-700:#0854AC;
  --color-brand-800:#0A3F80;
  --color-brand-900:#0A2B55;
  --color-brand-950:#061A33;

  /* ---- Neutral: dark graphite foundation ---- */
  --color-neutral-950:#050608;
  --color-neutral-900:#080A0D;
  --color-neutral-850:#0D1014;
  --color-neutral-800:#12161B;
  --color-neutral-750:#171C22;
  --color-neutral-700:#1D232A;
  --color-neutral-650:#242A32;
  --color-neutral-600:#2E353F;
  --color-neutral-500:#454D58;
  --color-neutral-400:#707985;
  --color-neutral-300:#8C949F;
  --color-neutral-200:#A8B0BA;
  --color-neutral-100:#CED4DC;
  --color-neutral-50:#F5F7FA;
  --color-white:#FFFFFF;

  /* ---- Silver (logo metal) ---- */
  --color-silver-bright:#E4E8ED;
  --color-silver:#C3C9D1;
  --color-silver-dim:#959CA6;

  /* ---- Semantic raw scales ---- */
  --color-success-400:#3ECF8E;
  --color-success-500:#22B573;
  --color-success-700:#13603E;
  --color-success-900:#0B2E1F;
  --color-warning-400:#F5B33C;
  --color-warning-500:#E39A15;
  --color-warning-700:#7A5106;
  --color-warning-900:#3A2705;
  --color-danger-400:#FF6B6B;
  --color-danger-500:#E8443F;
  --color-danger-700:#7E211F;
  --color-danger-900:#3B1211;

  /* ---- Semantic surfaces ---- */
  --surface-app:var(--color-neutral-950);
  --surface-sidebar:var(--color-neutral-900);
  --surface-1:var(--color-neutral-850);
  --surface-2:var(--color-neutral-800);
  --surface-3:var(--color-neutral-750);
  --surface-elevated:var(--color-neutral-750);
  --surface-inset:#04050700;
  --surface-hover:rgba(255,255,255,.035);
  --surface-active:rgba(255,255,255,.06);
  --surface-selected:rgba(22,131,255,.10);
  --surface-backdrop:rgba(3,4,6,.72);
  --surface-table-header:var(--color-neutral-800);

  /* ---- Semantic text ---- */
  --text-primary:#F5F7FA;
  --text-secondary:#A8B0BA;
  --text-muted:#707985;
  --text-disabled:#454D58;
  --text-inverse:#050608;
  --text-brand:#66ADFF;
  --text-on-brand:#FFFFFF;
  --text-success:#3ECF8E;
  --text-warning:#F5B33C;
  --text-danger:#FF6B6B;
  --text-link:#66ADFF;
  --text-link-hover:#9CCAFF;

  /* ---- Semantic borders ---- */
  --border-subtle:#1A2027;
  --border-default:#242A32;
  --border-strong:#2E353F;
  --border-brand:var(--color-brand-500);
  --border-focus:var(--color-brand-400);
  --border-success:#1B6E47;
  --border-warning:#84590A;
  --border-danger:#8C2A27;

  /* ---- Status fills (bg / border / text / icon per semantic) ---- */
  --status-info-bg:rgba(22,131,255,.10);
  --status-info-border:rgba(22,131,255,.30);
  --status-info-text:#9CCAFF;
  --status-info-icon:#3B96FF;
  --status-success-bg:rgba(34,181,115,.10);
  --status-success-border:rgba(34,181,115,.28);
  --status-success-text:#7FE0B4;
  --status-success-icon:#3ECF8E;
  --status-warning-bg:rgba(227,154,21,.10);
  --status-warning-border:rgba(227,154,21,.28);
  --status-warning-text:#F8CE7E;
  --status-warning-icon:#F5B33C;
  --status-danger-bg:rgba(232,68,63,.10);
  --status-danger-border:rgba(232,68,63,.30);
  --status-danger-text:#FF9E9B;
  --status-danger-icon:#FF6B6B;
  --status-neutral-bg:rgba(255,255,255,.05);
  --status-neutral-border:#2E353F;
  --status-neutral-text:#A8B0BA;
  --status-neutral-icon:#8C949F;

  /* ---- Data visualization ---- */
  --chart-1:#1683FF;
  --chart-2:#C3C9D1;
  --chart-3:#3ECF8E;
  --chart-4:#F5B33C;
  --chart-5:#FF6B6B;
  --chart-6:#9CCAFF;
  --chart-7:#454D58;
  --chart-grid:#1A2027;
  --chart-axis:#454D58;
}

/* tokens/typography.css */
:root{
  --text-display-size:44px;   --text-display-lh:1.08; --text-display-ls:-.022em; --text-display-weight:600;
  --text-h1-size:32px;        --text-h1-lh:1.15;      --text-h1-ls:-.018em;     --text-h1-weight:600;
  --text-h2-size:26px;        --text-h2-lh:1.2;       --text-h2-ls:-.014em;     --text-h2-weight:600;
  --text-h3-size:21px;        --text-h3-lh:1.28;      --text-h3-ls:-.010em;     --text-h3-weight:600;
  --text-h4-size:17px;        --text-h4-lh:1.35;      --text-h4-ls:-.006em;     --text-h4-weight:600;
  --text-body-lg-size:16px;   --text-body-lg-lh:1.6;  --text-body-lg-ls:0;      --text-body-lg-weight:400;
  --text-body-size:14px;      --text-body-lh:1.57;    --text-body-ls:0;         --text-body-weight:400;
  --text-body-sm-size:13px;   --text-body-sm-lh:1.54; --text-body-sm-ls:0;      --text-body-sm-weight:400;
  --text-caption-size:11px;   --text-caption-lh:1.45; --text-caption-ls:.01em;  --text-caption-weight:400;
  --text-label-size:12px;     --text-label-lh:1.34;   --text-label-ls:.005em;   --text-label-weight:500;
  --text-label-mono-size:11px;--text-label-mono-lh:1.2;--text-label-mono-ls:.09em;--text-label-mono-weight:600;
  --text-metric-size:34px;    --text-metric-lh:1.05;  --text-metric-ls:-.02em;  --text-metric-weight:600;
  --text-metric-sm-size:22px; --text-metric-sm-lh:1.1;--text-metric-sm-ls:-.014em;--text-metric-sm-weight:600;

  --weight-regular:400; --weight-medium:500; --weight-semibold:600; --weight-bold:700;
  --tracking-tight:-.018em; --tracking-normal:0; --tracking-wide:.04em; --tracking-technical:.09em;
}

/* tokens/spacing.css */
:root{
  --space-0:0px;   --space-1:4px;   --space-2:8px;   --space-3:12px;  --space-4:16px;
  --space-5:20px;  --space-6:24px;  --space-8:32px;  --space-10:40px; --space-12:48px;
  --space-16:64px; --space-20:80px; --space-24:96px;
  --pad-control-sm:0 10px; --pad-control-md:0 14px; --pad-control-lg:0 18px;
  --pad-card:20px; --pad-card-lg:24px; --pad-page:32px; --pad-page-tight:24px;
  --gap-inline:8px; --gap-stack:12px; --gap-section:32px;
}

/* tokens/radius.css */
:root{
  --radius-none:0px; --radius-xs:2px; --radius-sm:4px; --radius-md:6px;
  --radius-lg:8px; --radius-dialog:10px; --radius-pill:999px;
  --radius-control:6px; --radius-card:8px; --radius-badge:4px; --radius-input:6px;
}

/* tokens/borders.css */
:root{
  --border-width:1px; --border-width-strong:1.5px;
  --border-hairline:1px solid var(--border-subtle);
  --border-base:1px solid var(--border-default);
  --border-emphasis:1px solid var(--border-strong);
  --focus-ring:0 0 0 1px var(--surface-app),0 0 0 3px rgba(22,131,255,.45);
  --focus-ring-inset:inset 0 0 0 1px var(--color-brand-500);
  --focus-ring-danger:0 0 0 1px var(--surface-app),0 0 0 3px rgba(232,68,63,.45);
}

/* tokens/shadows.css */
:root{
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 4px 12px rgba(0,0,0,.45);
  --shadow-lg:0 16px 40px rgba(0,0,0,.55);
  /* Glow is an accent, never ambient. Reserve for active/selected/system-status. */
  --glow-brand-sm:0 0 0 1px rgba(22,131,255,.35),0 0 12px rgba(22,131,255,.18);
  --glow-brand-md:0 0 0 1px rgba(22,131,255,.45),0 0 24px rgba(22,131,255,.25);
  --glow-danger-sm:0 0 0 1px rgba(232,68,63,.4),0 0 12px rgba(232,68,63,.18);
}

/* tokens/motion.css */
:root{
  --duration-fast:140ms; /* @kind other */
  --duration-normal:200ms; /* @kind other */
  --duration-slow:300ms; /* @kind other */
  --ease-standard:cubic-bezier(.2,0,.2,1); /* @kind other */
  --ease-out:cubic-bezier(.16,1,.3,1); /* @kind other */
  --ease-in:cubic-bezier(.4,0,1,1); /* @kind other */
  --transition-control:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard),color var(--duration-fast) var(--ease-standard),box-shadow var(--duration-fast) var(--ease-standard); /* @kind other */
}
@media (prefers-reduced-motion:reduce){
  :root{
    --duration-fast:0ms; /* @kind other */
    --duration-normal:0ms; /* @kind other */
    --duration-slow:0ms; /* @kind other */
  }
}

/* tokens/layout.css */
:root{
  --bp-mobile:480px; --bp-tablet:768px; --bp-desktop:1200px; --bp-desktop-lg:1600px;
  --sidebar-width:248px; --sidebar-width-collapsed:56px;
  --topbar-height:56px; --content-max:1440px;
  --row-height-compact:36px; --row-height:44px;
  --control-height-sm:28px; --control-height-md:34px; --control-height-lg:40px;
  --z-base:0; /* @kind other */
  --z-sticky:100; /* @kind other */
  --z-dropdown:200; /* @kind other */
  --z-drawer:300; /* @kind other */
  --z-modal:400; /* @kind other */
  --z-toast:500; /* @kind other */
  --z-tooltip:600; /* @kind other */
}

/* tokens/aliases.css */
/* Short semantic aliases used by components. Same values as the canonical
   --status-* / --shadow-* tokens; kept so component code reads cleanly. */
:root{
  --surface-brand-subtle:rgba(22,131,255,.10);
  --surface-input:var(--color-neutral-850);
  --glow-brand-soft:var(--glow-brand-sm);

  --info-bg:var(--status-info-bg);        --info-border:var(--status-info-border);
  --info-text:var(--status-info-text);    --info-icon:var(--status-info-icon);
  --success-bg:var(--status-success-bg);  --success-border:var(--status-success-border);
  --success-text:var(--status-success-text); --success-icon:var(--status-success-icon);
  --warning-bg:var(--status-warning-bg);  --warning-border:var(--status-warning-border);
  --warning-text:var(--status-warning-text); --warning-icon:var(--status-warning-icon);
  --danger-bg:var(--status-danger-bg);    --danger-border:var(--status-danger-border);
  --danger-text:var(--status-danger-text); --danger-icon:var(--status-danger-icon);
  --neutral-bg:var(--status-neutral-bg);  --neutral-border:var(--status-neutral-border);
  --neutral-text:var(--status-neutral-text); --neutral-icon:var(--status-neutral-icon);

  --text-label-line:var(--text-label-lh);      /* @kind other */
  --text-caption-line:var(--text-caption-lh);  /* @kind other */
  --text-metric-line:var(--text-metric-lh);    /* @kind other */
  --text-metric-tracking:var(--text-metric-ls);/* @kind other */
  --text-overline-size:11px;                   /* @kind font */
  --text-overline-weight:600;                  /* @kind other */
  --text-overline-tracking:.09em;              /* @kind other */
}

/* tokens/theme-clinical.css */
/* ============================================================
   CLINICAL LIGHT THEME — Hospital Workspace (Plane B)
   Applied with <html data-theme="clinical"> or any scope.
   Same brand blue family, dropped in chroma and darkened so it
   passes 4.5:1 on white. Surfaces are cool paper, not pure white
   sheets, so charted values and rules read without glare on a
   ward monitor. The operator dark theme (Plane A) is the default
   :root set in colors.css and is untouched.
   ============================================================ */
[data-theme="clinical"]{
  /* ---- Brand, light-adapted. brand-500 (#1683FF) is 3.1:1 on white:
         legal for >=24px headline blocks only, never for body or UI text. ---- */
  --color-brand-action:#0A6AD9;      /* 4.6:1 on white — buttons, active nav */
  --color-brand-ink:#0854AC;         /* 7.0:1 on white — links, emphasis text */
  --color-brand-quiet:#E8F2FF;       /* tint fill */
  --color-brand-line:#9CCAFF;        /* tint border */

  /* ---- Cool paper surfaces ---- */
  --surface-app:#F2F5F9;
  --surface-sidebar:#FFFFFF;
  --surface-1:#FFFFFF;
  --surface-2:#F8FAFC;
  --surface-3:#EDF1F6;
  --surface-elevated:#FFFFFF;
  --surface-hover:rgba(15,23,36,.04);
  --surface-active:rgba(15,23,36,.07);
  --surface-selected:rgba(10,106,217,.08);
  --surface-backdrop:rgba(16,23,32,.45);
  --surface-table-header:#F1F5FA;

  /* ---- Ink ---- */
  --text-primary:#101720;            /* 16.9:1 */
  --text-secondary:#44505F;          /* 8.6:1 */
  --text-muted:#66707E;              /* 5.3:1 — captions and metadata */
  --text-disabled:#98A1AD;           /* non-text only */
  --text-inverse:#FFFFFF;
  --text-brand:#0854AC;
  --text-on-brand:#FFFFFF;
  --text-link:#0854AC;
  --text-link-hover:#0A3F80;

  /* ---- Rules ---- */
  --border-subtle:#E6EBF1;
  --border-default:#D5DDE6;
  --border-strong:#BDC7D3;
  --border-brand:#0A6AD9;
  --border-focus:#0A6AD9;
  --focus-ring:0 0 0 1px #FFFFFF,0 0 0 3px rgba(10,106,217,.45);
  --focus-ring-danger:0 0 0 1px #FFFFFF,0 0 0 3px rgba(178,42,37,.45);

  /* ---- Semantics, all >=4.5:1 as text on their own tint ---- */
  --status-info-bg:#E8F2FF;    --status-info-border:#B6D7FF;
  --status-info-text:#08498F;  --status-info-icon:#0A6AD9;
  --status-success-bg:#E4F6EC; --status-success-border:#A9DEC4;
  --status-success-text:#0B5B3A;--status-success-icon:#0F7A4D;
  --status-warning-bg:#FDF3DF; --status-warning-border:#EFD199;
  --status-warning-text:#7A4E05;--status-warning-icon:#9A6207;
  --status-danger-bg:#FDEAE8;  --status-danger-border:#F3B9B4;
  --status-danger-text:#9C2622;--status-danger-icon:#C2352F;
  --status-neutral-bg:#F1F4F8; --status-neutral-border:#D5DDE6;
  --status-neutral-text:#44505F;--status-neutral-icon:#66707E;

  --info-bg:var(--status-info-bg);       --info-border:var(--status-info-border);
  --info-text:var(--status-info-text);   --info-icon:var(--status-info-icon);
  --success-bg:var(--status-success-bg); --success-border:var(--status-success-border);
  --success-text:var(--status-success-text);--success-icon:var(--status-success-icon);
  --warning-bg:var(--status-warning-bg); --warning-border:var(--status-warning-border);
  --warning-text:var(--status-warning-text);--warning-icon:var(--status-warning-icon);
  --danger-bg:var(--status-danger-bg);   --danger-border:var(--status-danger-border);
  --danger-text:var(--status-danger-text);--danger-icon:var(--status-danger-icon);
  --neutral-bg:var(--status-neutral-bg); --neutral-border:var(--status-neutral-border);
  --neutral-text:var(--status-neutral-text);--neutral-icon:var(--status-neutral-icon);

  --text-success:var(--status-success-text);
  --text-warning:var(--status-warning-text);
  --text-danger:var(--status-danger-text);
  --surface-brand-subtle:var(--color-brand-quiet);
  --surface-input:#FFFFFF;

  /* Buttons and active nav resolve through these in the clinical theme. */
  --color-brand-500:#0A6AD9;
  --color-brand-400:#1683FF;
  --color-brand-600:#0854AC;

  /* ---- Elevation: light UI needs real shadow, dark UI does not ---- */
  --shadow-sm:0 1px 2px rgba(16,23,32,.07);
  --shadow-md:0 4px 12px rgba(16,23,32,.10);
  --shadow-lg:0 16px 40px rgba(16,23,32,.16);
  --glow-brand-sm:0 0 0 1px rgba(10,106,217,.35);
  --glow-brand-md:0 0 0 2px rgba(10,106,217,.40);
  --glow-brand-soft:var(--glow-brand-sm);

  /* ---- Charts ---- */
  --chart-1:#0A6AD9; --chart-2:#7A8698; --chart-3:#0F7A4D; --chart-4:#9A6207;
  --chart-5:#C2352F; --chart-6:#66ADFF; --chart-7:#BDC7D3;
  --chart-grid:#E6EBF1; --chart-axis:#98A1AD;

  /* colour is an INHERITED property, so a theme scope must set its own ink.
     Without this, any element inside [data-theme="clinical"] that leaves
     color unset inherits the document's dark ink and renders near-white on
     a white surface. */
  color:var(--text-primary);
}

/* ---- Clinical-safety colours. Identical in both themes: an allergy band
   must look the same to a nurse on a night-shift dark screen and a day-shift
   light one. Never alias these to the ordinary danger tokens. ---- */
:root,[data-theme="clinical"]{
  --safety-allergy-bg:#C2352F;
  --safety-allergy-text:#FFFFFF;
  --safety-allergy-line:#8E1F1B;
  --safety-unassessed-bg:#9A6207;
  --safety-unassessed-text:#FFFFFF;
  --safety-nka-bg:#E6EBF1;
  --safety-nka-text:#101720;
  --safety-critical-pulse:rgba(194,53,47,.35);
}
:root{--safety-nka-bg:#1D232A;--safety-nka-text:#F5F7FA}

/* ---- Tenant white-label hook. A tenant may set --tenant-accent only;
   everything else stays system-owned so branding cannot break contrast. ---- */
[data-tenant-branded]{--color-brand-500:var(--tenant-accent,#0A6AD9)}

/* tokens/base.css */
*,*::before,*::after{box-sizing:border-box}
body{margin:0;background:var(--surface-app);color:var(--text-primary);font-family:var(--font-sans);font-size:var(--text-body-size);line-height:var(--text-body-lh);-webkit-font-smoothing:antialiased}
a{color:var(--text-link);text-decoration:none}
a:hover{color:var(--text-link-hover);text-decoration:underline;text-underline-offset:2px}
:focus-visible{outline:none;box-shadow:var(--focus-ring)}
::selection{background:rgba(22,131,255,.3)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--color-neutral-650);border-radius:var(--radius-pill);border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--color-neutral-600);background-clip:content-box}

/* app.css */
/* GistCrypt HRS — application styles. Every value resolves to a design-system token.
   Light clinical theme: <html data-theme="clinical">. Night shift: attribute removed (dark tokens). */

:root { --rail-w: 248px; --rail-w-c: 60px; --topbar-h: 56px; --radius: 6px; }
html, body { height: 100%; }
body { background: var(--surface-app); color: var(--text-primary); font-size: 14px; }
#root { min-height: 100%; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-muted); font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 12px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- text helpers ---------- */
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.nowrap, .dose { white-space: nowrap; }
.danger-text { color: var(--danger-text); }
.warning-text { color: var(--warning-text); }
.success-text { color: var(--success-text); }
.brand-text { color: var(--text-brand); }
.label { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--text-link); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.link:hover { color: var(--text-link-hover); text-decoration: underline; text-underline-offset: 2px; }
.pre { white-space: pre-wrap; }

/* ---------- layout ---------- */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.split.wide { grid-template-columns: minmax(0, 1fr) 460px; }
.split.left { grid-template-columns: 320px minmax(0, 1fr); }
.sticky { position: sticky; top: 0; z-index: 5; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr) auto; grid-template-areas: "rail top" "rail main" "rail status"; height: 100vh; }
.app.collapsed { grid-template-columns: var(--rail-w-c) minmax(0, 1fr); }
.rail { grid-area: rail; background: var(--surface-sidebar); border-right: 1px solid var(--border-default); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.rail-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border-subtle); flex: none; }
.rail-brand .plate { background: #0D1014; border-radius: 6px; padding: 5px 8px; display: flex; align-items: center; }
.rail-brand img { height: 18px; display: block; }
.rail-brand .mark { height: 22px; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.nav-group { margin-top: 10px; }
.nav-group-title { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 4px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--text-secondary); cursor: pointer; position: relative; font-size: 13.5px; text-decoration: none; border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--surface-selected); color: var(--text-primary); font-weight: 500; }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 2px; background: var(--border-brand); border-radius: 2px; }
.nav-item.active svg { color: var(--text-brand); }
.nav-item .count { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-muted); background: var(--surface-3); padding: 0 6px; border-radius: 4px; line-height: 18px; }
.nav-item .count.alert { background: var(--danger-bg); color: var(--danger-text); }
.nav-sub { padding-left: 28px; }
.nav-sub .nav-item { height: 30px; font-size: 13px; }
.app.collapsed .nav-group-title span, .app.collapsed .nav-item span, .app.collapsed .nav-item .count, .app.collapsed .nav-sub, .app.collapsed .rail-foot .txt { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }
.app.collapsed .rail-brand { justify-content: center; padding: 0; }
.rail-foot { border-top: 1px solid var(--border-subtle); padding: 10px 12px; font-size: 12px; display: flex; gap: 8px; align-items: center; flex: none; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border-default); background: var(--surface-1); min-width: 0; z-index: 20; }
.topbar .search-trigger { flex: 1; max-width: 520px; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: 6px; background: var(--surface-2); color: var(--text-muted); cursor: pointer; font-size: 13px; }
.topbar .search-trigger:hover { border-color: var(--border-strong); }
.kbd { font-family: var(--font-mono); font-size: 10.5px; border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text-muted); background: var(--surface-1); }
.main { grid-area: main; overflow-y: auto; min-width: 0; position: relative; }
.statusbar { grid-area: status; display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 28px; border-top: 1px solid var(--border-default); background: var(--surface-1); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.statusbar .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.fac-switch { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: 6px; background: var(--surface-1); cursor: pointer; font-size: 13px; }
.fac-switch .lvl { font-size: 10.5px; color: var(--text-muted); }
.bottom-nav { display: none; }

/* ---------- page ---------- */
.page { padding: 20px 24px 40px; max-width: 1600px; margin: 0 auto; }
.page.full { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 1.2; }
.page-head .sub { color: var(--text-secondary); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.crumbs a { color: var(--text-muted); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.section-title h3 { font-size: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border-default); border-radius: 8px; box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); min-height: 46px; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .meta { font-size: 11.5px; color: var(--text-muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border-subtle); display: flex; gap: 8px; align-items: center; }
.card.warn { border-color: var(--warning-border); }
.card.danger { border-color: var(--danger-border); }
.card.tone-info { background: var(--info-bg); border-color: var(--info-border); }
.panel { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid transparent; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: var(--transition-control); text-decoration: none; user-select: none; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--color-brand-500); color: var(--text-on-brand); }
.btn.primary:hover { background: var(--color-brand-600); }
.btn.secondary { background: var(--surface-1); border-color: var(--border-default); color: var(--text-primary); }
.btn.secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn.ghost { background: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn.danger { background: var(--status-danger-icon); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.btn.success { background: var(--status-success-icon); color: #fff; }
.btn.warning { background: var(--status-warning-icon); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .spin { animation: spin 0.8s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group .btn.on { background: var(--surface-selected); border-color: var(--border-brand); color: var(--text-brand); z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-text); white-space: nowrap; line-height: 1; vertical-align: middle; }
.badge svg { flex: none; }
.badge.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.badge.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.badge.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.badge.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.badge.brand { background: var(--surface-brand-subtle); border-color: var(--color-brand-line, var(--info-border)); color: var(--text-brand); }
.badge.solid-danger { background: var(--safety-allergy-bg); border-color: var(--safety-allergy-line); color: #fff; }
.badge.solid-warning { background: var(--safety-unassessed-bg); border-color: var(--safety-unassessed-bg); color: #fff; }
.badge.lg { height: 26px; font-size: 12.5px; padding: 0 9px; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--surface-3); color: var(--text-secondary); font-family: var(--font-mono); }
.code { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-secondary); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field .flabel { font-size: 12px; font-weight: 500; color: var(--text-secondary); display: flex; gap: 4px; align-items: center; }
.field .req { color: var(--danger-text); }
.field .help { font-size: 11.5px; color: var(--text-muted); }
.field .err { font-size: 11.5px; color: var(--danger-text); display: flex; gap: 4px; align-items: center; }
.input, .select, .textarea { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: 6px; background: var(--surface-input); color: var(--text-primary); font-size: 13.5px; transition: var(--transition-control); min-width: 0; }
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger-icon); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }
.input.sm, .select.sm { height: 28px; font-size: 12.5px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 6px 0 0 6px; }
.input-group .addon { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-default); border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface-2); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon .input { padding-left: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; min-height: 24px; }
.check input { width: 16px; height: 16px; accent-color: var(--color-brand-500); margin: 0; }
.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card { border: 1px solid var(--border-default); border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 13px; background: var(--surface-1); display: flex; align-items: center; gap: 8px; }
.radio-card.on { border-color: var(--border-brand); background: var(--surface-selected); color: var(--text-brand); font-weight: 500; }
.switch { position: relative; display: inline-flex; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: var(--transition-control); cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform var(--duration-fast); }
.switch input:checked + span { background: var(--color-brand-500); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { box-shadow: var(--focus-ring); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.form-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fieldset { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 14px; }
.fieldset > legend, .fieldset .legend { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); padding: 0 6px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; padding: 4px; }
.combo-opt { padding: 7px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.combo-opt.hl { background: var(--surface-selected); }
.combo-opt .sub { font-size: 11.5px; color: var(--text-muted); }
.combo-empty { padding: 10px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-default); overflow-x: auto; scrollbar-width: thin; }
.tab { height: 38px; padding: 0 12px; border: 0; background: none; color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--border-brand); }
.tab .n { font-size: 11px; background: var(--surface-3); color: var(--text-muted); border-radius: 4px; padding: 0 5px; line-height: 17px; font-variant-numeric: tabular-nums; }
.tab.active .n { background: var(--surface-selected); color: var(--text-brand); }
.tab .n.alert { background: var(--danger-bg); color: var(--danger-text); }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; }
.subtab { height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid transparent; background: none; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.subtab.active { background: var(--surface-selected); color: var(--text-brand); border-color: var(--border-brand); }
.subtab:hover:not(.active) { background: var(--surface-hover); }

/* ---------- data table ---------- */
.dt-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.dt th { position: sticky; top: 0; background: var(--surface-table-header); color: var(--text-muted); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 0 12px; height: 34px; border-bottom: 1px solid var(--border-default); white-space: nowrap; z-index: 2; user-select: none; }
table.dt th.sortable { cursor: pointer; }
table.dt th.sortable:hover { color: var(--text-secondary); }
table.dt th.num, table.dt td.num { text-align: right; }
table.dt td { padding: 7px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; height: 40px; }
table.dt tbody tr { transition: background var(--duration-fast); }
table.dt tbody tr:hover { background: var(--surface-hover); }
table.dt tbody tr.clickable { cursor: pointer; }
table.dt tbody tr.selected { background: var(--surface-selected); }
table.dt tbody tr.row-danger { box-shadow: inset 3px 0 0 var(--status-danger-icon); }
table.dt tbody tr.row-warning { box-shadow: inset 3px 0 0 var(--status-warning-icon); }
table.dt tbody tr.row-muted td { opacity: .55; }
table.dt tbody tr.row-info { box-shadow: inset 3px 0 0 var(--status-info-icon); }
table.dt tbody tr:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--border-focus); }
table.dt tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-default); }
table.dt.compact td { height: 34px; padding: 5px 10px; font-size: 13px; }
table.dt .row-actions { opacity: .55; transition: opacity var(--duration-fast); white-space: nowrap; text-align: right; }
table.dt tr:hover .row-actions { opacity: 1; }
table.dt td.check-col, table.dt th.check-col { width: 36px; padding-right: 0; }
.dt-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.dt-toolbar .input-icon { width: 260px; max-width: 100%; }
.dt-bulk { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-selected); border-bottom: 1px solid var(--border-brand); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--text-muted); }
.pager .spacer { flex: 1; }
.dt-cards { display: none; }
.simple-list { display: flex; flex-direction: column; }
.simple-list .li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border-subtle); min-height: 44px; }
.simple-list .li:last-child { border-bottom: 0; }
.simple-list .li.click { cursor: pointer; }
.simple-list .li.click:hover { background: var(--surface-hover); }
.simple-list .li .main-t { font-weight: 500; }
.simple-list .li .sub-t { font-size: 12px; color: var(--text-muted); }

/* ---------- key-value ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; min-width: 0; }
.kv.cols2 { grid-template-columns: max-content 1fr max-content 1fr; }
.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 16px; }
.kvs .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kvs .v { font-size: 13.5px; margin-top: 2px; }

/* ---------- KPI ---------- */
.kpi { background: var(--surface-1); border: 1px solid var(--border-default); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; box-shadow: var(--shadow-sm); position: relative; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--border-strong); }
.kpi .kpi-label { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.kpi .kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .kpi-value.sm { font-size: 20px; }
.kpi .kpi-ctx { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi .trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.kpi .trend.good { color: var(--success-text); } .kpi .trend.bad { color: var(--danger-text); } .kpi .trend.flat { color: var(--text-muted); }
.kpi.alert { border-color: var(--danger-border); }
.kpi.alert .kpi-value { color: var(--danger-text); }
.kpi.warn { border-color: var(--warning-border); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.fresh { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 10px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--info-border); background: var(--info-bg); color: var(--info-text); font-size: 13px; align-items: flex-start; }
.alert .a-title { font-weight: 600; }
.alert svg { flex: none; margin-top: 1px; }
.alert.success { border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }
.alert.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.alert.danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }
.alert.neutral { border-color: var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-text); }
.alert .a-body { flex: 1; min-width: 0; }
.alert .a-actions { display: flex; gap: 6px; }
.ai-note { border: 1px dashed var(--info-border); background: var(--surface-2); border-radius: 6px; padding: 10px 12px; font-size: 12.5px; }
.ai-note .ai-head { display: flex; gap: 6px; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-brand); margin-bottom: 6px; }

/* ---------- empty / states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 36px 16px; gap: 8px; color: var(--text-muted); }
.empty .e-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.empty .e-title { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.empty .e-desc { max-width: 420px; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 4px; height: 12px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-default); border-top-color: var(--color-brand-500); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* ---------- overlays ---------- */
.backdrop { position: fixed; inset: 0; background: var(--surface-backdrop); backdrop-filter: blur(2px); z-index: 400; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade var(--duration-normal) var(--ease-out); }
.modal { background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%; display: flex; flex-direction: column; animation: rise var(--duration-normal) var(--ease-out); }
.modal.sm { width: 420px; } .modal.lg { width: 820px; } .modal.xl { width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-subtle); background: var(--surface-2); border-radius: 0 0 10px 10px; }
.modal.danger .modal-head { border-bottom-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); border-radius: 10px 10px 0 0; }
.modal.warning .modal-head { border-bottom-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); border-radius: 10px 10px 0 0; }
.drawer-back { position: fixed; inset: 0; background: var(--surface-backdrop); z-index: 300; animation: fade var(--duration-normal); }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 460px; max-width: 100vw; background: var(--surface-elevated); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); z-index: 301; display: flex; flex-direction: column; animation: slide var(--duration-slow) var(--ease-out); }
.drawer.wide { width: 720px; }
.drawer-head { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.drawer-head h2 { font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border-subtle); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.popover { position: absolute; z-index: 200; background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 4px; }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; border: 0; background: none; width: 100%; text-align: left; color: var(--text-primary); }
.menu-item:hover, .menu-item.hl { background: var(--surface-hover); }
.menu-item.danger { color: var(--danger-text); }
.menu-sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }
.menu-head { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 4px; }
.toasts { position: fixed; right: 16px; bottom: 40px; z-index: 500; display: flex; flex-direction: column; gap: 8px; width: 380px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-elevated); border: 1px solid var(--border-strong); border-left-width: 3px; border-radius: 8px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13px; animation: rise var(--duration-normal) var(--ease-out); }
.toast.success { border-left-color: var(--success-icon); } .toast.error { border-left-color: var(--danger-icon); } .toast.warning { border-left-color: var(--warning-icon); } .toast.info { border-left-color: var(--info-icon); }
.toast .t-title { font-weight: 600; }
.cmdk { width: 680px; }
.cmdk-input { border: 0; border-bottom: 1px solid var(--border-subtle); height: 52px; font-size: 15px; padding: 0 16px 0 44px; width: 100%; background: transparent; outline: none; }
.cmdk-list { max-height: 60vh; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.cmdk-item.hl { background: var(--surface-selected); }
.cmdk-item .sub { font-size: 12px; color: var(--text-muted); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border-subtle); font-size: 11.5px; color: var(--text-muted); }

/* ---------- patient banner (safety component) ---------- */
.pbanner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0; border-bottom: 1px solid var(--border-default); background: var(--surface-1); position: sticky; top: 0; z-index: 15; }
.pbanner .pb-main { display: flex; align-items: center; gap: 14px; padding: 10px 18px; min-width: 0; }
.pbanner .pb-photo { width: 46px; height: 46px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-weight: 600; color: var(--text-secondary); flex: none; font-size: 15px; overflow: hidden; }
.pbanner .pb-photo img { width: 100%; height: 100%; object-fit: cover; }
.pbanner .pb-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.pbanner .pb-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.pbanner .pb-meta b { font-weight: 500; color: var(--text-primary); }
.pbanner .pb-info { display: flex; gap: 18px; align-items: center; padding: 8px 18px; border-left: 1px solid var(--border-subtle); font-size: 12px; flex-wrap: wrap; }
.pbanner .pb-info .k { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.pbanner .pb-alg { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 18px; min-width: 250px; max-width: 360px; font-size: 12.5px; }
.pbanner .pb-alg .k { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; display: flex; gap: 6px; align-items: center; }
.pb-alg.present, .pb-alg.critical { background: var(--safety-allergy-bg); color: var(--safety-allergy-text); }
.pb-alg.unassessed { background: var(--safety-unassessed-bg); color: var(--safety-unassessed-text); }
.pb-alg.nka { background: var(--safety-nka-bg); color: var(--safety-nka-text); }
.pbanner .pb-flags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 6px 18px; border-top: 1px solid var(--border-subtle); background: var(--surface-2); font-size: 12px; }
.pb-breakglass { grid-column: 1 / -1; background: var(--safety-allergy-bg); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 18px; display: flex; gap: 8px; align-items: center; }
.pchip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pchip .av { width: 28px; height: 28px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); flex: none; }
.pchip .nm { font-weight: 500; }
.pchip .mt { font-size: 11.5px; color: var(--text-muted); }
.allergy-dot { display: inline-flex; width: 16px; height: 16px; border-radius: 4px; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.allergy-dot.present { background: var(--safety-allergy-bg); } .allergy-dot.unassessed { background: var(--safety-unassessed-bg); }

/* ---------- clinical widgets ---------- */
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.vital { border: 1px solid var(--border-subtle); border-radius: 6px; padding: 8px 10px; background: var(--surface-2); }
.vital .vk { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.vital .vv { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vital .vu { font-size: 11px; color: var(--text-muted); margin-left: 2px; font-weight: 400; }
.vital.H, .vital.L { border-color: var(--warning-border); background: var(--warning-bg); }
.vital.H .vv, .vital.L .vv { color: var(--warning-text); }
.news { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; padding: 0 8px; height: 22px; border-radius: 4px; border: 1px solid; }
.news.high, .news.medium { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.news.low-medium { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.news.low, .news.na { background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--neutral-text); }
.flag { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.flag.H, .flag.L, .flag.A { color: var(--warning-text); }
.flag.HH, .flag.LL, .flag.critical { color: var(--danger-text); }
.result-crit { background: var(--danger-bg); }
.steps { display: flex; align-items: center; gap: 0; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.step .sd { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 10px; background: var(--surface-1); }
.step.done { color: var(--text-secondary); }
.step.done .sd { background: var(--status-success-icon); border-color: var(--status-success-icon); color: #fff; }
.step.cur { color: var(--text-brand); font-weight: 600; }
.step.cur .sd { border-color: var(--border-brand); background: var(--surface-selected); color: var(--text-brand); }
.step-line { width: 24px; height: 1.5px; background: var(--border-default); margin: 0 6px; flex: none; }
.step-line.done { background: var(--status-success-icon); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 1.5px; background: var(--border-default); }
.tl-item { position: relative; padding: 0 0 14px; }
.tl-item .tl-dot { position: absolute; left: -22px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-1); border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: var(--text-muted); }
.tl-item .tl-dot.info { border-color: var(--info-icon); color: var(--info-icon); } .tl-item .tl-dot.danger { border-color: var(--danger-icon); color: var(--danger-icon); } .tl-item .tl-dot.success { border-color: var(--success-icon); color: var(--success-icon); } .tl-item .tl-dot.warning { border-color: var(--warning-icon); color: var(--warning-icon); }
.tl-item .tl-time { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.tl-item .tl-title { font-weight: 500; font-size: 13.5px; }
.tl-item .tl-body { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.note-sec { margin-bottom: 10px; }
.note-sec .ns-h { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.note-sec .ns-b { white-space: pre-wrap; font-size: 13.5px; }

/* boards */
.bedboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.bed { border: 1px solid var(--border-default); border-radius: 8px; padding: 10px 12px; background: var(--surface-1); min-height: 96px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; position: relative; transition: var(--transition-control); }
.bed:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.bed .bed-no { font-family: var(--font-mono); font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.bed .code { position: absolute; right: 10px; top: 8px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; }
.bed.available { border-style: dashed; background: var(--surface-2); }
.bed.available .code { background: var(--success-bg); color: var(--success-text); }
.bed.occupied .code { background: var(--info-bg); color: var(--info-text); }
.bed.reserved { background: var(--warning-bg); } .bed.reserved .code { background: var(--warning-border); color: var(--warning-text); }
.bed.cleaning, .bed.maintenance { background: var(--surface-3); } .bed.cleaning .code, .bed.maintenance .code { background: var(--neutral-border); color: var(--neutral-text); }
.bed.blocked { background: var(--danger-bg); } .bed.blocked .code { background: var(--danger-border); color: var(--danger-text); }
.bed.drop-ok { outline: 2px dashed var(--border-brand); outline-offset: 2px; }
.bed.news-high { box-shadow: inset 3px 0 0 var(--status-danger-icon); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 8px; display: flex; flex-direction: column; min-height: 200px; }
.kcol-head { padding: 10px 12px; font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--border-subtle); }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kcard { background: var(--surface-1); border: 1px solid var(--border-default); border-radius: 6px; padding: 9px 10px; font-size: 12.5px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.kcard:hover { border-color: var(--border-strong); }
.kcard.urgent { box-shadow: inset 3px 0 0 var(--status-danger-icon); }
.ticket { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.qdisplay { background: #0D1014; color: #F5F7FA; min-height: 100vh; padding: 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.qdisplay .qd-card { border: 1px solid #242A32; border-radius: 10px; padding: 18px; }
.qdisplay .qd-now { font-family: var(--font-mono); font-size: 56px; font-weight: 600; color: #66ADFF; }

/* calendar */
.cal { display: grid; border: 1px solid var(--border-default); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.cal-head { display: contents; }
.cal-hc { background: var(--surface-table-header); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 8px; border-bottom: 1px solid var(--border-default); border-left: 1px solid var(--border-subtle); text-align: center; }
.cal-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); padding: 4px 6px; border-top: 1px solid var(--border-subtle); text-align: right; }
.cal-cell { border-top: 1px solid var(--border-subtle); border-left: 1px solid var(--border-subtle); min-height: 44px; padding: 2px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.cal-cell:hover { background: var(--surface-hover); }
.cal-ev { font-size: 11.5px; border-radius: 4px; padding: 3px 6px; background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); line-height: 1.25; cursor: pointer; overflow: hidden; }
.cal-ev.completed, .cal-ev.checked_in { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.cal-ev.cancelled, .cal-ev.no_show { background: var(--surface-3); border-color: var(--border-default); color: var(--text-muted); text-decoration: line-through; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border-default); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.month .md { min-height: 96px; border-top: 1px solid var(--border-subtle); border-left: 1px solid var(--border-subtle); padding: 4px 6px; font-size: 12px; cursor: pointer; }
.month .md.out { background: var(--surface-2); color: var(--text-muted); }
.month .md.today .dn { background: var(--color-brand-500); color: #fff; border-radius: 4px; padding: 0 5px; }

/* charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-mono); font-size: 9.5px; fill: var(--chart-axis); }
.chart .grid-l { stroke: var(--chart-grid); stroke-width: 1; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-secondary); }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.hbar { display: flex; flex-direction: column; gap: 8px; }
.hbar .hb-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar .hb-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar .hb-fill { height: 100%; background: var(--chart-1); border-radius: 4px; }
.meter { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter > div { height: 100%; background: var(--chart-1); }
.meter.warn > div { background: var(--status-warning-icon); } .meter.danger > div { background: var(--status-danger-icon); } .meter.ok > div { background: var(--status-success-icon); }

/* partograph */
.partograph { width: 100%; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface-1); }
.login-form .box { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login-side { background: #0D1014; color: #F5F7FA; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-side h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; max-width: 480px; }
.login-side .feat { display: flex; gap: 10px; margin-top: 14px; color: #A8B0BA; font-size: 13.5px; max-width: 460px; }
.login-side .feat b { color: #F5F7FA; font-weight: 600; }
.login-side .corner { position: absolute; right: 24px; top: 24px; width: 24px; height: 24px; border-right: 1px solid #2E353F; border-top: 1px solid #2E353F; }
.demo-users { max-height: 220px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: 6px; }
.demo-users .du { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--border-subtle); }
.demo-users .du:hover { background: var(--surface-hover); }

/* print */
.print-root { display: none; }
.doc { background: #fff; color: #101720; font-family: var(--font-sans); font-size: 10.5pt; line-height: 1.45; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #101720; padding-bottom: 8px; margin-bottom: 12px; }
.doc .doc-org { font-size: 14pt; font-weight: 700; }
.doc .doc-title { font-size: 12pt; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc th, .doc td { border: 1px solid #BDC7D3; padding: 4px 6px; text-align: left; font-size: 9.5pt; }
.doc th { background: #F1F5FA; }
.doc .doc-allergy { color: #C2352F; font-weight: 700; }
.doc .sig { display: flex; gap: 40px; margin-top: 28px; }
.doc .sig div { border-top: 1px solid #101720; padding-top: 4px; min-width: 200px; font-size: 9pt; }
.doc-preview { background: #fff; color: #101720; border: 1px solid var(--border-default); border-radius: 6px; padding: 24px; box-shadow: var(--shadow-md); max-height: 70vh; overflow-y: auto; }
.doc.receipt { width: 80mm; font-size: 9pt; }
.watermark { position: relative; }
.watermark::after { content: attr(data-mark); position: absolute; inset: 0; display: grid; place-items: center; font-size: 60pt; font-weight: 800; color: rgba(194,53,47,.12); transform: rotate(-24deg); pointer-events: none; }
@media print {
  body * { visibility: hidden; }
  .print-root, .print-root * { visibility: visible; }
  .print-root { display: block !important; position: absolute; left: 0; top: 0; width: 100%; }
  @page { margin: 12mm; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .split, .split.wide { grid-template-columns: minmax(0, 1fr); }
  .g5, .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .app:not(.expanded-force) { grid-template-columns: var(--rail-w-c) minmax(0, 1fr); }
  .app:not(.expanded-force) .nav-group-title span, .app:not(.expanded-force) .nav-item span, .app:not(.expanded-force) .nav-item .count, .app:not(.expanded-force) .nav-sub, .app:not(.expanded-force) .rail-foot .txt { display: none; }
  .app:not(.expanded-force) .nav-item { justify-content: center; padding: 0; }
  .app:not(.expanded-force) .rail-brand { justify-content: center; padding: 0; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split.left { grid-template-columns: minmax(0, 1fr); }
  .pbanner { grid-template-columns: minmax(0, 1fr); }
  .pbanner .pb-info { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .pbanner .pb-alg { max-width: none; }
}
@media (max-width: 767px) {
  .app, .app.collapsed, .app:not(.expanded-force) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "bnav"; grid-template-rows: var(--topbar-h) minmax(0, 1fr) 60px; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease-out); box-shadow: var(--shadow-lg); }
  .app.mobile-open .rail { transform: none; }
  .app .rail .nav-group-title span, .app .rail .nav-item span, .app .rail .nav-item .count, .app .rail .nav-sub { display: revert; }
  .app .rail .nav-item { justify-content: flex-start; padding: 0 10px; }
  .statusbar { display: none; }
  .bottom-nav { grid-area: bnav; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border-default); background: var(--surface-1); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--text-muted); text-decoration: none; }
  .bottom-nav a.active { color: var(--text-brand); }
  .page { padding: 14px 16px 32px; }
  .page-head h1 { font-size: 19px; }
  .g2, .g3, .g4, .g5, .g6, .form-grid.c2, .form-grid.c3, .form-grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .kpi-value { font-size: 21px; }
  .topbar .search-trigger .hint, .topbar .hide-sm { display: none; }
  .dt-wrap.cardable table { display: none; }
  .dt-wrap.cardable .dt-cards { display: flex; flex-direction: column; }
  .dt-cards .dcard { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 4px; min-height: 44px; }
  .dt-cards .dcard .dc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
  .dt-cards .dcard .dc-row .l { color: var(--text-muted); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { display: none; }
  .modal-body, .drawer-body { padding: 14px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 32px; }
  .kv.cols2 { grid-template-columns: max-content 1fr; }
  .pbanner .pb-main { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- GistCrypt platform console ---------- */
.pconsole { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: var(--surface-0, var(--surface-1)); }
.prail { background: #0D1014; color: #C9D0D9; display: flex; flex-direction: column; padding: 14px 10px; gap: 12px; position: sticky; top: 0; height: 100vh; }
.prail .pbrand { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px 10px; border-bottom: 1px solid #1F252D; }
.prail .plate, .shead .plate { background: #0D1014; border-radius: 6px; padding: 4px 8px; display: inline-flex; }
.prail nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.pnav { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #A8B0BA; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; text-align: left; width: 100%; }
.pnav:hover { background: #161B21; color: #F5F7FA; }
.pnav.active { background: #1B222A; color: #fff; font-weight: 600; }
.pfoot { border-top: 1px solid #1F252D; padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.pmain { min-width: 0; }
.pmain .page { max-width: none; }
@media (max-width: 900px) { .pconsole { grid-template-columns: minmax(0, 1fr); } .prail { position: static; height: auto; } .prail nav { flex-direction: row; flex-wrap: wrap; } }

/* ---------- public sign-up page ---------- */
.spage { min-height: 100vh; background: var(--surface-1); }
.shead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; background: #0D1014; color: #F5F7FA; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.shead .btn.ghost { color: #D5DBE2; }
.swrap { max-width: 1120px; margin: 0 auto; padding: 24px 20px; }
.shero { background: linear-gradient(135deg, #0D1014 0%, #15202B 60%, #11324A 100%); color: #F5F7FA; }
.shero .swrap { padding: 64px 20px; }
.shero h1 { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -.02em; max-width: 760px; margin: 14px 0; }
.shero p { color: #B6BEC8; max-width: 680px; font-size: 16px; }
.splan-featured { outline: 2px solid var(--brand-500, #2F7DF6); }
.linkish { background: none; border: 0; padding: 0; color: var(--text-link, #2F6FDE); cursor: pointer; }

/* ---------- staff chat ---------- */
.chat-fab { position: fixed; right: 18px; bottom: 44px; z-index: 40; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border-default); background: var(--surface-raised, var(--surface-1)); box-shadow: 0 6px 20px rgba(13,16,20,.14); cursor: pointer; color: var(--text-primary); font-weight: 600; font-size: 13px; }
.chat-fab.has { border-color: var(--status-danger-icon, #D64545); }
.chat-fab .count { margin-left: 2px; }
.chat-panel { position: fixed; right: 18px; bottom: 92px; z-index: 41; width: 360px; max-width: calc(100vw - 24px); height: min(560px, calc(100vh - 140px)); display: flex; flex-direction: column; background: var(--surface-raised, var(--surface-1)); border: 1px solid var(--border-default); border-radius: 14px; box-shadow: 0 18px 50px rgba(13,16,20,.25); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle, var(--border-default)); }
.chat-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 0; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.chat-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; background: none; border: 0; border-bottom: 1px solid var(--border-subtle, var(--border-default)); text-align: left; cursor: pointer; color: inherit; }
.chat-row:hover { background: var(--surface-2, var(--surface-muted)); }
.chat-row .av, .chat-panel .av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2, #E8ECF1); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.chat-msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.bubble { max-width: 82%; padding: 7px 10px; border-radius: 12px; background: var(--surface-2, #EEF1F5); font-size: 13px; align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: var(--brand-100, #DDEBFF); }
@media (max-width: 767px) { .chat-fab { bottom: 72px; right: 12px; } .chat-panel { right: 8px; left: 8px; width: auto; bottom: 120px; } }

/* ---------- home launcher ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--border-default); background: var(--surface-raised, var(--surface-1)); cursor: pointer; color: var(--text-primary); font-size: 12.5px; font-weight: 600; text-align: center; box-shadow: 0 1px 0 rgba(13,16,20,.04); transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease; }
.tile:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13,16,20,.10); border-color: var(--brand-400, #5B9BFF); }
.tile .ti { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50, #EEF5FF); color: var(--brand-600, #1F5FD1); }
.bulletin { padding: 8px 10px; border-radius: 10px; border-left: 3px solid var(--border-strong, #C5CCD6); background: var(--surface-2, #F4F6F9); margin-bottom: 6px; }
.bulletin.warning { border-left-color: var(--status-warning-icon, #D99A1E); }
.bulletin.danger { border-left-color: var(--status-danger-icon, #D64545); }
@media (max-width: 1100px) { .stack.loose > .grid[style*="2fr"] { grid-template-columns: minmax(0, 1fr) !important; } }

/* zz-workspace.css */
/* ==========================================================================
   GistCrypt HRS — "Workspace" layer (v4 design)
   Dense, panel-based hospital workstation: navy app bar + module menu, a
   context bar (hospital · branch · room · queue · breadcrumb · guide), white
   panels with tinted title strips and an "Actions ▾" menu, compact pop-up forms,
   and grids with Copy / CSV / Print. Built on the GistCrypt design tokens.
   ========================================================================== */

:root {
  --ws-bar: #061A33;            /* brand-950 */
  --ws-rail: #0B2545;           /* navy, between brand-900 and 950 */
  --ws-rail-2: #0F2E55;
  --ws-rail-text: #C4D3E6;
  --ws-rail-dim: #7F95B3;
  --ws-accent: var(--color-brand-500);
  --ws-canvas: linear-gradient(180deg, #E9F1FB 0%, #DCE8F6 100%);
  --ws-panel-head: #F0F5FC;
  --ws-panel-border: #D3DFEE;
  --ws-modal-head: #ECF2FB;
  --ws-rail-w: 236px;
  --ws-rail-w-c: 56px;
  --ws-bar-h: 46px;
}
[data-theme]:not([data-theme="clinical"]), :root:not([data-theme]) {
  --ws-canvas: var(--surface-app);
  --ws-panel-head: var(--surface-2);
  --ws-panel-border: var(--border-default);
  --ws-modal-head: var(--surface-2);
}

/* ---------- frame ---------- */
.app.ws { grid-template-columns: var(--ws-rail-w) minmax(0, 1fr); grid-template-rows: var(--ws-bar-h) minmax(0, 1fr) auto; grid-template-areas: "bar bar" "rail main" "rail status"; }
.app.ws.collapsed { grid-template-columns: var(--ws-rail-w-c) minmax(0, 1fr); }
.app.ws .main { background: var(--ws-canvas); }
.app.ws .statusbar { height: 24px; font-size: 11px; }

/* ---------- app bar ---------- */
.appbar { grid-area: bar; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--ws-bar); color: #E6EEF8; z-index: 30; min-width: 0; }
.ab-btn { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; border: 0; background: transparent; color: #C9D8EC; cursor: pointer; text-decoration: none; }
.ab-btn:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.ab-count { position: absolute; top: 3px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ws-accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.ab-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 14px; letter-spacing: .01em; margin-right: 8px; white-space: nowrap; }
.ab-brand:hover { text-decoration: none; }
.ab-brand img { height: 22px; border-radius: 5px; background: #fff; padding: 2px; }
.ab-brand b { color: #7FB6FF; font-weight: 700; }
.ab-search { flex: 1; max-width: 460px; height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #9FB3CC; font-size: 12.5px; cursor: pointer; min-width: 0; }
.ab-search:hover { border-color: rgba(255,255,255,.25); color: #D4E1F1; }
.ab-search .kbd { margin-left: auto; background: rgba(255,255,255,.10); border-color: transparent; color: #B8C8DC; }
.appbar .btn.ghost.icon { color: #C9D8EC; height: 34px; width: 34px; }
.appbar .btn.ghost.icon:hover { background: rgba(255,255,255,.08); color: #fff; }
.ab-online { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: #A9E3C2; padding: 0 8px; white-space: nowrap; }
.ab-online span { width: 8px; height: 8px; border-radius: 50%; background: #2FBF71; box-shadow: 0 0 0 3px rgba(47,191,113,.2); }
.ab-online.off { color: #F5B9B9; } .ab-online.off span { background: #E35D5D; box-shadow: 0 0 0 3px rgba(227,93,93,.2); }
.ab-user { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 4px; border-radius: 6px; border: 0; background: transparent; color: #E6EEF8; cursor: pointer; max-width: 230px; }
.ab-user:hover { background: rgba(255,255,255,.08); }
.ab-user .av { width: 26px; height: 26px; border-radius: 50%; background: var(--ws-accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.ab-user .nm { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; }
.ab-user .nm b { font-size: 12.5px; font-weight: 600; } .ab-user .nm small { font-size: 10.5px; color: #9FB3CC; }

/* ---------- module menu ---------- */
.app.ws .rail { background: var(--ws-rail); border-right: 0; color: var(--ws-rail-text); }
.sn { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sn-find { display: flex; align-items: center; gap: 6px; margin: 8px 8px 4px; padding: 0 8px; height: 30px; border-radius: 6px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); color: var(--ws-rail-dim); flex: none; }
.sn-find input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font-size: 12.5px; }
.sn-find input::placeholder { color: var(--ws-rail-dim); }
.sn-find:focus-within { border-color: var(--ws-accent); }
.sn-scroll { flex: 1; overflow-y: auto; padding: 2px 0 16px; scrollbar-width: thin; scrollbar-color: #26456E transparent; }
.sn-group { padding: 2px 0; }
.sn-sec { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ws-rail-dim); padding: 10px 14px 3px; opacity: .8; }
.sn-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 12px 0 14px; border: 0; background: none; color: var(--ws-rail-text); font-size: 13px; text-align: left; cursor: pointer; text-decoration: none; position: relative; }
.sn-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sn-item > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.sn-item > span small { font-size: 10px; color: var(--ws-rail-dim); }
.sn-item svg { flex: none; opacity: .9; }
.sn-item .chev { opacity: .6; }
.sn-item em, .sn-subitem em { font-style: normal; font-size: 10.5px; font-weight: 700; min-width: 18px; text-align: center; padding: 0 5px; line-height: 17px; border-radius: 9px; background: rgba(255,255,255,.12); color: #DCE7F5; }
.sn-item em.alert, .sn-subitem em.alert { background: #D64545; color: #fff; }
.sn-mod.on > .sn-item { color: #fff; background: rgba(22,131,255,.14); }
.sn-mod.on > .sn-item::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ws-accent); }
.sn-sub { background: var(--ws-rail-2); padding: 3px 0; }
.sn-subitem { display: flex; align-items: center; gap: 8px; height: 29px; padding: 0 12px 0 30px; color: var(--ws-rail-text); font-size: 12.5px; text-decoration: none; }
.sn-subitem span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-subitem svg { opacity: .45; flex: none; }
.sn-subitem:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }
.sn-subitem.active { color: #fff; background: rgba(22,131,255,.30); font-weight: 600; }
.sn-subitem.active svg { opacity: 1; color: #7FB6FF; }
.sn-empty { padding: 14px; font-size: 12px; color: var(--ws-rail-dim); }
.app.ws.collapsed .sn-item { justify-content: center; padding: 0; }
.app.ws.collapsed .sn-item > span, .app.ws.collapsed .sn-item em, .app.ws.collapsed .sn-item .chev { display: none; }

/* ---------- context bar ---------- */
.ctx { margin: 10px 12px 0; background: var(--surface-1); border: 1px solid var(--ws-panel-border); border-radius: 6px; box-shadow: 0 1px 2px rgba(10,43,85,.06); }
.ctx-top { display: flex; align-items: center; gap: 18px; padding: 6px 10px 6px 12px; font-size: 12.5px; flex-wrap: wrap; row-gap: 4px; }
.ctx-org { font-size: 13px; color: var(--text-primary); max-width: 280px; }
.ctx-field { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); white-space: nowrap; }
.ctx-link { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 0; color: var(--color-brand-600); font-size: 12.5px; cursor: pointer; }
.ctx-link:hover { text-decoration: underline; }
.ctx-crumbs { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--text-muted); }
.ctx-crumbs a { color: var(--color-brand-600); display: inline-flex; align-items: center; }
.ctx-guide { gap: 4px; font-weight: 500; }

/* ---------- page & panels ---------- */
.app.ws .page { padding: 10px 12px 28px; }
.app.ws .page-head { background: var(--surface-1); border: 1px solid var(--ws-panel-border); border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; align-items: center; gap: 10px; }
.app.ws .page-head h1 { font-size: 15px; font-weight: 600; }
.app.ws .page-head .sub { font-size: 12px; margin-top: 1px; }
.app.ws .page-head .crumbs { display: none; }
.app.ws .page-head .actions { gap: 6px; }
.app.ws .card { border-radius: 6px; border-color: var(--ws-panel-border); box-shadow: 0 1px 2px rgba(10,43,85,.05); }
.app.ws .card-head, .ws-modal-scope .card-head { background: var(--ws-panel-head); min-height: 36px; padding: 5px 10px 5px 12px; border-bottom: 1px solid var(--ws-panel-border); border-radius: 6px 6px 0 0; gap: 8px; }
.app.ws .card-head h3 { font-size: 13px; font-weight: 600; color: var(--color-brand-800); }
[data-theme]:not([data-theme="clinical"]) .app.ws .card-head h3 { color: var(--text-primary); }
.app.ws .card.closed .card-head { border-bottom: 0; border-radius: 6px; }
.app.ws .card-body { padding: 12px; }
.app.ws .card-body.flush { padding: 0; }
.card-toggle { border: 0; background: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 0; }
.card-toggle:hover { color: var(--color-brand-600); }

/* Actions ▾ */
.actions-btn { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 4px; border: 0; background: var(--color-brand-500); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.actions-btn:hover { background: var(--color-brand-600); }
.actions-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.popover .menu-item { font-size: 12.5px; padding: 6px 12px; min-height: 30px; }

/* buttons & fields: denser */
.app.ws .btn, .ws-modal-scope .btn { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 5px; }
.app.ws .btn.sm, .ws-modal-scope .btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.app.ws .btn.lg { height: 36px; }
.app.ws .btn.icon { width: 30px; padding: 0; } .app.ws .btn.sm.icon { width: 26px; }
.app.ws .input, .app.ws .select, .app.ws .textarea, .backdrop .input, .backdrop .select, .backdrop .textarea { height: 30px; font-size: 13px; border-radius: 5px; }
.app.ws .textarea, .backdrop .textarea { height: auto; }
.app.ws .field > label, .backdrop .field > label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.app.ws .form-grid, .backdrop .form-grid { gap: 10px 12px; }

/* grids */
.app.ws table.dt, .backdrop table.dt { font-size: 12.5px; }
.app.ws table.dt th, .backdrop table.dt th { background: var(--ws-panel-head); color: var(--text-secondary); font-size: 11px; letter-spacing: .02em; text-transform: none; font-weight: 700; border-bottom: 1px solid var(--ws-panel-border); }
.app.ws table.dt td, .backdrop table.dt td { height: 32px; padding: 4px 10px; }
.app.ws table.dt tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ws-panel-head) 45%, transparent); }
.app.ws table.dt tbody tr:hover td { background: var(--surface-hover); }
.app.ws table.dt tbody tr.selected td { background: color-mix(in srgb, var(--color-brand-500) 16%, transparent); }
.app.ws .dt-toolbar { padding: 6px 10px; gap: 6px; }
.dt-export { display: inline-flex; border: 1px solid var(--ws-panel-border); border-radius: 4px; overflow: hidden; }
.dt-export button { border: 0; background: var(--surface-1); color: var(--text-secondary); font-size: 11.5px; padding: 3px 9px; cursor: pointer; }
.dt-export button + button { border-left: 1px solid var(--ws-panel-border); }
.dt-export button:hover { background: var(--ws-panel-head); color: var(--color-brand-700); }

/* KPIs: compact, coloured edge */
.app.ws .kpi { border-radius: 6px; padding: 10px 12px; border-color: var(--ws-panel-border); border-left: 3px solid var(--color-brand-500); }
.app.ws .kpi .kpi-value { font-size: 22px; }
.app.ws .kpi.alert { border-left-color: var(--status-danger-icon); }
.app.ws .kpi.warn { border-left-color: var(--status-warning-icon); }
.app.ws .kpi-row { gap: 10px; }

/* ---------- pop-up forms ---------- */
.backdrop { align-items: flex-start; padding-top: 6vh; background: rgba(6, 26, 51, .38); backdrop-filter: none; }
.modal { border-radius: 6px; border-color: var(--ws-panel-border); box-shadow: 0 18px 48px rgba(6,26,51,.28); }
.modal-head { background: var(--ws-modal-head); padding: 7px 8px 7px 14px; gap: 8px; border-bottom: 1px solid var(--ws-panel-border); border-radius: 6px 6px 0 0; min-height: 40px; }
.modal-head h2 { font-size: 14px; font-weight: 600; color: var(--color-brand-800); }
[data-theme]:not([data-theme="clinical"]) .modal-head h2 { color: var(--text-primary); }
.modal-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer; }
.modal-x:hover { background: rgba(214,69,69,.12); color: #C23434; }
.modal-body { padding: 14px; gap: 12px; }
.modal-foot { padding: 8px 12px; background: var(--ws-panel-head); border-top: 1px solid var(--ws-panel-border); border-radius: 0 0 6px 6px; }
.modal .btn { height: 30px; font-size: 12.5px; border-radius: 5px; }
.drawer-head { background: var(--ws-modal-head); }

/* ---------- home launcher ---------- */
.app.ws .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.app.ws .tile { min-height: 104px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--ws-panel-border); box-shadow: 0 3px 8px rgba(10,43,85,.08); gap: 8px; }
.app.ws .tile .ti { width: 48px; height: 48px; border-radius: 12px; background: transparent; color: var(--color-brand-600); }
.app.ws .tile .ti svg { width: 34px; height: 34px; stroke-width: 1.6; }
.app.ws .tile span, .app.ws .tile .tl { font-size: 12px; font-weight: 600; color: var(--text-primary); text-align: center; }
.app.ws .tile:hover { border-color: var(--color-brand-400); box-shadow: 0 8px 18px rgba(10,43,85,.14); }

/* ---------- workstation (patient strip + room queue) ---------- */
.wst { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.6fr); gap: 0; }
.wst-pt { padding: 10px 12px; border-right: 1px solid var(--border-subtle); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; font-size: 12.5px; align-content: start; }
.wst-pt dt { color: var(--text-muted); font-weight: 600; font-size: 11.5px; }
.wst-pt dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wst-pt .scheme { color: var(--color-brand-600); font-weight: 600; }
.wst-pt .credit, .wst-pt .note { color: var(--status-danger-icon); font-weight: 600; }
.wst-q { min-width: 0; }
.wst-q table.dt tbody tr.emergency td { color: #C23434; font-weight: 600; }
.legend-bar { display: flex; flex-wrap: wrap; gap: 14px; padding: 6px 12px; border-top: 1px solid var(--border-subtle); font-size: 11.5px; color: var(--text-muted); }
.legend-bar i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

@media (max-width: 1100px) { .wst { grid-template-columns: minmax(0, 1fr); } .wst-pt { border-right: 0; border-bottom: 1px solid var(--border-subtle); } }
@media (max-width: 767px) {
  .app.ws { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--ws-bar-h) minmax(0, 1fr) auto; grid-template-areas: "bar" "main" "bnav"; }
  .app.ws .rail { position: fixed; top: var(--ws-bar-h); bottom: 0; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .app.ws.mobile-open .rail { transform: none; }
  .app.ws .statusbar { display: none; }
  .ab-search .ellipsis, .ab-search .kbd, .ab-online, .ab-brand span { display: none; }
  .ab-search { flex: 0 0 auto; width: 34px; justify-content: center; padding: 0; }
  .ctx { margin: 8px 8px 0; } .ctx-top { gap: 10px; }
  .app.ws .page { padding: 8px 8px 24px; }
}
@media (min-width: 768px) and (max-width: 1100px) {
  .app.ws:not(.collapsed) { grid-template-columns: 208px minmax(0, 1fr); }
  .app.ws:not(.collapsed) .sn-item > span, .app.ws:not(.collapsed) .sn-item em, .app.ws:not(.collapsed) .sn-item .chev { display: revert; }
  .app.ws:not(.collapsed) .sn-item > span { display: flex; }
  .app.ws:not(.collapsed) .sn-item { justify-content: flex-start; padding: 0 10px 0 12px; }
}
.wst-pt .credit.ok { color: var(--success-text); }
.app.ws table.dt tbody tr.emergency td { color: #C23434; font-weight: 600; }
.ws-card .card-body { border-radius: 0 0 6px 6px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); gap: 10px; align-items: stretch; }
.home-side { display: flex; flex-direction: column; min-height: 100%; }
.home-side > .card { flex: 1; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
html:not([data-theme]) .app.ws .card-head h3, html:not([data-theme]) .modal-head h2 { color: var(--text-primary); }
html:not([data-theme]) .ctx-link, html:not([data-theme]) .ctx-crumbs a { color: var(--color-brand-300); }
.app.ws .page-head .actions .select, .app.ws .page-head .actions select { width: auto; min-width: 150px; }
.app.ws table.dt th { white-space: nowrap; }
.or-line { display: flex; align-items: center; gap: 10px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border-default); }

/* ---------- patient biometrics ---------- */
.bio-cam { display: flex; flex-direction: column; gap: 8px; }
.bio-cam-view { position: relative; width: 100%; max-width: 360px; aspect-ratio: 4 / 3; background: #0b1220; border-radius: var(--radius-md, 8px); overflow: hidden; border: 2px solid var(--border-subtle); }
.bio-cam-view.done { border-color: var(--success, #16a34a); }
.bio-cam-view.error { border-color: var(--danger, #dc2626); }
.bio-cam-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.bio-oval { position: absolute; left: 50%; top: 50%; width: 46%; height: 72%; transform: translate(-50%, -50%); border: 2px dashed rgba(255,255,255,.7); border-radius: 50%; pointer-events: none; }
.bio-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.2); }
.bio-progress span { display: block; height: 100%; background: var(--brand, #0A6AD9); transition: width .2s; }
.bio-msg { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; background: var(--info-bg); color: var(--info-text); }
.bio-msg.success { background: var(--success-bg); color: var(--success-text); }
.bio-msg.danger { background: var(--danger-bg); color: var(--danger-text); }
.bio-split { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 14px; align-items: start; }
.bio-cand { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: 8px; }
.bio-cand .grow { flex: 1; min-width: 0; }
.bio-list { display: flex; flex-direction: column; gap: 6px; }
.bio-consent { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--border-subtle); border-radius: 8px; }
.bio-fp-img { width: 120px; border: 1px solid var(--border-subtle); border-radius: 6px; background: #fff; }
@media (max-width: 720px) { .bio-split { grid-template-columns: 1fr; } }

.tabs { overflow-y: hidden; }

/* ---------- assistant ---------- */
.as-chat { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 480px; }
.as-chat.compact { padding: 0; min-height: calc(100vh - 190px); }
.as-status { display: flex; gap: 8px; align-items: center; }
.as-status .muted { flex: 1; }
.as-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; max-height: 58vh; padding: 2px; }
.as-chat.compact .as-log { max-height: none; }
.as-msg { max-width: 88%; padding: 8px 11px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; }
.as-msg.user { align-self: flex-end; background: var(--brand, #0A6AD9); color: #fff; border-bottom-right-radius: 3px; white-space: pre-wrap; }
.as-msg.assistant { align-self: flex-start; background: var(--surface-2, #f1f5f9); border: 1px solid var(--border-subtle); border-bottom-left-radius: 3px; }
.as-msg.error { border-color: var(--danger-border); background: var(--danger-bg); }
.as-rich p { margin: 0 0 4px; } .as-rich .as-li { padding-left: 12px; margin: 0 0 2px; } .as-rich .as-gap { height: 4px; }
.as-src { margin-top: 5px; font-size: 11px; color: var(--text-muted); }
.as-empty { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; color: var(--text-muted); padding: 20px 6px; }
.as-sugg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.as-chip { border: 1px solid var(--border-subtle); background: var(--surface, #fff); color: var(--text); border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; text-align: left; }
.as-chip:hover { border-color: var(--brand, #0A6AD9); }
.as-input { display: flex; gap: 6px; align-items: flex-end; }
.as-input textarea { flex: 1; resize: none; }
.as-result { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2, #f1f5f9); min-height: 40px; }
.as-typing i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--text-muted); animation: as-b 1s infinite; }
.as-typing i:nth-child(2) { animation-delay: .15s; } .as-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes as-b { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }

/* queue ticket (80 mm thermal) */
.doc-ticket { width: 72mm; margin: 0 auto; text-align: center; font-family: var(--font-sans, Inter, sans-serif); padding: 3mm 0; }
.doc-ticket .t-org { font-weight: 700; font-size: 11pt; }
.doc-ticket .t-fac { font-size: 9pt; margin-bottom: 3mm; }
.doc-ticket .t-no { font-size: 34pt; font-weight: 800; letter-spacing: 1px; line-height: 1.1; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 2mm 0; }
.doc-ticket .t-dest { font-size: 13pt; font-weight: 700; margin-top: 2mm; }
.doc-ticket .t-prio { display: inline-block; margin-top: 1mm; padding: 0 3mm; border: 2px solid #000; font-weight: 800; font-size: 10pt; }
.doc-ticket .t-pt { font-size: 10pt; margin-top: 2mm; }
.doc-ticket .t-meta { font-size: 8.5pt; margin-top: 1mm; }
.doc-ticket .t-foot { font-size: 8pt; margin-top: 3mm; border-top: 1px dashed #000; padding-top: 2mm; }
