/* ==========================================================================
   HARBOURVIEW CLINIC OS — a dental clinic CRM concept by Precisa Solutions
   Layout: the "operatory console". A lagoon-ink rail on the left, a porcelain
   work surface, and the day sheet of chairs as the spine every view hangs from.
   Colour: porcelain neutrals biased toward the lagoon accent; gum-rose is the
   one warm voice and belongs to the AI. Chart hues are the validated
   categorical set (slots 1-5) and never stand in for status.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #dce7e5;
  --surface: #fbfdfc;
  --surface-2: rgba(255, 255, 255, 0.5);
  --surface-3: rgba(13, 70, 66, 0.07);
  /* glass */
  --glass: rgba(255, 255, 255, 0.5);
  --glass-2: rgba(249, 252, 251, 0.82);
  --glass-card: rgba(255, 255, 255, 0.6);
  --glass-line: rgba(255, 255, 255, 0.78);
  --glass-edge: rgba(13, 70, 66, 0.1);
  --glass-hi: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 1px 2px rgba(13, 52, 50, 0.05), 0 18px 48px -22px rgba(13, 60, 58, 0.4);
  --field: rgba(255, 255, 255, 0.66);
  --spot: rgba(255, 255, 255, 0.75);
  --aurora-1: #46cdbc;
  --aurora-2: #93bcff;
  --aurora-3: #f7a3be;
  --aurora-4: #ffd59c;
  --aurora-op: 0.66;
  --blur: 20px;
  /* ink */
  --ink: #0b1a1d;
  --ink-2: #3c5054;
  --muted: #6c8083;
  --line: #d7e1df;
  --line-2: #c3d1cf;
  /* brand */
  --accent: #0d7a71;
  --accent-hi: #109c90;
  --accent-wash: rgba(13, 122, 113, 0.1);
  --accent-ink: #ffffff;
  --gum: #c0406a;
  --gum-2: #e0899f;
  --gum-wash: rgba(192, 64, 106, 0.09);
  --pearl: #f6f1e9;
  /* rail (stays deep in both themes) */
  --rail: #0a2326;
  --rail-2: #10302f;
  --rail-ink: #d4e7e3;
  --rail-muted: #7da09c;
  --rail-line: rgba(212, 231, 227, 0.1);
  --rail-hover: rgba(212, 231, 227, 0.07);
  /* chart chrome */
  --grid: #e0e8e6;
  --axis: #bccbc9;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  /* status (reserved) */
  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --warn-ink: #8a5800;
  --serious: #ec835a;
  --crit: #d03b3b;
  --crit-ink: #b02c2c;
  /* avatars */
  --av-1: #cfe6e1; --av-1i: #0d5a53;
  --av-2: #f3dbe2; --av-2i: #8c2a4b;
  --av-3: #dbe6f6; --av-3i: #1f4f8f;
  --av-4: #f5e6c9; --av-4i: #7a5200;
  --av-5: #e3dcf3; --av-5i: #4a3a95;
  --av-6: #dcebd4; --av-6i: #2f6417;
  /* elevation */
  --shadow-sm: 0 1px 2px rgba(11, 26, 29, 0.06);
  --shadow: 0 1px 2px rgba(11, 26, 29, 0.05), 0 10px 28px -16px rgba(11, 26, 29, 0.22);
  --shadow-lg: 0 2px 6px rgba(11, 26, 29, 0.06), 0 30px 70px -24px rgba(11, 26, 29, 0.42);
  --ring: 0 0 0 3px rgba(13, 122, 113, 0.28);
  /* type */
  --font-display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* scale */
  --t-xs: 11px;
  --t-sm: 12.5px;
  --t-base: 14px;
  --t-md: 15.5px;
  --t-lg: 19px;
  --t-xl: 28px;
  --t-hero: clamp(30px, 3.4vw, 44px);
  --r-xs: 6px;
  --r-sm: 9px;
  --r: 15px;
  --r-lg: 22px;
  --rail-w: 252px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #030a0c;
    --surface: #0c1a1d;
    --surface-2: rgba(255, 255, 255, 0.035);
    --surface-3: rgba(255, 255, 255, 0.07);
    --glass: rgba(13, 30, 34, 0.5);
    --glass-2: rgba(9, 21, 24, 0.84);
    --glass-card: rgba(255, 255, 255, 0.045);
    --glass-line: rgba(255, 255, 255, 0.09);
    --glass-edge: rgba(0, 0, 0, 0.35);
    --glass-hi: rgba(255, 255, 255, 0.07);
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 22px 60px -24px rgba(0, 0, 0, 0.85);
    --field: rgba(255, 255, 255, 0.045);
    --spot: rgba(110, 240, 222, 0.09);
    --aurora-1: #0f8174;
    --aurora-2: #2448a6;
    --aurora-3: #8f2350;
    --aurora-4: #5e3f0c;
    --aurora-op: 0.55;
    --ink: #e3efec;
    --ink-2: #a8bdb9;
    --muted: #6f8a87;
    --line: #1a3033;
    --line-2: #254240;
    --accent: #2cc2b2;
    --accent-hi: #5edfd0;
    --accent-wash: rgba(44, 194, 178, 0.12);
    --accent-ink: #032220;
    --gum: #f07c9e;
    --gum-2: #b8486d;
    --gum-wash: rgba(240, 124, 158, 0.12);
    --pearl: #1b2a27;
    --rail: #030c0d;
    --rail-2: #0a1b1c;
    --rail-ink: #d4e7e3;
    --rail-muted: #6b8e8a;
    --rail-line: rgba(212, 231, 227, 0.08);
    --rail-hover: rgba(212, 231, 227, 0.06);
    --grid: #182c2e;
    --axis: #2a4446;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --good-ink: #3fcf5a;
    --warn-ink: #fab219;
    --crit-ink: #ff7b7b;
    --av-1: #12403b; --av-1i: #8fe3d7;
    --av-2: #43202c; --av-2i: #f5a9bf;
    --av-3: #1b3150; --av-3i: #9cc4f5;
    --av-4: #3d2f12; --av-4i: #f0c879;
    --av-5: #2c2550; --av-5i: #c3b8f5;
    --av-6: #1f3a17; --av-6i: #acdc8f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 30px 80px -20px rgba(0, 0, 0, 0.85);
    --ring: 0 0 0 3px rgba(44, 194, 178, 0.32);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #030a0c;
  --surface: #0c1a1d;
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-3: rgba(255, 255, 255, 0.07);
  --glass: rgba(13, 30, 34, 0.5);
  --glass-2: rgba(9, 21, 24, 0.84);
  --glass-card: rgba(255, 255, 255, 0.045);
  --glass-line: rgba(255, 255, 255, 0.09);
  --glass-edge: rgba(0, 0, 0, 0.35);
  --glass-hi: rgba(255, 255, 255, 0.07);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 22px 60px -24px rgba(0, 0, 0, 0.85);
  --field: rgba(255, 255, 255, 0.045);
  --spot: rgba(110, 240, 222, 0.09);
  --aurora-1: #0f8174;
  --aurora-2: #2448a6;
  --aurora-3: #8f2350;
  --aurora-4: #5e3f0c;
  --aurora-op: 0.55;
  --ink: #e3efec;
  --ink-2: #a8bdb9;
  --muted: #6f8a87;
  --line: #1a3033;
  --line-2: #254240;
  --accent: #2cc2b2;
  --accent-hi: #5edfd0;
  --accent-wash: rgba(44, 194, 178, 0.12);
  --accent-ink: #032220;
  --gum: #f07c9e;
  --gum-2: #b8486d;
  --gum-wash: rgba(240, 124, 158, 0.12);
  --pearl: #1b2a27;
  --rail: #030c0d;
  --rail-2: #0a1b1c;
  --rail-ink: #d4e7e3;
  --rail-muted: #6b8e8a;
  --rail-line: rgba(212, 231, 227, 0.08);
  --rail-hover: rgba(212, 231, 227, 0.06);
  --grid: #182c2e;
  --axis: #2a4446;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --good-ink: #3fcf5a;
  --warn-ink: #fab219;
  --crit-ink: #ff7b7b;
  --av-1: #12403b; --av-1i: #8fe3d7;
  --av-2: #43202c; --av-2i: #f5a9bf;
  --av-3: #1b3150; --av-3i: #9cc4f5;
  --av-4: #3d2f12; --av-4i: #f0c879;
  --av-5: #2c2550; --av-5i: #c3b8f5;
  --av-6: #1f3a17; --av-6i: #acdc8f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 3px rgba(44, 194, 178, 0.32);
  color-scheme: dark;
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
svg { display: block; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 12px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.noscript { padding: 40px; color: var(--ink-2); }
i[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; }

/* ============ APP FRAME ============ */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100%;
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-block: 22px 60px;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
  scroll-behavior: smooth;
  outline: none;
}
.view > * { max-width: 1520px; margin-inline: auto; }
.view.enter > * { animation: viewIn 0.5s var(--ease) both; }
.view.enter > *:nth-child(2) { animation-delay: 0.04s; }
.view.enter > *:nth-child(3) { animation-delay: 0.08s; }
.view.enter > *:nth-child(4) { animation-delay: 0.12s; }
.view.enter > *:nth-child(5) { animation-delay: 0.16s; }
@keyframes viewIn { from { opacity: 0.001; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ RAIL ============ */
.rail {
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(44, 194, 178, 0.13), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(240, 124, 158, 0.08), transparent 60%),
    var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--rail-line);
  position: relative;
  z-index: 30;
}
.rail-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  color: #f4fbf9;
  background: linear-gradient(145deg, #15a597, #0b5f58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 16px -6px rgba(21, 165, 151, 0.7);
}
.brand-mark svg path:first-child { fill: #f6fbfa; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--font-display); font-weight: 400; font-size: 23px; letter-spacing: 0.005em; color: #f2faf8; }
.brand-text small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rail-muted); }
.icon-btn.rail-close { display: none; margin-left: auto; color: var(--rail-ink); }
.rail-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }
.rail-group {
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--rail-muted); padding: 16px 12px 6px; font-weight: 600;
}
.rail-group:first-child { padding-top: 2px; }
.rail-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--rail-ink); text-decoration: none; font-weight: 500; font-size: 13.5px;
  position: relative;
  transition: background 0.18s, color 0.18s;
}
.rail-nav a i[data-icon] { color: var(--rail-muted); transition: color 0.18s; }
.rail-nav a:hover { background: var(--rail-hover); }
.rail-nav a:hover i[data-icon] { color: var(--rail-ink); }
.rail-nav a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(44, 194, 178, 0.18), rgba(44, 194, 178, 0.05));
  color: #ffffff;
}
.rail-nav a[aria-current="page"] i[data-icon] { color: #5edfd0; }
.rail-nav a > span { flex: 1; min-width: 0; }
.rail-count { font-size: 11px; font-weight: 500; color: var(--rail-muted); font-variant-numeric: tabular-nums; }
.rail-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #f07c9e; color: #2a0612; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.rail-badge:empty, .rail-count:empty { display: none; }
.rail-live { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3fdc8f; box-shadow: 0 0 0 0 rgba(63, 220, 143, 0.6); animation: pulse 2s infinite; }
.rail-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rail-line); }
.ai-status {
  display: flex; gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(44, 194, 178, 0.12), rgba(240, 124, 158, 0.1));
  border: 1px solid rgba(212, 231, 227, 0.1);
}
.ai-status b { display: block; font-size: 12.5px; font-weight: 600; color: #f2faf8; }
.ai-status small { display: block; font-size: 11.5px; color: var(--rail-muted); font-variant-numeric: tabular-nums; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; text-align: left; color: var(--rail-ink); }
.me:hover { background: var(--rail-hover); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.me-text b { font-size: 13px; font-weight: 600; }
.me-text small { font-size: 11.5px; color: var(--rail-muted); }
.me i[data-icon] { color: var(--rail-muted); }
.demo-note { font-size: 10.5px; color: var(--rail-muted); padding: 0 8px; line-height: 1.5; letter-spacing: 0.02em; }
.demo-note a { color: #8fe3d7; text-decoration: none; }
.demo-note a:hover { text-decoration: underline; }
.rail-scrim { display: none; }

/* the AI glyph: an iridescent enamel bead — the only place gum-rose meets lagoon */
.ai-glyph {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95) 0 9%, transparent 26%),
    conic-gradient(from 210deg, #2cc2b2, #7fd8ff, #f07c9e, #ffd9a8, #2cc2b2);
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 14px -4px rgba(240, 124, 158, 0.6);
  animation: glyphSpin 9s linear infinite;
}
.ai-glyph.sm { width: 16px; height: 16px; }
.ai-glyph.xs { width: 12px; height: 12px; }
@keyframes glyphSpin { to { filter: hue-rotate(360deg); } }

/* ============ TOPBAR ============ */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding-block: calc(14px + env(safe-area-inset-top, 0px)) 14px;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  position: relative; z-index: 20;
}
.icon-btn.burger { display: none; }
.tb-title { min-width: 0; flex: 0 1 auto; margin-right: auto; }
.tb-title h1 {
  font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1;
  letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-title p { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tb-search {
  display: flex; align-items: center; gap: 10px;
  width: min(360px, 32vw); height: 40px; padding: 0 8px 0 13px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13px; text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tb-search:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.tb-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; background: var(--surface-2);
}
.tb-actions { display: flex; align-items: center; gap: 8px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em;
}
.live-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
.live-pill[aria-pressed="false"] .pulse { background: var(--muted); animation: none; }
.live-pill[aria-pressed="false"] { color: var(--muted); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ============ CONTROLS ============ */
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center; position: relative;
  color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm i[data-icon] { width: 16px; height: 16px; }
.dot-badge {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--gum); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn i[data-icon] { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: transparent; color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-primary:hover { border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 22px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn-ai {
  border: 1px solid color-mix(in srgb, var(--gum) 35%, var(--line));
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(120deg, var(--accent), var(--gum)) border-box;
  border-color: transparent;
}
.btn-ai:hover { box-shadow: 0 8px 22px -12px var(--gum); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); box-shadow: none; border-color: transparent; }
.btn-danger { color: var(--crit-ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn.icon-only { width: 38px; padding: 0; }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon i[data-icon] { position: absolute; left: 11px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.input-icon .input { padding-left: 34px; }

.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 99px; background: var(--line-2);
  transition: background 0.2s;
}
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.25s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--line);
}
.seg button {
  height: 28px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.75; }
.chip .sw { width: 8px; height: 8px; border-radius: 3px; background: var(--cat, var(--accent)); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.tag.ai { background: var(--gum-wash); color: var(--gum); }
.tag.accent { background: var(--accent-wash); color: var(--accent); }

/* status pills: colour + icon + label, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 7px;
  border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--pc, var(--muted)) 13%, transparent);
  color: var(--pci, var(--ink-2));
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--muted)); flex: none; }
.pill.good { --pc: var(--good); --pci: var(--good-ink); }
.pill.warn { --pc: var(--warn); --pci: var(--warn-ink); }
.pill.serious { --pc: var(--serious); --pci: var(--crit-ink); }
.pill.crit { --pc: var(--crit); --pci: var(--crit-ink); }
.pill.info { --pc: var(--accent); --pci: var(--accent); }
.pill.ai { --pc: var(--gum); --pci: var(--gum); }
.pill.neutral { --pc: var(--muted); --pci: var(--ink-2); }
.pill.live::before { animation: pulse 2s infinite; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 64px; height: 64px; font-size: 21px; font-family: var(--font-display); font-weight: 400; letter-spacing: 0.02em; }
.av-1 { background: var(--av-1); color: var(--av-1i); }
.av-2 { background: var(--av-2); color: var(--av-2i); }
.av-3 { background: var(--av-3); color: var(--av-3i); }
.av-4 { background: var(--av-4); color: var(--av-4i); }
.av-5 { background: var(--av-5); color: var(--av-5i); }
.av-6 { background: var(--av-6); color: var(--av-6i); }

/* category colour hook for procedures */
.cat-exam { --cat: var(--s1); }
.cat-resto { --cat: var(--s2); }
.cat-hyg { --cat: var(--s3); }
.cat-cos { --cat: var(--s4); }
.cat-surg { --cat: var(--s5); }

/* ============ PANELS ============ */
.grid { display: grid; gap: 16px; }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  display: flex; flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px 0;
}
.panel-head h2, .panel-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }
.panel-head .sub { font-size: 12.5px; color: var(--muted); }
.panel-head .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; }
.panel-body { padding: 14px 18px 18px; min-width: 0; flex: 1; }
.panel-body.flush { padding: 10px 0 6px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.section-title { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.1; }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; white-space: nowrap; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 30px; }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--crit-ink); }
.delta small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi .spark { width: 84px; height: 30px; flex: none; }

/* meter */
.meter { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); transition: width 0.8s var(--ease); }
.meter.risk > i { background: var(--mc, var(--good)); }

/* ============ CHARTS ============ */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 10.5px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .hover-col { fill: var(--ink); opacity: 0; transition: opacity 0.12s; }
.chart .hover-col.on { opacity: 0.045; }
.chart .xhair { stroke: var(--ink-2); stroke-width: 1; opacity: 0; }
.chart .xhair.on { opacity: 0.35; }
.chart .bar { transition: opacity 0.15s; }
.chart.dim .bar:not(.hot) { opacity: 0.45; }
.chart .dot-ring { stroke: var(--surface); stroke-width: 2; }
.chart .draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .grow { transform-box: fill-box; transform-origin: bottom; animation: grow 0.8s var(--ease) both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 2px; }

.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar-name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.hbar-track { height: 10px; position: relative; }
.hbar-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); transform-origin: left; animation: growX 0.9s var(--ease) both; }
@keyframes growX { from { transform: scaleX(0); } }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; text-align: right; min-width: 52px; }

.heat { display: grid; gap: 3px; font-size: 11px; }
.heat-cell {
  border-radius: 5px; height: 26px; position: relative;
  background: color-mix(in srgb, var(--accent) calc(var(--v) * 100%), var(--surface-3));
  transition: transform 0.15s;
}
.heat-cell:hover { transform: scale(1.12); z-index: 1; box-shadow: 0 0 0 2px var(--surface); }
.heat-lbl { color: var(--muted); display: flex; align-items: center; font-variant-numeric: tabular-nums; }
.heat-lbl.top { justify-content: center; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.heat-scale i { width: 80px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3), var(--accent)); }

.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 60px; gap: 10px; align-items: center; font-size: 12.5px; }
.funnel-bar { height: 26px; border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--accent) var(--op, 80%), var(--surface)); display: flex; align-items: center; padding-left: 9px; color: var(--accent-ink); font-weight: 600; font-size: 12px; transform-origin: left; animation: growX 0.9s var(--ease) both; white-space: nowrap; min-width: 34px; }
.funnel-conv { color: var(--muted); font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.ring-label { position: absolute; text-align: center; line-height: 1.1; }
.ring-label b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-label small { font-size: 10.5px; color: var(--muted); }

.tip {
  position: fixed; z-index: 300; pointer-events: none;
  background: var(--ink); color: var(--surface);
  border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.45;
  box-shadow: var(--shadow-lg); max-width: 260px; font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 600; }
.tip .tt-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip .tt-row i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); display: inline-block; }
.tip .tt-title { opacity: 0.7; font-size: 11px; margin-bottom: 3px; }

/* ============ OVERVIEW ============ */
.hello {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
  padding: 6px 2px 22px;
}
.hello h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--t-hero); line-height: 1.02; letter-spacing: -0.01em; }
.hello h2 em { font-style: italic; color: var(--accent); }
.hello p { color: var(--ink-2); font-size: 14.5px; margin-top: 10px; max-width: 64ch; }
.hello p b { color: var(--ink); font-weight: 600; }
.hello-goal { display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.hello-goal .meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.hello-goal .meta b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }

.brief {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(125deg, color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--gum) 55%, transparent) 55%, var(--line) 80%) border-box;
  box-shadow: var(--shadow);
}
.brief::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gum) 16%, transparent), transparent 65%);
  pointer-events: none;
}
.brief-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 6px; position: relative; flex-wrap: wrap; }
.brief-head h2 { font-size: 15px; font-weight: 600; }
.brief-head small { color: var(--muted); font-size: 12px; }
.brief-list { list-style: none; margin: 0; padding: 6px 10px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; position: relative; }
.brief-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 10px; border-radius: 12px; transition: background 0.2s;
}
.brief-item:hover { background: var(--surface-2); }
.brief-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bi, var(--accent-wash)); color: var(--bic, var(--accent)); }
.brief-ic i[data-icon] { width: 16px; height: 16px; }
.brief-item p { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.brief-item p b { color: var(--ink); font-weight: 600; }
.brief-item .row { margin-top: 8px; gap: 6px; flex-wrap: wrap; }
.brief-item.done { opacity: 0.55; }
.brief-item.done p { text-decoration: line-through; text-decoration-color: var(--muted); }

.lanes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lane {
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2);
  padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.lane:hover { border-color: var(--line-2); transform: translateY(-2px); }
.lane-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.lane-head b { color: var(--ink); font-size: 12.5px; }
.lane-now { display: flex; gap: 10px; align-items: center; min-width: 0; }
.lane-now .who { min-width: 0; }
.lane-now .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-now .who small { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-progress { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.lane-progress i { display: block; height: 100%; background: var(--cat, var(--accent)); border-radius: 3px; transition: width 1s linear; }
.lane-next { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.lane-next b { color: var(--ink-2); font-weight: 500; }
.lane.idle .lane-now .who b { color: var(--muted); font-weight: 500; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 10px 18px; border-top: 1px solid var(--line); font-size: 13px;
}
.feed li:first-child { border-top: 0; }
.feed li.new { animation: feedIn 0.7s var(--ease); background: linear-gradient(90deg, var(--gum-wash), transparent 70%); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-8px); } }
.feed .fi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.feed .fi.ai { background: var(--gum-wash); color: var(--gum); }
.feed .fi.good { background: color-mix(in srgb, var(--good) 13%, transparent); color: var(--good-ink); }
.feed .fi i[data-icon] { width: 15px; height: 15px; }
.feed p { color: var(--ink-2); line-height: 1.45; }
.feed p b { color: var(--ink); font-weight: 600; }
.feed time { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.huddle { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.huddle label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.huddle label:hover { background: var(--surface-2); }
.huddle input { appearance: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-2); flex: none; margin-top: 1px; display: grid; place-items: center; transition: background 0.15s, border-color 0.15s; cursor: pointer; }
.huddle input:checked { background: var(--accent); border-color: var(--accent); }
.huddle input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.huddle input:checked + span { text-decoration: line-through; color: var(--muted); }
.huddle span b { color: var(--ink); font-weight: 600; }

.providers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prov { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.prov .info { min-width: 0; }
.prov b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prov small { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============ SCHEDULE ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .datebox { display: flex; align-items: center; gap: 4px; }
.toolbar .datebox b { font-size: 15px; font-weight: 600; min-width: 168px; text-align: center; font-variant-numeric: tabular-nums; }
.sched-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.sched-wrap.no-side { grid-template-columns: minmax(0, 1fr); }
.sched {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: auto; max-height: calc(100vh - 210px); position: relative; box-shadow: var(--shadow-sm);
  overscroll-behavior: contain;
}
.sched-grid { display: grid; grid-template-columns: 62px repeat(var(--cols), minmax(170px, 1fr)); min-width: calc(62px + var(--cols) * 170px); position: relative; }
.sched-colhead {
  position: sticky; top: 0; z-index: 6; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 9px; align-items: center; min-width: 0;
}
.sched-colhead .who { min-width: 0; line-height: 1.2; }
.sched-colhead b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-colhead small { font-size: 11.5px; color: var(--muted); display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sched-corner { position: sticky; top: 0; left: 0; z-index: 7; background: var(--surface); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.sched-times { position: sticky; left: 0; z-index: 5; background: var(--surface); border-right: 1px solid var(--line); }
.sched-times div { height: var(--slot); font-size: 10.5px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.sched-col { position: relative; border-right: 1px solid var(--line); min-width: 0; }
.sched-col:last-child { border-right: 0; }
.sched-col .hr { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); pointer-events: none; }
.sched-col .hr.half { border-top-style: dotted; opacity: 0.7; }
.sched-col.drop-ok { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.lunch {
  position: absolute; left: 0; right: 0; z-index: 1;
  background: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--muted) 12%, transparent) 7px 8px);
  display: grid; place-items: center; font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase;
  pointer-events: none;
}
.appt {
  position: absolute; left: 5px; right: 5px; z-index: 2;
  border-radius: 10px; padding: 6px 8px 6px 9px; overflow: hidden;
  background: color-mix(in srgb, var(--cat) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cat) 42%, transparent);
  color: var(--ink); cursor: grab; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
  transition: box-shadow 0.2s, transform 0.2s var(--ease), opacity 0.2s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.appt:hover { box-shadow: var(--shadow); z-index: 4; }
.appt .a-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.appt .a-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--cat); flex: none; }
.appt .a-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.appt .a-proc { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .a-meta { font-size: 10.5px; color: var(--muted); white-space: nowrap; display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.appt .a-flags { display: inline-flex; gap: 3px; margin-left: auto; flex: none; }
.appt .a-flag { width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); }
.appt .a-flag svg { width: 11px; height: 11px; }
.appt .a-flag.risk { background: var(--crit); color: #fff; }
.appt .a-flag.ai { background: var(--gum); color: #fff; }
.appt .a-flag.ok { background: var(--good); color: #fff; }
.appt.s-completed { opacity: 0.62; }
.appt.s-noshow { background: repeating-linear-gradient(-45deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); border-style: dashed; border-color: var(--crit); }
.appt.s-inchair { box-shadow: 0 0 0 2px var(--cat), var(--shadow); }
.appt.s-inchair::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
.appt.short .a-proc, .appt.short .a-meta { display: none; }
.appt.mid .a-meta { display: none; }
.appt.dragging { opacity: 0.92; box-shadow: var(--shadow-lg); cursor: grabbing; z-index: 50; transform: rotate(-1deg) scale(1.02); transition: none; }
.appt.ghost { opacity: 0.25; }
.appt.flash { animation: flash 1.6s var(--ease); }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 var(--gum); transform: scale(0.96); }
  30% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--gum) 30%, transparent); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 transparent; transform: none; }
}
.appt.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.appt .resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.gap {
  position: absolute; left: 5px; right: 5px; z-index: 1;
  border-radius: 10px; border: 1.5px dashed color-mix(in srgb, var(--gum) 55%, var(--line-2));
  background: color-mix(in srgb, var(--gum) 5%, transparent);
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 4px 9px;
  font-size: 11.5px; color: var(--gum); font-weight: 600; overflow: hidden;
}
.gap.past { opacity: 0.45; border-color: var(--line-2); color: var(--muted); background: transparent; }
.gap .btn { height: 24px; font-size: 11.5px; padding: 0 8px; border-radius: 7px; }
.now-line { position: absolute; left: 62px; right: 0; z-index: 8; height: 0; border-top: 2px solid var(--gum); pointer-events: none; }
.now-line::before { content: attr(data-t); position: absolute; left: -60px; top: -10px; background: var(--gum); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.now-line::after { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--gum); }
.sched-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.sched-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sched-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }

.week { display: grid; grid-template-columns: 62px repeat(6, minmax(120px, 1fr)); min-width: 800px; }
.week-head { padding: 10px; border-bottom: 1px solid var(--line); text-align: center; position: sticky; top: 0; background: var(--glass); backdrop-filter: blur(10px); z-index: 2; cursor: pointer; }
.week-head b { display: block; font-size: 13px; }
.week-head small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-head.today b { color: var(--accent); }
.week-cell { height: 46px; border-right: 1px solid var(--line); border-top: 1px solid var(--grid); padding: 4px; display: flex; gap: 2px; align-items: stretch; cursor: pointer; }
.week-cell:hover { background: var(--surface-2); }
.week-cell i { flex: 1; border-radius: 3px; background: color-mix(in srgb, var(--cat, var(--accent)) 70%, transparent); }
.week-cell i.free { background: var(--surface-3); }
.week-time { font-size: 10.5px; color: var(--muted); text-align: right; padding: 4px 8px 0 0; border-top: 1px solid var(--grid); font-variant-numeric: tabular-nums; }

.side-list { display: flex; flex-direction: column; }
.wl-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; }
.wl-item:first-child { border-top: 0; }
.wl-item b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-item small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* matching modal list */
.match { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s, background 0.3s; }
.match + .match { margin-top: 8px; }
.match b { font-size: 13.5px; }
.match small { display: block; color: var(--muted); font-size: 12px; }
.match .why { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.match .score { text-align: right; font-variant-numeric: tabular-nums; }
.match .score b { font-size: 17px; display: block; }
.match.sent { border-color: color-mix(in srgb, var(--gum) 45%, var(--line)); }
.match.won { border-color: var(--good); background: color-mix(in srgb, var(--good) 7%, var(--surface)); }
.match.lost { opacity: 0.5; }
.match .reply { grid-column: 2 / -1; font-size: 12.5px; padding: 8px 10px; border-radius: 10px 10px 10px 3px; background: var(--surface-3); color: var(--ink); justify-self: start; animation: feedIn 0.5s var(--ease); }

/* ============ PATIENTS ============ */
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.stat small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .input-icon { flex: 1 1 220px; max-width: 340px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.table th button { color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th button[data-dir]::after { content: "↓"; font-size: 10px; }
.table th button[data-dir="asc"]::after { content: "↑"; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.pt-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.pt-cell b { display: block; font-weight: 600; font-size: 13px; }
.pt-cell small { display: block; color: var(--muted); font-size: 11.5px; }
.risk-cell { display: flex; align-items: center; gap: 8px; min-width: 96px; }
.risk-cell .meter { width: 56px; height: 6px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }

/* ============ DRAWER ============ */
.drawer-scrim { position: fixed; inset: 0; background: rgba(4, 14, 16, 0.42); z-index: 90; animation: fadeIn 0.25s; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(760px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn 0.42s var(--ease);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer.narrow { width: min(460px, 100vw); }
.drawer.closing { animation: slideOut 0.25s ease forwards; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes slideOut { to { transform: translateX(40px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.drawer-head { padding: 18px 22px 0; display: flex; gap: 16px; align-items: flex-start; padding-right: max(22px, env(safe-area-inset-right, 0px)); }
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.05; }
.drawer-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.drawer-tabs { display: flex; gap: 2px; padding: 14px 22px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.drawer-tabs button { padding: 9px 12px 11px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.drawer-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; padding-right: max(22px, env(safe-area-inset-right, 0px)); }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { padding: 11px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.fact small { display: block; font-size: 11.5px; color: var(--muted); }
.fact b { display: block; font-size: 14.5px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-card {
  border-radius: 14px; padding: 14px 16px; position: relative;
  background: linear-gradient(135deg, var(--gum-wash), var(--accent-wash));
  border: 1px solid color-mix(in srgb, var(--gum) 22%, var(--line));
}
.ai-card .row:first-child { margin-bottom: 8px; }
.ai-card .ai-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gum); }
.ai-card p, .ai-card li { font-size: 13.5px; color: var(--ink); line-height: 1.6; }
.ai-card ul { margin: 0; padding-left: 18px; }
.sub-h { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.sub-h:first-child { margin-top: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 14px; top: 8px; bottom: 8px; width: 1px; background: var(--line-2); }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; position: relative; font-size: 13px; }
.timeline .tl-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); z-index: 1; }
.timeline .tl-dot svg { width: 12px; height: 12px; }
.timeline .tl-dot.c { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 18%, var(--surface)); }
.timeline .tl-dot.ai { border-color: var(--gum); color: var(--gum); }
.timeline b { font-weight: 600; }
.timeline p { color: var(--ink-2); }
.timeline time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* odontogram */
.odonto-wrap { border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px 10px; background: radial-gradient(120% 90% at 50% 50%, var(--surface), var(--surface-2)); overflow-x: auto; }
.odonto { min-width: 600px; }
.odonto svg { width: 100%; height: auto; overflow: visible; }
.tooth { cursor: pointer; }
.tooth .crown { fill: var(--pearl); stroke: var(--line-2); stroke-width: 1.2; transition: fill 0.2s, stroke 0.2s; }
.tooth .root { fill: none; stroke: var(--line-2); stroke-width: 1.2; stroke-linecap: round; }
.tooth .tn { fill: var(--muted); font-size: 9.5px; font-family: var(--font-mono); text-anchor: middle; }
.tooth .perio { font-size: 8.5px; font-family: var(--font-mono); text-anchor: middle; fill: var(--muted); }
.tooth .perio.deep { fill: var(--crit-ink); font-weight: 700; }
.tooth:hover .crown { stroke: var(--accent); stroke-width: 2; }
.tooth:focus-visible { outline: none; }
.tooth:focus-visible .crown { stroke: var(--accent); stroke-width: 2.5; }
.tooth.sel .crown { stroke: var(--accent); stroke-width: 2.5; }
.tooth.c-caries .crown { fill: color-mix(in srgb, var(--crit) 32%, var(--pearl)); stroke: var(--crit); }
.tooth.c-filling .crown { fill: color-mix(in srgb, var(--s1) 35%, var(--pearl)); stroke: var(--s1); }
.tooth.c-crown .crown { fill: color-mix(in srgb, var(--s4) 45%, var(--pearl)); stroke: var(--s4); }
.tooth.c-rct .root { stroke: var(--s5); stroke-width: 2.4; }
.tooth.c-rct .crown { stroke: var(--s5); }
.tooth.c-implant .crown { fill: color-mix(in srgb, var(--ink-2) 22%, var(--pearl)); stroke: var(--ink-2); }
.tooth.c-implant .root { stroke: var(--ink-2); stroke-dasharray: 2 2; stroke-width: 2; }
.tooth.c-missing { opacity: 0.32; }
.tooth.c-missing .crown { fill: transparent; stroke-dasharray: 3 3; }
.tooth .mark { font-size: 10px; font-weight: 700; text-anchor: middle; fill: var(--ink); pointer-events: none; font-family: var(--font-ui); }
.tooth .plan-ring { fill: none; stroke: var(--gum); stroke-width: 1.8; stroke-dasharray: 4 3; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -14; } }
.odonto-cap { font-size: 11.5px; color: var(--muted); margin-top: 8px; padding: 0 6px; font-family: var(--font-mono); }
.odonto-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink-2); margin-top: 10px; padding: 0 6px; }
.odonto-legend span { display: inline-flex; gap: 6px; align-items: center; }
.odonto-legend i { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 30%, var(--pearl)); }
.odonto-legend i.ring { border-style: dashed; background: transparent; border-color: var(--gum); }

.plan-table td { white-space: normal; }
.plan-total { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }

/* ============ POPOVER / MENU ============ */
.pop {
  position: fixed; z-index: 150; min-width: 200px; max-width: min(340px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; animation: popIn 0.18s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.pop h4 { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.pop-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: 13px; text-align: left; color: var(--ink); }
.pop-item:hover, .pop-item:focus-visible { background: var(--surface-3); box-shadow: none; }
.pop-item i[data-icon] { width: 16px; height: 16px; color: var(--muted); }
.pop-item .sw { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--c, var(--line-2)); background: color-mix(in srgb, var(--c, transparent) 30%, var(--pearl)); flex: none; }
.pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.notif { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 12.5px; color: var(--ink-2); }
.notif:hover { background: var(--surface-2); }
.notif b { color: var(--ink); }
.notif time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ============ MODAL ============ */
.modal-scrim { position: fixed; inset: 0; z-index: 120; background: rgba(4, 14, 16, 0.5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fadeIn 0.2s; overflow-y: auto; }
.modal {
  width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); animation: modalIn 0.35s var(--ease); display: flex; flex-direction: column; max-height: calc(100vh - 40px);
}
.modal.wide { width: min(820px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 27px; line-height: 1.1; flex: 1; }
.modal-head p { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 12px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.slot-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-opt { padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; text-align: left; line-height: 1.3; }
.slot-opt small { display: block; color: var(--muted); font-size: 11px; }
.slot-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent); }
.typeahead { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 5; padding: 4px; max-height: 240px; overflow-y: auto; }

/* ============ COMMAND PALETTE ============ */
.palette-scrim { position: fixed; inset: 0; z-index: 160; background: rgba(4, 14, 16, 0.45); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fadeIn 0.15s; }
.palette { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn 0.25s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input i[data-icon] { color: var(--muted); }
.palette-input input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; min-width: 0; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-sec { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; font-size: 13.5px; }
.palette-item[aria-selected="true"] { background: var(--accent-wash); }
.palette-item i[data-icon] { color: var(--muted); width: 17px; height: 17px; }
.palette-item small { color: var(--muted); margin-left: auto; font-size: 12px; white-space: nowrap; }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }

/* ============ COPILOT ============ */
.copilot {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(430px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slideIn 0.4s var(--ease);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cp-head { display: flex; gap: 12px; align-items: center; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--line); }
.cp-head div { flex: 1; min-width: 0; }
.cp-head b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.1; }
.cp-head small { color: var(--muted); font-size: 12px; }
.cp-log { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; font-size: 13.5px; line-height: 1.6; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--surface); padding: 9px 13px; border-radius: 16px 16px 4px 16px; }
.msg.ai { align-self: flex-start; color: var(--ink); display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.msg.ai .ai-glyph { width: 22px; height: 22px; margin-top: 2px; }
.msg.ai .body { min-width: 0; }
.msg.ai p + p, .msg.ai p + ul, .msg.ai ul + p { margin-top: 8px; }
.msg.ai ul { margin: 6px 0 0; padding-left: 18px; }
.msg.ai li { margin: 2px 0; }
.msg.ai .row { margin-top: 10px; flex-wrap: wrap; gap: 6px; }
.msg .mini { width: 100%; font-size: 12.5px; border-collapse: collapse; margin-top: 8px; }
.msg .mini td { padding: 6px 4px; border-top: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg .mini td:last-child { text-align: right; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.cp-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.cp-suggest button { font-size: 12px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); text-align: left; }
.cp-suggest button:hover { border-color: var(--gum); color: var(--ink); }
.cp-form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.cp-form input { flex: 1; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 13px; min-width: 0; }
.cp-form input:focus { outline: none; border-color: var(--gum); box-shadow: 0 0 0 3px var(--gum-wash); }
.caret::after { content: ""; display: inline-block; width: 7px; height: 14px; background: var(--gum); vertical-align: -2px; margin-left: 2px; animation: caret 0.8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* ============ TOASTS ============ */
.toasts { position: fixed; z-index: 400; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100vw - 32px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px 11px 14px; border-radius: 14px; background: var(--ink); color: var(--surface);
  box-shadow: var(--shadow-lg); font-size: 13px; animation: toastIn 0.4s var(--ease);
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast p { flex: 1; min-width: 0; line-height: 1.4; }
.toast p b { font-weight: 600; }
.toast .t-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); flex: none; }
.toast .t-ic i[data-icon] { width: 15px; height: 15px; }
.toast .ai-glyph { width: 22px; height: 22px; }
.toast button { color: var(--accent-hi); font-weight: 600; font-size: 12.5px; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 500; }

/* ============ PIPELINE ============ */
.pipe-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 360px; scroll-snap-align: start; transition: background 0.2s, border-color 0.2s; }
.col.over { background: var(--accent-wash); border-color: var(--accent); }
.col-head { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.col-head .row b { font-size: 13px; }
.col-head .count { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.col-head .sum { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.col-head .stage-bar { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.col-head .stage-bar i { display: block; height: 100%; background: var(--accent); opacity: var(--o, 1); }
.col-cards { display: flex; flex-direction: column; gap: 8px; padding: 0 10px 12px; flex: 1; }
.deal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px;
  display: flex; flex-direction: column; gap: 8px; cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: box-shadow 0.2s, transform 0.2s var(--ease), border-color 0.2s;
}
.deal:hover { box-shadow: var(--shadow); border-color: var(--line-2); }
.deal.dragging { box-shadow: var(--shadow-lg); transform: rotate(2deg) scale(1.03); cursor: grabbing; position: fixed; z-index: 200; pointer-events: none; transition: none; }
.deal.placeholder { opacity: 0.3; border-style: dashed; }
.deal .d-top { display: flex; gap: 9px; align-items: center; min-width: 0; }
.deal .d-top div { min-width: 0; flex: 1; }
.deal .d-top b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .d-top small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .d-val { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.deal .d-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.deal .d-next { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; padding: 7px 8px; border-radius: 9px; background: var(--gum-wash); }
.deal .d-next .ai-glyph { margin-top: 2px; }
.deal .prob { display: flex; align-items: center; gap: 6px; }
.deal .prob .meter { width: 44px; height: 5px; }

/* ============ INBOX ============ */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; height: calc(100vh - 150px); min-height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ib-filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ib-items { overflow-y: auto; flex: 1; }
.ib-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; position: relative; transition: background 0.12s; }
.ib-item:hover { background: var(--surface-2); }
.ib-item[aria-current="true"] { background: var(--accent-wash); }
.ib-item.unread::before { content: ""; position: absolute; left: 5px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gum); }
.ib-item .top { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.ib-item .top b { font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item .top time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ib-item .prev { font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.ib-item .meta { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.ib-item .ch { position: absolute; left: 36px; top: 34px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--ink-2); box-shadow: 0 0 0 2px var(--surface); }
.ib-item .ch svg { width: 10px; height: 10px; }
.ib-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-thread-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ib-thread-head .titles { flex: 1; min-width: 0; }
.ib-thread-head b { font-size: 14.5px; }
.ib-thread-head small { display: block; color: var(--muted); font-size: 12px; }
.icon-btn.ib-back { display: none; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: radial-gradient(100% 60% at 50% 0%, var(--surface-2), var(--surface)); }
.bubble { max-width: 74%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; position: relative; animation: feedIn 0.35s var(--ease); }
.bubble.in { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 5px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.bubble.out.ai { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--gum))); }
.bubble .by { display: block; font-size: 10.5px; opacity: 0.75; margin-top: 4px; font-weight: 500; }
.ib-day { align-self: center; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 0; }
.call-card { align-self: stretch; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 12px 14px; }
.call-card .wave { display: flex; gap: 2px; align-items: center; height: 32px; margin: 8px 0; }
.call-card .wave i { flex: 1; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.call-card .lines { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-top: 8px; }
.call-card .lines p b { font-weight: 600; color: var(--ink-2); margin-right: 6px; }
.ib-compose { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.ib-compose .draft-tag { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gum); font-weight: 600; flex-wrap: wrap; }
.ib-compose textarea { min-height: 70px; }
.ib-ctx { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ctx-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ctx-card h4 { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ RECEPTIONIST ============ */
.rx { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.phone-stage {
  border-radius: 22px; padding: 20px; position: relative; overflow: hidden; min-height: 520px;
  background:
    radial-gradient(80% 60% at 20% 0%, rgba(44, 194, 178, 0.22), transparent 60%),
    radial-gradient(70% 60% at 100% 100%, rgba(240, 124, 158, 0.18), transparent 60%),
    #071a1c;
  color: #e3efec; display: flex; flex-direction: column; gap: 14px;
  border: 1px solid rgba(212, 231, 227, 0.1);
}
.phone-stage .ps-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.phone-stage .ps-head b { font-size: 15px; }
.phone-stage .ps-head small { color: #8fb3ae; font-size: 12px; display: block; }
.phone-stage .caller { display: flex; align-items: center; gap: 12px; }
.ps-orb { width: 54px; height: 54px; border-radius: 50%; position: relative; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #ffffff 0 6%, transparent 22%), conic-gradient(from 0deg, #2cc2b2, #7fd8ff, #f07c9e, #ffd9a8, #2cc2b2); }
.ps-orb.talking { animation: orb 1.2s ease-in-out infinite; }
@keyframes orb { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(240, 124, 158, 0.12), 0 0 40px rgba(44, 194, 178, 0.45); } }
.ps-wave { display: flex; gap: 3px; align-items: center; height: 38px; flex: 1; min-width: 120px; }
.ps-wave i { flex: 1; height: 10%; border-radius: 3px; background: linear-gradient(180deg, #5edfd0, #f07c9e); transition: height 0.12s; opacity: 0.85; }
.ps-transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; min-height: 260px; max-height: 420px; }
.ps-line { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 10px; font-size: 13.5px; line-height: 1.55; animation: feedIn 0.4s var(--ease); }
.ps-line .spk { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: #8fb3ae; padding-top: 3px; font-weight: 600; }
.ps-line.ai .spk { color: #f5a9bf; }
.ps-line.sys { grid-template-columns: 1fr; }
.ps-line.sys p { font-size: 12px; color: #8fb3ae; font-family: var(--font-mono); border-left: 2px solid #f07c9e; padding-left: 10px; }
.ps-empty { margin: auto; text-align: center; color: #8fb3ae; max-width: 36ch; font-size: 13.5px; }
.ps-empty b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 26px; color: #e3efec; margin-bottom: 6px; }
.scen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.scen button { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(212, 231, 227, 0.14); background: rgba(212, 231, 227, 0.05); color: #e3efec; font-size: 12.5px; transition: background 0.15s, border-color 0.15s; }
.scen button:hover { background: rgba(212, 231, 227, 0.1); border-color: rgba(240, 124, 158, 0.5); }
.scen button b { display: block; font-size: 13px; margin-bottom: 2px; }
.scen button small { color: #8fb3ae; font-size: 11.5px; }
.scen button[disabled] { opacity: 0.4; }
.entities { display: flex; flex-direction: column; gap: 8px; }
.entity { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; animation: feedIn 0.4s var(--ease); }
.entity span { color: var(--muted); }
.entity b { font-weight: 600; text-align: right; }
.intent-bars { display: flex; flex-direction: column; gap: 8px; }
.intent-bar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 40px; gap: 8px; align-items: center; font-size: 12.5px; }
.intent-bar .meter > i { background: var(--gum); }
.intent-bar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ============ AUTOMATIONS ============ */
.auto-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.auto-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.auto {
  border: 1px solid var(--line); background: var(--surface); border-radius: 15px; padding: 13px;
  display: flex; flex-direction: column; gap: 9px; cursor: pointer; min-width: 0; text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease);
}
.auto:hover { border-color: var(--line-2); transform: translateY(-1px); }
.auto[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.auto.off { opacity: 0.6; }
.auto .a-head { display: flex; gap: 10px; align-items: flex-start; }
.auto .a-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); flex: none; }
.auto .a-ic i[data-icon] { width: 16px; height: 16px; }
.auto .a-head div { flex: 1; min-width: 0; }
.auto .a-head b { display: block; font-size: 13px; line-height: 1.3; }
.auto .a-head small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.auto .a-stats { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.auto .a-stats b { color: var(--ink); font-weight: 600; }
.flow { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 0; }
.fnode {
  width: min(360px, 100%); border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 11px 13px;
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; position: relative;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.fnode .fn-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.fnode .fn-ic i[data-icon] { width: 15px; height: 15px; }
.fnode.trigger .fn-ic { background: var(--accent-wash); color: var(--accent); }
.fnode.ai .fn-ic { background: var(--gum-wash); color: var(--gum); }
.fnode.goal .fn-ic { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.fnode b { display: block; font-size: 13px; }
.fnode small { display: block; font-size: 12px; color: var(--muted); }
.fnode.lit { border-color: var(--gum); box-shadow: 0 0 0 4px var(--gum-wash); }
.fwire { width: 2px; height: 26px; background: var(--line-2); position: relative; overflow: hidden; }
.fwire::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; top: -10px; background: var(--gum); border-radius: 2px; }
.fwire.run::after { animation: wire 0.5s linear forwards; }
@keyframes wire { to { top: 26px; } }
.fsplit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(460px, 100%); }
.fsplit .fnode { width: 100%; }
.fsplit .lbl { font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 6px; letter-spacing: 0.06em; text-transform: uppercase; }
.phone {
  width: 250px; max-width: 100%; border-radius: 34px; padding: 12px; margin: 0 auto;
  background: linear-gradient(160deg, #1b2b2d, #0a1416); box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.phone-screen { border-radius: 24px; background: #f4f6f6; color: #0b1a1d; padding: 14px 10px 16px; min-height: 260px; display: flex; flex-direction: column; gap: 8px; }
.phone-screen .ph-top { text-align: center; font-size: 11px; color: #6c8083; margin-bottom: 4px; }
.phone-screen .ph-top b { display: block; color: #0b1a1d; font-size: 12.5px; }
.phone-screen .sms { align-self: flex-start; background: #e2e8e7; padding: 8px 11px; border-radius: 16px 16px 16px 4px; font-size: 12.5px; line-height: 1.45; max-width: 92%; white-space: pre-wrap; }
.phone-screen .sms.me { align-self: flex-end; background: #0d7a71; color: #fff; border-radius: 16px 16px 4px 16px; }
.var { display: inline-block; padding: 0 5px; border-radius: 5px; background: var(--gum-wash); color: var(--gum); font-family: var(--font-mono); font-size: 11.5px; }

/* ============ RECALL / REPUTATION / ANALYTICS ============ */
.seg-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.seg-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 14px 16px; text-align: left; display: flex; flex-direction: column; gap: 6px; transition: border-color 0.2s, box-shadow 0.2s; min-width: 0; }
.seg-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.seg-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.seg-card small { font-size: 12px; color: var(--muted); }
.seg-card b { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.seg-card span { font-size: 12.5px; color: var(--ink-2); }
.countdown { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r-lg); background: linear-gradient(120deg, var(--accent-wash), var(--gum-wash)); border: 1px solid var(--line); margin-bottom: 16px; }
.countdown .big { font-family: var(--font-display); font-size: 46px; line-height: 0.9; }
.countdown p { color: var(--ink-2); font-size: 13.5px; max-width: 60ch; flex: 1; min-width: 220px; }
.countdown p b { color: var(--ink); }
.camp-progress { display: flex; flex-direction: column; gap: 10px; }
.camp-step { display: grid; grid-template-columns: 110px minmax(0, 1fr) 60px; gap: 10px; align-items: center; font-size: 12.5px; }
.camp-step b { text-align: right; font-variant-numeric: tabular-nums; }

.stars { display: inline-flex; gap: 1px; color: var(--s4); }
.stars svg { width: 14px; height: 14px; }
.rating-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.rating-hero .big { font-family: var(--font-display); font-size: 70px; line-height: 0.9; }
.dist { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 200px; }
.dist-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 36px; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); }
.dist-row .meter > i { background: var(--s4); }
.dist-row b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.review { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.review:first-child { border-top: 0; }
.review .rv-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.review .rv-top b { font-size: 13.5px; }
.review p { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.review .reply-box { border-left: 2px solid var(--gum); padding: 8px 12px; border-radius: 0 10px 10px 0; background: var(--gum-wash); font-size: 13px; color: var(--ink); }
.review .reply-box.posted { border-left-color: var(--accent); background: var(--accent-wash); }

.insight { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px; border-radius: 12px; }
.insight + .insight { border-top: 1px solid var(--line); border-radius: 0; }
.insight .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--gum-wash); color: var(--gum); }
.insight .ic i[data-icon] { width: 16px; height: 16px; }
.insight b { font-size: 13.5px; display: block; }
.insight p { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.insight .impact { font-size: 12px; font-weight: 600; color: var(--good-ink); margin-top: 6px; display: block; }

.segbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.segbar i { display: block; height: 100%; background: var(--c); transform-origin: left; animation: growX 0.9s var(--ease) both; }

/* ==========================================================================
   GLASS LAYER — frosted panels floating over a slowly drifting aurora.
   Type follows the Gainn system: Instrument Serif for display, Instrument
   Sans for UI, IBM Plex Mono for uppercase labels with wide tracking.
   ========================================================================== */
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes ang { to { --ang: 360deg; } }

/* ---- the light behind the glass ---- */
.aurora { position: fixed; inset: -6vmax; z-index: 0; pointer-events: none; transition: transform 1.4s var(--ease); }
.aurora i { position: absolute; width: 64vmax; height: 64vmax; border-radius: 50%; opacity: var(--aurora-op); will-change: transform; }
.aurora i:nth-child(1) { background: radial-gradient(circle at center, var(--aurora-1) 0%, transparent 64%); left: -12vmax; top: -16vmax; animation: drift1 38s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: radial-gradient(circle at center, var(--aurora-2) 0%, transparent 64%); right: -18vmax; top: -12vmax; animation: drift2 46s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: radial-gradient(circle at center, var(--aurora-3) 0%, transparent 62%); left: 22vmax; bottom: -32vmax; animation: drift3 42s ease-in-out infinite alternate; }
.aurora i:nth-child(4) { background: radial-gradient(circle at center, var(--aurora-4) 0%, transparent 60%); right: -4vmax; bottom: -24vmax; width: 46vmax; height: 46vmax; animation: drift4 34s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(20vmax, 14vmax) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-16vmax, 18vmax) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-14vmax, -16vmax) scale(1.12); } }
@keyframes drift4 { to { transform: translate(-22vmax, -8vmax) scale(1.2); } }
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.app { position: relative; z-index: 1; }
.main { background: transparent; }

/* ---- glass surfaces ---- */
.panel, .kpi, .stat, .seg-card, .hello-goal, .sched, .inbox, .col, .countdown, .auto, .brief {
  position: relative; isolation: isolate;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), var(--glass-shadow);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
}
.lane, .deal, .match, .fact, .prov, .ctx-card, .entity, .wl-item:hover {
  background: var(--glass-card);
}
.lane, .deal, .match, .ctx-card { border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge); }
.lane, .deal { position: relative; isolation: isolate; }
.fact, .prov { box-shadow: inset 0 0 0 1px var(--glass-line); }

/* pointer light: follows the cursor across every glass card */
.panel::after, .kpi::after, .stat::after, .seg-card::after, .auto::after, .lane::after, .deal::after, .hello-goal::after, .brief::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, -30%), var(--spot), transparent 46%);
  opacity: 0; transition: opacity 0.4s ease;
}
.panel:hover::after, .kpi:hover::after, .stat:hover::after, .seg-card:hover::after, .auto:hover::after, .lane:hover::after, .deal:hover::after, .hello-goal:hover::after, .brief:hover::after { opacity: 1; }

/* ---- rail: dark floating glass in both themes ---- */
.rail {
  margin: 12px 0 12px 12px; border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(130% 45% at 0% 0%, rgba(44, 194, 178, 0.2), transparent 62%),
    radial-gradient(100% 40% at 100% 100%, rgba(240, 124, 158, 0.14), transparent 62%),
    rgba(4, 20, 22, 0.8);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: blur(28px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 70px -30px rgba(2, 16, 18, 0.7);
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
.rail-nav { position: relative; }
.rail-nav a { position: relative; z-index: 1; }
.rail-nav a[aria-current="page"] { background: transparent; }
.rail-ind {
  position: absolute; left: 0; right: 2px; top: 0; height: 40px; z-index: 0; border-radius: 12px; pointer-events: none;
  background: linear-gradient(90deg, rgba(44, 194, 178, 0.24), rgba(44, 194, 178, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(94, 223, 208, 0.16);
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.5, 1), height 0.3s ease, opacity 0.3s;
}
.rail-ind::before { content: ""; position: absolute; left: -3px; top: 50%; width: 4px; height: 16px; border-radius: 4px; transform: translateY(-50%); background: #5edfd0; box-shadow: 0 0 14px 2px rgba(94, 223, 208, 0.7); }
.ai-status { position: relative; overflow: hidden; }
.ai-status::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 5.5s ease-in-out infinite; }
@keyframes sweep { 0%, 55% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }

/* ---- floating topbar ---- */
.topbar {
  margin: calc(12px + env(safe-area-inset-top, 0px)) 12px 0 12px;
  padding-block: 11px; padding-left: 20px; padding-right: 12px;
  border-radius: 20px; border: 1px solid var(--glass-line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), var(--glass-shadow);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
}
.view { padding-block: 18px 60px; }
.tb-search, .live-pill { background: var(--field); border-color: var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge); }

/* ---- type: Gainn labels ---- */
.eyebrow, .rail-group, .sub-h, .table th, .pop h4, .palette-sec, .ctx-card h4, .fsplit .lbl, .ai-card .ai-label, .brand-text small {
  font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.18em; font-size: 10.5px; text-transform: uppercase;
}
.kpi-label, .stat small, .seg-card small { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.chip { flex: none; }
.brand-text small { font-size: 9.5px; letter-spacing: 0.16em; white-space: nowrap; }
.kpi-value, .stat b, .seg-card b, .col-head .sum, .hello-goal .meta b, .ring-label b { font-stretch: 90%; letter-spacing: -0.03em; }
.tb-title h1, .hello h2, .section-title h2, .drawer-head h2, .modal-head h2 { letter-spacing: -0.015em; }
.mono, kbd { font-family: var(--font-mono); }

/* ---- hero ---- */
.hello h2 em {
  background: linear-gradient(100deg, var(--accent) 0%, var(--gum) 42%, var(--accent-hi) 72%, var(--accent) 100%);
  background-size: 240% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: 0.08em; margin-right: -0.05em; animation: inkSheen 8s ease-in-out infinite alternate;
}
@keyframes inkSheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.ring .val { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }

/* ---- brief: a living border for the AI ---- */
.brief { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), var(--glass-shadow), 0 24px 60px -34px var(--gum); }
.brief::before {
  inset: -1px; width: auto; height: auto; z-index: 2; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--ang), transparent 0deg, var(--accent) 70deg, var(--gum) 150deg, #ffd59c 190deg, transparent 250deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: ang 7s linear infinite;
}
.btn-ai {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--ang), var(--accent), var(--gum), #ffd59c, var(--accent)) border-box;
  animation: ang 5s linear infinite;
}

/* ---- controls ---- */
.btn, .chip, .icon-btn, .seg button, .pop-item, .palette-item, .slot-opt { position: relative; overflow: hidden; }
.btn { background: var(--field); border-color: var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge); }
.btn:hover { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), 0 8px 20px -12px rgba(0, 0, 0, 0.35); }
.btn-ghost, .btn-ghost:hover { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-primary { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px color-mix(in srgb, var(--accent) 70%, #000), 0 10px 24px -12px var(--accent); }
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px color-mix(in srgb, var(--accent) 70%, #000), 0 14px 30px -12px var(--accent); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.38) 50%, transparent 68%); transform: translateX(-130%); transition: transform 0.8s var(--ease); pointer-events: none; }
.btn-primary:hover::after { transform: translateX(130%); }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: 0.2; transform: scale(0); animation: ripple 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.mag { transition: transform 0.35s var(--ease), box-shadow 0.2s; }
.chip { background: var(--field); border-color: var(--glass-line); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); box-shadow: 0 6px 16px -10px var(--ink); }
.input, .select, .textarea { background: var(--field); border-color: var(--glass-line); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px var(--glass-edge); }
.input:focus, .select:focus, .textarea:focus { box-shadow: var(--ring); }
.seg { background: var(--surface-3); border-color: var(--glass-line); }
.seg button { transition: background 0.25s, color 0.25s, box-shadow 0.25s; }
.seg button[aria-pressed="true"] { background: var(--glass-2); box-shadow: inset 0 1px 0 var(--glass-hi), 0 2px 8px -3px rgba(0, 0, 0, 0.2); }
.switch span { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15); }
.switch input:checked + span { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: 0 0 12px -2px var(--accent); }
.tag { background: var(--surface-3); }
.table th { background: transparent; }
.table-wrap[style*="max-height"] .table th { background: var(--glass-2); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.table tbody tr { transition: background 0.2s; }

/* ---- KPI tiles tilt toward the pointer ---- */
.kpi { transform-style: preserve-3d; transition: transform 0.45s var(--ease), box-shadow 0.3s; }
.kpi:hover { transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-3px); }
.kpi .spark path:nth-of-type(2) { stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 1.8s var(--ease) 0.35s forwards; }
.kpi .spark circle { animation: dotPop 0.5s var(--ease) 1.6s both; transform-box: fill-box; transform-origin: center; }
@keyframes dotPop { from { transform: scale(0); } }

/* ---- schedule ---- */
.sched-corner, .sched-times { background: var(--glass-2); }
.sched-colhead { background: var(--glass-2); }
.appt { box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent); }
.appt:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent), 0 12px 26px -14px color-mix(in srgb, var(--cat) 80%, #000); }
.appt.s-inchair { box-shadow: 0 0 0 2px var(--cat), 0 0 22px -4px var(--cat); }
.gap { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: gapBreathe 3.2s ease-in-out infinite; }
.gap.past { animation: none; }
@keyframes gapBreathe { 50% { background: color-mix(in srgb, var(--gum) 11%, transparent); } }
.now-line { box-shadow: 0 0 10px color-mix(in srgb, var(--gum) 70%, transparent); }

/* ---- pipeline, inbox, overlays ---- */
.col { background: var(--glass); }
.col.over { background: var(--accent-wash); box-shadow: 0 0 0 2px var(--accent), var(--glass-shadow); }
.deal.dragging { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); background: var(--glass-2); }
.ib-list, .ib-thread-head, .ib-compose { background: transparent; }
.ib-msgs { background: transparent; }
.bubble { animation: bubbleIn 0.45s cubic-bezier(0.34, 1.5, 0.5, 1); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(0.94); } }
.bubble.out { box-shadow: 0 8px 20px -12px var(--accent); }
.drawer, .copilot, .modal, .palette, .pop, .ta-list {
  background: var(--glass-2); border-color: var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), var(--shadow-lg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
}
.drawer, .copilot { top: 12px; right: 12px; bottom: 12px; border-radius: 24px; border: 1px solid var(--glass-line); overflow: hidden; }
.drawer-scrim, .modal-scrim, .palette-scrim { background: rgba(4, 14, 16, 0.32); -webkit-backdrop-filter: blur(6px) saturate(120%); backdrop-filter: blur(6px) saturate(120%); }
.modal { border-radius: 24px; }
.toast { background: color-mix(in srgb, var(--ink) 84%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-lg); animation: toastIn 0.55s cubic-bezier(0.34, 1.45, 0.5, 1); }
.tip { background: color-mix(in srgb, var(--ink) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.phone-stage { isolation: isolate; background: radial-gradient(80% 60% at 20% 0%, rgba(44, 194, 178, 0.24), transparent 60%), radial-gradient(70% 60% at 100% 100%, rgba(240, 124, 158, 0.2), transparent 60%), rgba(4, 22, 24, 0.86); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 70px -30px rgba(0, 0, 0, 0.6); }
.phone-stage::before { content: ""; position: absolute; z-index: -1; width: 70%; height: 70%; left: 15%; top: -25%; border-radius: 50%; background: radial-gradient(circle, rgba(94, 223, 208, 0.26), transparent 65%); animation: stageOrb 14s ease-in-out infinite alternate; pointer-events: none; }
@keyframes stageOrb { to { transform: translate(18%, 60%) scale(1.25); } }
.ps-orb { box-shadow: 0 0 30px -6px rgba(240, 124, 158, 0.6); }
.tooth { transition: transform 0.25s var(--ease); transform-box: fill-box; transform-origin: center; }
.tooth:hover { transform: translateY(-2px) scale(1.04); }
.fnode.lit { box-shadow: 0 0 0 4px var(--gum-wash), 0 0 28px -6px var(--gum); }
.feed li.new { animation: feedIn 0.7s var(--ease), feedGlow 2.4s ease-out; }
@keyframes feedGlow { from { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gum) 40%, transparent); } to { box-shadow: inset 0 0 0 1px transparent; } }
.countdown { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--gum) 10%, transparent)), var(--glass); }

/* ---- entrance choreography (driven by dental-crm-fx.js) ---- */
.view.enter > * { animation: none; }
.view.fx-in .fx-item { animation: fxIn 0.8s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes fxIn { from { opacity: 0.001; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
.view.fx-in .appt { animation: apptIn 0.55s var(--ease) both; animation-delay: calc(220ms + var(--i, 0) * 14ms); }
@keyframes apptIn { from { opacity: 0.001; transform: translateY(10px) scale(0.96); } }
.view.fx-in .deal { animation: apptIn 0.55s var(--ease) both; animation-delay: calc(260ms + var(--i, 0) * 30ms); }
.app.boot .rail { animation: railIn 0.9s var(--ease) both; }
.app.boot .rail-nav a, .app.boot .rail-group { animation: navIn 0.6s var(--ease) both; animation-delay: calc(160ms + var(--i, 0) * 32ms); }
.app.boot .topbar { animation: dropIn 0.8s var(--ease) 0.1s both; }
@keyframes railIn { from { opacity: 0.001; transform: translateX(-24px); } }
@keyframes navIn { from { opacity: 0.001; transform: translateX(-12px); } }
@keyframes dropIn { from { opacity: 0.001; transform: translateY(-16px); } }

/* theme switch: circular reveal (View Transitions) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ==========================================================================
   PRACTICE X-RAY — a panoramic radiograph of the whole practice.
   Deliberately one look in both themes: a dark film, like a real OPG.
   ========================================================================== */
.xr-tools .xr-intro { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; flex-wrap: wrap; }
.xr { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.xr-stage {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 26px; min-width: 0;
  display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 14px;
  color: #dcecef;
  background: radial-gradient(120% 80% at 50% 45%, #0f2d36 0%, #071419 55%, #020709 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 120px rgba(0, 0, 0, 0.6), 0 40px 90px -40px rgba(2, 12, 14, 0.85);
}
.xr-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px); }
.xr-stage::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(55% 45% at 50% 45%, rgba(94, 223, 208, 0.12), transparent 70%); animation: xrGlow 6s ease-in-out infinite alternate; }
@keyframes xrGlow { to { opacity: 0.45; transform: scale(1.08); } }
.xr-film-top, .xr-film-bottom { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); text-transform: uppercase; color: rgba(220, 236, 239, 0.62); }
.xr-film-top { font-size: 10.5px; letter-spacing: 0.18em; }
.xr-film-bottom { font-size: 9.5px; letter-spacing: 0.1em; flex-wrap: wrap; justify-content: space-between; color: rgba(220, 236, 239, 0.45); gap: 4px 12px; }
.xr-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr-mark { font-weight: 600; font-size: 12px; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(220, 236, 239, 0.35); border-radius: 5px; letter-spacing: 0; color: #eaf6f8; flex: none; }
.xr-status { display: inline-flex; align-items: center; gap: 7px; color: #ffd27a; white-space: nowrap; }
.xr-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1s ease-in-out infinite; }
.xr-status.done { color: #5fe3d2; }
.xr-status.done i { animation: none; box-shadow: 0 0 8px currentColor; }
.xr-hook { display: none; }
.xr-canvas-wrap { position: relative; height: clamp(250px, 44vh, 420px); }
.xr-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.xr-ruler { position: absolute; left: 0; right: 0; bottom: -6px; height: 8px; opacity: 0.55; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(220, 236, 239, 0.5) 0 1px, transparent 1px 50px) bottom / 100% 8px no-repeat, repeating-linear-gradient(90deg, rgba(220, 236, 239, 0.3) 0 1px, transparent 1px 10px) bottom / 100% 4px no-repeat; }
.xr-count { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin-top: 4px; }
.xr-cur { font-family: var(--font-display); font-size: clamp(46px, 6vw, 78px); line-height: 0.95; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #fff6e0 0%, #ffcd6b 38%, #ff9db5 72%, #ffffff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes countGlow { from { filter: drop-shadow(0 0 0 rgba(255, 205, 107, 0)); } to { filter: drop-shadow(0 0 22px rgba(255, 205, 107, 0.45)); } }
.xr-cap { font-size: 14px; color: rgba(220, 236, 239, 0.78); max-width: 40ch; }
.xr-feed { display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.xr-find { display: grid; grid-template-columns: 8px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.07); font-size: 12.5px; animation: findIn 0.5s var(--ease); }
@keyframes findIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.xr-find i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.xr-find b { color: #f2fbfc; font-weight: 600; white-space: nowrap; }
.xr-find span { color: rgba(220, 236, 239, 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr-find em { font-style: normal; font-family: var(--font-mono); color: #ffe2a3; white-space: nowrap; }
.xr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: rgba(220, 236, 239, 0.72); }
.xr-legend span { display: inline-flex; align-items: center; gap: 6px; }
.xr-legend i, .xr-row > i, .xr-plan i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
.xr-rows { display: flex; flex-direction: column; gap: 2px; }
.xr-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 9px 10px; border-radius: 12px; text-align: left; width: 100%; transition: background 0.2s; }
.xr-row:hover, .xr-row.on { background: var(--surface-3); }
.xr-row-l { font-size: 13px; font-weight: 500; min-width: 0; }
.xr-row-l small { display: block; font-size: 11.5px; color: var(--muted); }
.xr-row b { font-variant-numeric: tabular-nums; font-size: 14px; font-stretch: 90%; }
.xr-bar { grid-column: 2 / -1; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.xr-bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; box-shadow: 0 0 8px var(--c); }
.xr-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 10px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
.xr-total span { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; font-size: 10.5px; color: var(--muted); }
.xr-total b { font-family: var(--font-display); font-size: 34px; font-weight: 400; font-variant-numeric: tabular-nums; }
.xr-note { font-size: 12.5px; margin: 6px 10px 14px; line-height: 1.5; }
.xr-note b { color: var(--ink); }
.xr-story-ctl { display: none; }
.xr-plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.xr-plan li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 18px; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 12px; background: var(--glass-card); box-shadow: inset 0 0 0 1px var(--glass-line); font-size: 13.5px; transition: background 0.3s; }
.xr-plan b { font-variant-numeric: tabular-nums; }
.xr-plan em { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; }
.xr-plan li.run em { border-color: var(--accent); border-right-color: transparent; animation: spin 0.7s linear infinite; }
.xr-plan li.ok { background: color-mix(in srgb, var(--good) 9%, var(--glass-card)); }
.xr-plan li.ok em { background: var(--good); border-color: var(--good); }
.xr-plan li.ok em::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* Story mode: a 9:16 frame to screen-record for Reels and Stories */
.xr.story { position: fixed; inset: 0; z-index: 140; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: radial-gradient(70% 60% at 50% 40%, #0b2329, #010506 72%); animation: fadeIn 0.4s ease; }
.xr.story .xr-side { display: none; }
.xr.story .xr-stage { aspect-ratio: 9 / 16; height: min(calc(100vh - 84px), calc((100vw - 24px) * 16 / 9)); width: auto; max-width: 100%; padding: 22px 18px 14px; gap: 12px; border-radius: 30px; }
.xr.story .xr-hook { display: block; font-family: var(--font-display); font-size: clamp(26px, 4.3vh, 42px); line-height: 1.04; text-align: center; color: #f4fbfc; text-wrap: balance; margin: 8px 4px 0; letter-spacing: -0.01em; }
.xr-hook.swap { animation: hookSwap 0.55s var(--ease); }
@keyframes hookSwap { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }
.xr.story .xr-canvas-wrap { flex: 1; height: auto; min-height: 0; }
.xr.story .xr-count { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.xr.story .xr-cur { font-size: clamp(50px, 8.4vh, 88px); }
.xr.story .xr-cap { font-size: clamp(14px, 2vh, 19px); text-align: center; color: #eaf6f8; }
.xr.story .xr-feed { min-height: 0; }
.xr.story .xr-find:nth-child(n + 3) { display: none; }
.xr.story .xr-legend { justify-content: center; }
.xr.story .xr-film-bottom { justify-content: center; text-align: center; }
.xr.story .xr-story-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.xr-story-ctl .btn { background: rgba(255, 255, 255, 0.08); color: #e6f4f6; border-color: rgba(255, 255, 255, 0.12); box-shadow: none; }
.xr-story-ctl .btn:hover { background: rgba(255, 255, 255, 0.14); }
.xr-tip { font-size: 11px; color: rgba(220, 236, 239, 0.5); font-family: var(--font-mono); letter-spacing: 0.06em; }
.xr.story ~ * { visibility: hidden; }

/* Overview banner with a tiny live scan */
.xr-cta { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r-lg); color: inherit;
  background: linear-gradient(110deg, rgba(4, 22, 26, 0.92), rgba(9, 40, 44, 0.86) 55%, rgba(48, 18, 36, 0.86)); border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 44px -22px rgba(2, 16, 18, 0.8); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.xr-cta:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 26px 50px -22px rgba(2, 16, 18, 0.9); }
.xr-cta-film { position: relative; flex: none; width: 132px; height: 58px; border-radius: 12px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(220, 240, 244, 0.5) 0 4px, transparent 4px 7px) center 6px / 100% 20px no-repeat,
    repeating-linear-gradient(90deg, rgba(220, 240, 244, 0.5) 0 4px, transparent 4px 7px) center 32px / 100% 20px no-repeat,
    radial-gradient(circle at 50% 50%, #12343c, #030b0d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.xr-cta-film::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 205, 107, 0.0), rgba(255, 125, 159, 0.55), rgba(95, 227, 210, 0.55), rgba(255, 205, 107, 0.55)); mix-blend-mode: color; animation: ctaReveal 3.2s ease-in-out infinite; }
.xr-cta-film i { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #eafffc; box-shadow: 0 0 12px 3px rgba(94, 223, 208, 0.75); animation: ctaBeam 3.2s ease-in-out infinite; }
@keyframes ctaBeam { 0% { transform: translateX(-4px); } 70%, 100% { transform: translateX(134px); } }
@keyframes ctaReveal { 0% { clip-path: inset(0 100% 0 0); } 70%, 100% { clip-path: inset(0 0 0 0); } }
.xr-cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.xr-cta-text b { font-family: var(--font-display); font-weight: 400; font-size: 22px; color: #f2fbfc; line-height: 1.1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xr-cta-text small { color: rgba(220, 236, 239, 0.75); font-size: 13px; }
.xr-cta .tag.ai { background: rgba(240, 124, 158, 0.18); color: #ffb3c8; }
.rail-new { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; color: #2a0612; background: linear-gradient(90deg, #5edfd0, #f7a3be); }

@media (max-width: 1180px) { .xr { grid-template-columns: minmax(0, 1fr); } }
@media (max-height: 860px) {
  .xr.story .xr-find:nth-child(n + 2) { display: none; }
  .xr.story .xr-stage { gap: 9px; padding-top: 16px; }
  .xr.story .xr-film-bottom span:not(.xr-brand) { display: none; }
}
@media (max-width: 640px) {
  .xr.story { gap: 8px; }
  .xr.story .xr-stage { height: min(calc(100vh - 64px), calc((100vw - 24px) * 16 / 9)); padding: 14px 14px 10px; border-radius: 24px; }
  .xr.story .xr-film-top { letter-spacing: 0.1em; gap: 8px; }
  .xr.story .xr-pan, .xr.story .xr-legend, .xr-tip { display: none; }
  .xr.story .xr-hook { font-size: clamp(24px, 3.8vh, 34px); margin-top: 4px; }
  .xr.story .xr-cur { font-size: clamp(44px, 7.4vh, 70px); }
  .xr.story .xr-find span { display: none; }
  .xr-story-ctl .btn { height: 34px; padding: 0 12px; }
  .xr .xr-end span { font-size: 9.5px; letter-spacing: 0.05em; padding: 7px 12px; line-height: 1.5; max-width: 100%; }
}
@media (hover: none) { [data-act="xr-fullscreen"] { display: none; } }
@media (max-width: 640px) {
  .xr-cta { flex-wrap: wrap; }
  .xr-cta-film { width: 100%; }
  .xr-cta-film i { animation-name: ctaBeamWide; }
  .xr-cta .btn { width: 100%; }
  .xr-canvas-wrap { height: 260px; }
  .xr-find span { display: none; }
  .xr-find { grid-template-columns: 8px minmax(0, 1fr) auto; }
}
@keyframes ctaBeamWide { 0% { left: 0; } 70%, 100% { left: 100%; } }

/* ---- Practice X-Ray v2 ---- */
.odo { display: inline-flex; align-items: flex-start; line-height: 1.1; height: 1.1em; overflow: hidden; }
.odo-d { display: inline-block; height: 1.1em; overflow: hidden; }
.odo-s { display: flex; flex-direction: column; transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1); }
.odo-s span, .odo-c { display: block; height: 1.1em; line-height: 1.1; text-align: center; }
.odo-d { margin: 0 -0.035em; }
.xr-cur.odo { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #ffe6ad; text-shadow: 0 0 26px rgba(255, 205, 107, 0.35); height: 1.1em; line-height: 1.1; }
.xr-cur.punch { animation: punch 0.7s cubic-bezier(0.34, 1.6, 0.5, 1); transform-origin: left center; }
@keyframes punch { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
.xr-rec { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; color: rgba(220, 255, 236, 0.85); }
.xr-rec[hidden] { display: none !important; }
.xr-rec.in { animation: findIn 0.6s var(--ease); }
.xr-rec > i { width: 9px; height: 9px; border-radius: 50%; background: #78ffb0; box-shadow: 0 0 12px #78ffb0; align-self: center; }
.xr-rec b.odo { font-family: var(--font-display); font-weight: 400; font-size: 30px; color: #8dffbe; text-shadow: 0 0 20px rgba(120, 255, 176, 0.4); }
.xr-status.intro { color: #9fd8ff; }
.xr-status.sort { color: #ffcd6b; }
.xr-status.rec { color: #ff9db5; }
.xr-status.rec i, .xr-status.sort i, .xr-status.intro i { animation: blink 0.8s ease-in-out infinite; }
.xr-status.end, .xr-status.found { color: #5fe3d2; }
.xr-status.end i, .xr-status.found i { animation: none; box-shadow: 0 0 8px currentColor; }
.xr-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px;
  background: radial-gradient(60% 55% at 50% 50%, rgba(3, 14, 17, 0.88), rgba(3, 14, 17, 0.55) 70%, transparent);
  opacity: 0; transform: scale(0.96); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); pointer-events: none; }
.xr-end.show { opacity: 1; transform: none; }
.xr-end b { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 3.4vw, 44px); line-height: 1.05; color: #f4fbfc; text-wrap: balance; }
.xr-end span { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #ffe2a3; padding: 8px 14px; border-radius: 99px; border: 1px solid rgba(255, 226, 163, 0.35); background: rgba(255, 205, 107, 0.08); }
.xr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 2px; }
.xr-actions .seg button[disabled] { opacity: 0.45; }
.xr-tops { display: flex; flex-direction: column; gap: 2px; }
.xr-top { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 10px; text-align: left; width: 100%; }
.xr-top:hover { background: var(--surface-3); }
.xr-top span { min-width: 0; }
.xr-top b { display: block; font-size: 13px; }
.xr-top small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr-top em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.xr-canvas-wrap canvas { cursor: crosshair; }
.xr.story.playing .xr-story-ctl { opacity: 0; pointer-events: none; }
.xr.story.playing, .xr.story.playing canvas { cursor: none; }
.xr-story-ctl { transition: opacity 0.5s ease; }
.xr.story .xr-end b { font-size: clamp(26px, 4.2vh, 40px); }
.xr.story .xr-rec { justify-content: center; text-align: center; }
.xr.story .xr-rec b.odo { font-size: clamp(26px, 4vh, 36px); }
body.xr-story-on .toasts, body.xr-story-on .tip { display: none !important; }
.xr-legend span:last-child i { box-shadow: 0 0 10px #78ffb0; }


/* ---- Practice X-Ray: verification and scan report ---- */
.xr-verified { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 99px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; color: #bff6e6; background: rgba(95, 227, 210, 0.1); border: 1px solid rgba(95, 227, 210, 0.3); }
.xr-verified[hidden] { display: none !important; }
.xr-verified.in { animation: findIn 0.5s var(--ease); }
.xr-verified i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; background: #5fe3d2; color: #032220; font-weight: 700; }
.xr-verified.bad { color: #ffd0c8; background: rgba(255, 93, 82, 0.12); border-color: rgba(255, 93, 82, 0.4); }
.xr-verified.bad i { background: #ff5d52; color: #fff; }
.xr.story .xr-verified { align-self: center; font-size: 9.5px; }
.xr-status.verify { color: #b2d6ff; }
.xr-status.verify i { animation: blink 0.7s ease-in-out infinite; }
.xr-status.warn { color: #ff8a7d; }
.xr-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; margin-bottom: 12px; }
.xr-checks div { display: flex; gap: 9px; align-items: center; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--good) 8%, transparent); }
.xr-checks div.bad { background: color-mix(in srgb, var(--crit) 10%, transparent); }
.xr-checks i { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 11px; color: #fff; background: var(--good); }
.xr-checks .bad i { background: var(--crit); }
.xr-eq { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); margin: 4px 0 12px; line-height: 1.6; }
.xr-rtable td { white-space: normal; vertical-align: top; }
.xr-how { font-size: 12px; color: var(--ink-2); line-height: 1.5; min-width: 220px; }
.xr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px; }
.xr-sum td { border-top: 2px solid var(--line-2); }
.xr-excl { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.xr-excl b { color: var(--ink); }
/* ==========================================================================
   FINAL POLISH — Gainn type system everywhere.
   Headings: Instrument Serif 400. UI: Instrument Sans, normal width.
   Labels: IBM Plex Mono 400/500, uppercase, wide tracking.
   ========================================================================== */
.kpi-value, .stat b, .seg-card b, .col-head .sum, .hello-goal .meta b, .ring-label b, .xr-row b { font-stretch: 100%; }
.panel-head h2, .panel-head h3, .brief-head h2, .ib-thread-head b, .cp-head b, .modal-head h2 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -0.012em;
}
.panel-head h2, .panel-head h3, .brief-head h2 { font-size: 21px; line-height: 1.15; }
.ib-thread-head b { font-size: 19px; }
.kpi-value, .stat b, .seg-card b, .pipe-sum .stat b, .fact b, .col-head .sum, .hello-goal .meta b {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em;
}
.kpi-value { font-size: 34px; line-height: 1; }
.stat b, .seg-card b { font-size: 30px; }
.col-head .sum { font-size: 24px; }
.fact b { font-size: 18px; }
.hello-goal .meta b { font-size: 20px; }
.eyebrow, .rail-group, .sub-h, .table th, .pop h4, .palette-sec, .ctx-card h4, .fsplit .lbl, .ai-card .ai-label, .xr-total span { letter-spacing: 0.2em; font-weight: 500; }
.kpi-label, .stat small, .seg-card small { letter-spacing: 0.14em; font-weight: 400; }
.btn, .chip, .seg button, .pill, .tag { font-weight: 500; }
.btn-primary { font-weight: 600; }
.tb-title h1 { font-size: 32px; letter-spacing: -0.02em; }
.hello h2 { letter-spacing: -0.025em; }
body { letter-spacing: -0.003em; }

/* ---- Practice X-Ray: final design pass ---- */
.xr-stage { padding: 18px 20px 16px; gap: 12px; background: radial-gradient(120% 80% at 50% 42%, #10313a 0%, #071519 52%, #020708 100%); }
.xr-film-top { padding-bottom: 10px; border-bottom: 1px solid rgba(220, 236, 239, 0.08); }
.xr-meter { position: relative; height: 2px; margin-top: -11px; border-radius: 2px; background: rgba(220, 236, 239, 0.06); overflow: hidden; }
.xr-meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #5fe3d2, #b2d6ff); box-shadow: 0 0 10px #5fe3d2; transition: width 0.25s linear; }
.xr-stage[data-phase="rec"] .xr-meter i { background: linear-gradient(90deg, #ff9db5, #78ffb0); }
.xr-canvas-wrap::before, .xr-canvas-wrap::after { content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none; border: 1.5px solid rgba(220, 240, 244, 0.45); z-index: 2; }
.xr-canvas-wrap::before { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.xr-canvas-wrap::after { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.xr-corner { position: absolute; width: 18px; height: 18px; pointer-events: none; border: 1.5px solid rgba(220, 240, 244, 0.45); z-index: 2; }
.xr-corner.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.xr-corner.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.xr-count { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 4px; }
.xr-count::before { content: "Total found"; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(220, 236, 239, 0.5); }
.xr-cur.odo { font-size: clamp(52px, 6.4vw, 84px); letter-spacing: -0.015em; }
.xr-cap { font-size: 14.5px; color: rgba(220, 236, 239, 0.72); }
.xr-legend { gap: 6px; }
.xr-legend span { padding: 4px 10px 4px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); font-size: 11px; }
.xr-film-bottom { padding-top: 10px; border-top: 1px solid rgba(220, 236, 239, 0.08); }
.xr-find { border-radius: 12px; padding: 8px 12px; }
.xr-find b { font-family: var(--font-display); font-weight: 400; font-size: 15px; letter-spacing: 0; }
.xr-side .panel-head h3 { font-size: 23px; }
.xr-row { padding: 10px; }
.xr-row b { font-family: var(--font-display); font-weight: 400; font-size: 18px; }
.xr-total b { font-size: 38px; letter-spacing: -0.01em; }
.xr.story .xr-count { align-items: center; }
.xr.story .xr-count::before { align-self: center; }
.xr.story .xr-legend span { padding: 3px 8px; font-size: 10px; }
.xr.story .xr-cur.odo { font-size: clamp(50px, 8.2vh, 88px); }
@media (max-width: 640px) { .xr.story .xr-cur.odo { font-size: clamp(42px, 7vh, 68px); } .xr.story .xr-count::before { display: none; } .kpi-value { font-size: 26px; } .stat b, .seg-card b { font-size: 24px; } }

/* ============ RESPONSIVE ============ */
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .ib-ctx { display: none; }
}
@media (max-width: 1180px) {
  .g-12 > [class*="span-"] { grid-column: span 12; }
  .g-12 > .span-6.keep, .g-12 > .span-4.keep { grid-column: span 6; }
  .sched-wrap { grid-template-columns: minmax(0, 1fr); }
  .rx, .auto-layout { grid-template-columns: minmax(0, 1fr); }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-search { width: 44px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd { display: none; }
}
@media (max-width: 960px) {
  :root { --rail-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw);
    transform: translateX(-102%); transition: transform 0.35s var(--ease);
  }
  .rail.open { transform: none; box-shadow: var(--shadow-lg); }
  .icon-btn.rail-close { display: inline-grid; }
  .rail-scrim { position: fixed; inset: 0; background: rgba(4, 14, 16, 0.5); z-index: 25; }
  .rail.open + .rail-scrim { display: block; }
  .icon-btn.burger { display: inline-grid; }
  .brief-list { grid-template-columns: minmax(0, 1fr); }
  .stat-strip, .seg-cards, .pipe-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hello { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 140px); }
  .inbox .ib-thread { display: none; }
  .inbox.reading .ib-list { display: none; }
  .inbox.reading .ib-thread { display: flex; }
  .icon-btn.ib-back { display: inline-grid; }
  .auto-list { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 60px; }
  .topbar { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); gap: 6px; }
  .tb-title h1 { font-size: 23px; }
  .tb-title p { display: none; }
  .hide-sm { display: none; }
  .tb-actions .btn-ai, .tb-actions .btn-primary { width: 38px; padding: 0; }
  .live-pill .lp-text { display: none; }
  .live-pill { padding: 0 11px; }
  .tb-actions { gap: 2px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .spark { display: none; }
  .kpi-value { font-size: 22px; }
  .lanes { grid-template-columns: minmax(0, 1fr); }
  .providers { grid-template-columns: minmax(0, 1fr); }
  .g-12 > .span-6.keep, .g-12 > .span-4.keep { grid-column: span 12; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-total { grid-template-columns: minmax(0, 1fr); }
  .drawer-head h2 { font-size: 25px; }
  .bubble { max-width: 88%; }
  .rx .phone-stage { min-height: 460px; padding: 16px; }
  .ps-line { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .funnel-row { grid-template-columns: 92px minmax(0, 1fr) 46px; }
  .hbar { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) auto; }
  .countdown .big { font-size: 38px; }
  .modal-scrim { padding: 10px; align-items: end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 20px 20px 16px 16px; }
}
@media (max-width: 420px) {
  .stat b, .seg-card b { font-size: 19px; }
  .tb-actions #bellBtn { display: none; }
}

@media (max-width: 960px) {
  .rail { position: fixed; inset: 10px auto 10px 10px; margin: 0; width: min(290px, 84vw); transform: translateX(calc(-100% - 24px)); }
  .rail.open { transform: none; }
  .topbar { margin: calc(8px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); }
}
@media (max-width: 640px) {
  .topbar { padding-left: 10px; padding-right: 8px; border-radius: 18px; }
  .drawer, .copilot { top: 0; right: 0; bottom: 0; border-radius: 0; border: 0; }
  .aurora i { opacity: calc(var(--aurora-op) * 0.85); }
}
@media (hover: none) { .kpi:hover { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .chart .draw { stroke-dashoffset: 0; }
}
@media (forced-colors: active) {
  .pill::before, .appt .a-dot { forced-color-adjust: none; }
}
