/* WA BOOKING design system (maerev) — tokens, shell, components, motion. */

:root {
  --font: 'Satoshi', 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Josefin Sans', 'Satoshi', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --bg: #f5f6fa;
  --bg-grad: linear-gradient(transparent, transparent);
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f2f6;
  --line: #e6e8ec;
  --line-strong: #d4d7de;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;

  --brand: #4433E0;
  --brand-2: #45C4E8;
  --brand-soft: #eeecfd;
  --brand-ink: #3626c4;
  --brand-grad: linear-gradient(135deg, #45C4E8, #4433E0);
  --side: #0d1a1c;
  --wa: #15803d;
  --wa-soft: #dcfce7;
  --ok: #059669;   --ok-soft: #e6f6f0;
  --warn: #d97706; --warn-soft: #fdf3e2;
  --bad: #d62839;  --bad-soft: #fde9ee;
  --info: #0284c7; --info-soft: #e5f3fb;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(18, 21, 42, .04), 0 1px 1px rgba(18, 21, 42, .03);
  --shadow-2: 0 10px 30px -12px rgba(30, 27, 75, .18), 0 2px 6px rgba(18, 21, 42, .05);
  --shadow-3: 0 30px 80px -20px rgba(30, 27, 75, .35);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
  --pad: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

[data-accent='teal']  { --brand: #0d9488; --brand-2: #0891b2; --brand-soft: #e6f6f5; --brand-ink: #115e59; }
[data-accent='rose']  { --brand: #e11d48; --brand-2: #db2777; --brand-soft: #fdecf0; --brand-ink: #9f1239; }
[data-accent='amber'] { --brand: #d97706; --brand-2: #ea580c; --brand-soft: #fdf3e2; --brand-ink: #92400e; }
[data-density='compact'] { --pad: 14px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --bg: #111111; --bg-grad: linear-gradient(transparent, transparent); --brand: #6b5cff; --side: #0a1214; --surface: #1B1B1B; --surface-2: #202020; --surface-3: #262626; --line: #303030; --line-strong: #3a3a3a; --ink: #f3f4f6; --ink-2: rgba(255,255,255,.78); --muted: rgba(255,255,255,.55); --faint: rgba(255,255,255,.38); --brand-soft: color-mix(in srgb, var(--brand) 20%, #1B1B1B); --brand-ink: #c9c3ff; --wa-soft: #10291c; --ok-soft: #0f2a22; --warn-soft: #2d230f; --bad-soft: #2e1220; --info-soft: #0f2333; --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .6); color-scheme: dark; }
}
:root[data-theme='dark'] { --bg: #111111; --bg-grad: linear-gradient(transparent, transparent); --brand: #6b5cff; --side: #0a1214; --surface: #1B1B1B; --surface-2: #202020; --surface-3: #262626; --line: #303030; --line-strong: #3a3a3a; --ink: #f3f4f6; --ink-2: rgba(255,255,255,.78); --muted: rgba(255,255,255,.55); --faint: rgba(255,255,255,.38); --brand-soft: color-mix(in srgb, var(--brand) 20%, #1B1B1B); --brand-ink: #c9c3ff; --wa-soft: #10291c; --ok-soft: #0f2a22; --warn-soft: #2d230f; --bad-soft: #2e1220; --info-soft: #0f2333; --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .6); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 500 14px/1.5 var(--font); color: var(--ink); background: var(--bg-grad), var(--bg); background-attachment: fixed; -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.page-head h1, .section-title h2, .login-card h1, .modal-head h3, .brand b, .login-brand b { font-family: var(--display); font-weight: 600 !important; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Boot ────────────────────────────────────────────── */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-mark { width: 54px; height: 54px; border-radius: 16px; background: url(/img/logo.svg) center/cover; animation: breathe 1.2s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(.88); opacity: .6; } }

/* ── Shell ───────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.app.is-login { display: block; }
.side-scrim { display: none; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; z-index: 20;
  --ink: #fff; --ink-2: rgba(255,255,255,.72); --muted: rgba(255,255,255,.5); --faint: rgba(255,255,255,.38);
  --surface: #13262a; --surface-2: rgba(255,255,255,.06); --surface-3: rgba(255,255,255,.08); --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --brand-soft: rgba(255,255,255,.08); --brand-ink: #fff; --brand: #45C4E8; --wa: #25D366; --wa-soft: rgba(37,211,102,.12); --bad: #ff6b78; --bad-soft: rgba(214,40,57,.18);
  background: var(--side); color: var(--ink); border-right: 1px solid rgba(0,0,0,.2); }
.sidebar .nav-pill::before { background: var(--brand-grad); }
.sidebar .brand small { color: rgba(255,255,255,.5); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo { width: 36px; height: 36px; border-radius: 11px; background: url(/img/logo.svg) center/cover; box-shadow: 0 6px 16px -6px var(--brand); transition: transform .5s var(--spring); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand b { font-size: 19px; letter-spacing: .01em; line-height: 1.1; white-space: nowrap; }
.brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: -2px; }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 12px 6px; }
.nav a { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; color: var(--ink-2); font-weight: 600; transition: color .2s, background .2s; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { color: var(--brand-ink); }
.nav a .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 800; display: grid; place-items: center; background: var(--wa); color: #fff; }
.nav-pill { position: absolute; left: 0; right: 0; height: 40px; border-radius: 11px; background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); transition: transform .45s var(--spring), height .3s, opacity .2s; z-index: 0; pointer-events: none; }
.nav-pill::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.wa-status { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--wa-soft); color: var(--wa); font-weight: 700; font-size: 12.5px; }
.wa-status.off { background: var(--bad-soft); color: var(--bad); }
.wa-status small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.me:hover { background: var(--surface-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 14px max(28px, calc((100% - 1600px) / 2 + 28px)); background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.search-btn { flex-shrink: 0; display: flex; align-items: center; gap: 10px; width: min(420px, 100%); height: 42px; padding: 0 12px 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.search-btn:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.search-btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn kbd, kbd { margin-left: auto; font: 600 11px var(--font); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
.clock { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.clock small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wa); box-shadow: 0 0 0 0 color-mix(in srgb, var(--wa) 60%, transparent); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.icon-btn { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink-2); transition: transform .15s, background .2s, border-color .2s; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.menu-btn { display: none; }
.view { padding: 8px 28px 48px; max-width: 1600px; width: 100%; margin-inline: auto; }

/* ── Page header ─────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 0 20px; }
.eyebrow { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards / stats ───────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: var(--pad); min-width: 0; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; font-weight: 800; white-space: nowrap; }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.card-head .end { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card.flush { padding: 0; overflow: hidden; }
.card.lift { transition: transform .25s var(--ease), box-shadow .25s; }
.card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; padding: 14px 16px; }
.stat .label { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 700; font-size: 13px; }
.stat .ico { flex-shrink: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.stat .ico.wa { background: var(--wa-soft); color: var(--wa); } .stat .ico.warn { background: var(--warn-soft); color: var(--warn); } .stat .ico.ok { background: var(--ok-soft); color: var(--ok); } .stat .ico.bad { background: var(--bad-soft); color: var(--bad); }
.stat .value { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.stat .foot { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat .spark { position: absolute; right: 14px; bottom: 12px; opacity: .9; }
.trend-up { color: var(--ok); } .trend-down { color: var(--bad); }

.grid { display: grid; gap: 16px; }
.g-today { grid-template-columns: repeat(12, 1fr); }
.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-12 { grid-column: span 12; } .span-3 { grid-column: span 3; }

/* ── Buttons, inputs ─────────────────────────────────── */
.btn { --b: var(--surface); position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--b); font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, opacity .2s; }
.btn:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px var(--brand); }
.btn.primary:hover { box-shadow: 0 12px 24px -8px var(--brand); filter: brightness(1.05); }
.btn.wa { background: var(--wa); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px var(--wa); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); box-shadow: none; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn .badge-n { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: rgba(255, 255, 255, .25); font-size: 11.5px; display: grid; place-items: center; }
.btn.loading { color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.primary.loading::after, .btn.wa.loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; animation: ripple .6s var(--ease); pointer-events: none; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input.with-icon { padding-left: 38px; }
.input-wrap { position: relative; } .input-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .form-grid .full { grid-column: 1 / -1; }
.saved-flash { animation: savedFlash 1.2s var(--ease); }
@keyframes savedFlash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 40%, transparent); border-color: var(--ok); } 100% { box-shadow: none; } }

.switch { position: relative; display: inline-block; vertical-align: middle; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .25s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .35s var(--spring); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); position: relative; }
.seg button { position: relative; z-index: 1; border: 0; background: none; height: 32px; padding: 0 13px; border-radius: 8px; font-weight: 700; font-size: 12.5px; color: var(--muted); cursor: pointer; transition: color .2s; display: flex; align-items: center; gap: 6px; }
.seg button.on { color: var(--ink); }
.seg .seg-pill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-1); transition: left .35s var(--spring), width .35s var(--spring); }
.seg .n { font-size: 11px; color: var(--faint); }

/* ── Chips, badges, avatars ──────────────────────────── */
.chip { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: all .2s; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .n { color: var(--faint); font-weight: 700; } .chip.on .n { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); } .badge.brand { background: var(--brand-soft); color: var(--brand-ink); } .badge.wa { background: var(--wa-soft); color: var(--wa); }
.tag-sky { background: #e0f2fe; color: #0369a1; } .tag-violet { background: #ede9fe; color: #6d28d9; } .tag-pink { background: #fce7f3; color: #be185d; } .tag-amber { background: #fef3c7; color: #b45309; }
.tag-slate { background: #e2e8f0; color: #334155; } .tag-rose { background: #ffe4e6; color: #be123c; } .tag-orange { background: #ffedd5; color: #c2410c; } .tag-emerald { background: #d1fae5; color: #047857; } .tag-indigo { background: #e0e7ff; color: #4338ca; }
[data-theme='dark'] [class*='tag-'] { filter: saturate(.9) brightness(.92); }
.avatar { --c: var(--brand); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; font-size: 12.5px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; } .avatar.lg { width: 56px; height: 56px; font-size: 18px; } .avatar.xl { width: 72px; height: 72px; font-size: 22px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.dot-sep::before { content: '·'; margin: 0 6px; color: var(--faint); }

/* ── Lists ───────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; transition: background .2s; }
.item:hover { background: var(--surface-2); }
.item .t { font-weight: 700; } .item .s { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.item .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.item + .item { border-top: 1px dashed var(--line); border-radius: 0; }
.item.clickable { cursor: pointer; }
.more-link { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--brand); padding: 6px 8px; border-radius: 8px; }
.more-link:hover { background: var(--brand-soft); }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 32px 16px; color: var(--muted); }
.empty .em-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--faint); }

/* ── Today: patient flow ─────────────────────────────── */
.flow { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; scrollbar-width: thin; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lane-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.lane-head .n { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
.lane-dot { width: 8px; height: 8px; border-radius: 50%; }
.ticket { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: transform .3s var(--ease), box-shadow .2s, opacity .3s; }
.ticket:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.ticket > .row.between { flex-wrap: wrap; gap: 6px; }
.ticket .btn { flex-shrink: 0; }
.ticket .t { font-weight: 700; font-size: 13px; } .ticket .s { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ticket.leaving { opacity: 0; transform: translateX(30px) scale(.96); }
.wait-chip { white-space: nowrap; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }
.wait-chip.mid { background: var(--warn-soft); color: var(--warn); } .wait-chip.long { background: var(--bad-soft); color: var(--bad); }

/* clinician mini-timeline */
.tl { display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 130px 1fr 60px; align-items: center; gap: 12px; }
.tl-track { position: relative; height: 26px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.tl-block { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; background: color-mix(in srgb, var(--c) 70%, var(--surface)); transform-origin: left; animation: growX .8s var(--ease) both; }
.tl-block.done { opacity: .35; }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bad); border-radius: 2px; z-index: 2; }
.tl-now::before { content: ''; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.tl-hours { display: grid; grid-template-columns: 130px 1fr 60px; gap: 12px; font-size: 11px; color: var(--faint); font-weight: 700; }
.tl-hours div:nth-child(2) { display: flex; justify-content: space-between; }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes growY { from { transform: scaleY(0); } }

.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transform-origin: left; animation: growX 1s var(--ease) both; transition: width .6s var(--ease); }
.bar.wa > i { background: var(--wa); } .bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); }

.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.funnel > div { min-width: 0; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.funnel b { font-size: 22px; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.funnel span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); font-weight: 700; }

/* charts */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--faint); font: 600 10.5px var(--font); }
.chart .b { transform-origin: bottom; transform-box: fill-box; animation: growY .9s var(--ease) both; transition: opacity .2s; }
.chart .b:hover { opacity: .75; }
.chart .ln { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.legend { display: flex; gap: 14px; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 90; pointer-events: none; background: var(--ink); color: var(--surface); padding: 7px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow-2); transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.tip.show { opacity: 1; }

/* activity */
.feed { position: relative; display: flex; flex-direction: column; gap: 14px; padding-left: 18px; }
.feed::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.feed-item { position: relative; font-size: 13px; font-weight: 600; }
.feed-item::before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.feed-item small { display: block; color: var(--muted); font-size: 11.5px; }

/* ── Inbox ───────────────────────────────────────────── */
.inbox { display: grid; grid-template-columns: 360px 1fr 300px; height: calc(100vh - 184px); height: calc(100dvh - 184px); min-height: 480px; }
@media (min-width: 1281px) { .inbox:not(.has-thread) { grid-template-columns: 360px 1fr; } .inbox:not(.has-thread) .side-info { display: none; } }
.inbox > section { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.inbox-list { border-right: 1px solid var(--line); }
.inbox-tools { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.tabs-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-right: 24px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.convs { overflow-y: auto; flex: 1; padding: 6px; }
.conv { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px; border-radius: 12px; cursor: pointer; position: relative; transition: background .2s; animation: fadeUp .35s var(--ease) both; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-soft); }
.conv .name { font-weight: 800; font-size: 13.5px; }
.conv .preview { font-size: 12.5px; color: var(--muted); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.conv.unread .preview { color: var(--ink-2); }
.conv .time { font-size: 11.5px; color: var(--faint); font-weight: 700; text-align: right; }
.conv .unread-n { margin-top: 6px; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--wa); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; animation: pop .4s var(--spring); }
.conv .meta { grid-column: 2 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.conv.flash { animation: flashBg 1.4s var(--ease); }
@keyframes flashBg { 0% { background: color-mix(in srgb, var(--wa) 22%, transparent); } }
@keyframes pop { 0% { transform: scale(0); } }

.thread { background: var(--surface-2); min-width: 0; }
.thread-who { flex: 1; min-width: 0; }
.thread-actions { display: flex; gap: 6px; flex-shrink: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.messages { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 800; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; margin: 10px 0; }
.bubble { max-width: min(520px, 78%); padding: 9px 12px 7px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 13.5px; font-weight: 500; line-height: 1.45; position: relative; animation: bubbleIn .35s var(--spring) both; overflow-wrap: anywhere; }
.bubble .txt { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; border-bottom-right-radius: 4px; background: #dcf7e3; color: #10331c; }
[data-theme='dark'] .bubble.out { background: #0f3b26; color: #d6f5e1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .bubble.out { background: #0f3b26; color: #d6f5e1; } }
.bubble.auto { background: var(--brand-soft); color: var(--brand-ink); }
.bubble.note { align-self: center; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 12.5px; max-width: 70%; border-radius: 10px; }
.bubble .tpl { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .6; margin-bottom: 3px; }
.bubble .foot { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 10.5px; opacity: .65; margin-top: 2px; font-weight: 700; }
.bubble .btns { display: flex; gap: 6px; margin-top: 8px; }
.bubble .btns span { flex: 1; text-align: center; padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, .55); font-weight: 700; font-size: 12.5px; color: var(--info); }
.ticks { display: inline-flex; color: currentColor; transition: color .3s; } .ticks.read { color: #0ea5e9; opacity: 1; } .ticks.failed { color: var(--bad); }
.ticks svg { animation: pop .3s var(--spring); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); animation: bubbleIn .3s var(--spring); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.composer { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 42px; max-height: 160px; resize: none; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); outline: none; line-height: 1.4; }
.composer textarea:focus { border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }
.composer.note-mode textarea { background: var(--warn-soft); }
.window-warn { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.tpl-pop { position: absolute; bottom: calc(100% + 8px); left: 14px; right: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 6px; z-index: 5; animation: popIn .2s var(--ease); max-height: 300px; overflow: auto; }
.tpl-pop button { width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 10px; cursor: pointer; }
.tpl-pop button:hover, .tpl-pop button.on { background: var(--surface-2); }
.side-info { border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.inbox-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; }
.inbox-empty .art { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 36px; display: grid; place-items: center; background: var(--wa-soft); color: var(--wa); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-2deg); } }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 800; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; cursor: pointer; animation: fadeUp .35s var(--ease) both; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--brand-soft); }
.table input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.table .row-actions { opacity: 0; transition: opacity .15s; display: flex; gap: 4px; justify-content: flex-end; }
.table tr:hover .row-actions { opacity: 1; }
.bulkbar { position: sticky; bottom: 18px; margin: 12px auto 0; width: max-content; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-3); animation: slideUp .35s var(--spring); z-index: 5; }
.bulkbar .btn { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 25%, transparent); }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }

/* ── Schedule ────────────────────────────────────────── */
.sched-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: nowrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.who-chips { display: flex; gap: 6px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; padding-right: 24px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.who-chips > * { flex-shrink: 0; }
.sched-bar > :not(.who-chips):not(.grow) { flex-shrink: 0; }
.sched-bar h3 { font-size: 16px; font-weight: 800; }
.sched { position: relative; overflow: auto; max-height: calc(100vh - 300px); min-height: 480px; }
.sched-grid { display: grid; position: relative; min-width: 860px; }
.sched-col-head { position: sticky; top: 0; z-index: 4; background: var(--surface); padding: 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.sched-col-head .bar { width: 60px; height: 5px; }
.sched-corner { position: sticky; top: 0; left: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.sched-times { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.now-tag { position: absolute; right: 4px; z-index: 2; transform: translateY(-50%); font-size: 10.5px; font-weight: 800; color: #fff; background: var(--bad); padding: 1px 6px; border-radius: 6px; pointer-events: none; }
.sched-times div { height: var(--hour); font-size: 11px; color: var(--faint); font-weight: 700; padding: 0 8px; text-align: right; transform: translateY(-7px); }
.sched-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line) 50%, transparent) 1px, transparent 1px); background-size: 100% var(--hour), 100% calc(var(--hour) / 2); }
.sched-col.drop { background-color: color-mix(in srgb, var(--brand) 5%, transparent); }
.lunch { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(-45deg, var(--surface-3), var(--surface-3) 6px, transparent 6px, transparent 12px); display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; color: var(--faint); }
.appt { --c: var(--brand); position: absolute; left: 4px; right: 4px; border-radius: 9px; padding: 5px 8px; overflow: hidden; cursor: grab; font-size: 12px; line-height: 1.3; background: color-mix(in srgb, var(--c) 13%, var(--surface)); border-left: 3px solid var(--c); transition: transform .2s var(--ease), box-shadow .2s, opacity .2s; animation: fadeIn .4s var(--ease) both; }
.appt:hover { z-index: 3; box-shadow: var(--shadow-2); transform: scale(1.02); }
.appt b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { color: var(--muted); font-weight: 600; font-size: 11px; white-space: nowrap; }
.appt.short { padding: 3px 8px; display: flex; gap: 6px; align-items: center; }
.appt.short span { overflow: hidden; text-overflow: ellipsis; }
.appt.seen { opacity: .55; } .appt.cancelled { opacity: .45; text-decoration: line-through; background: var(--surface-3); border-left-color: var(--faint); }
.appt.no_show { background: var(--bad-soft); border-left-color: var(--bad); }
.appt.in_consult { box-shadow: 0 0 0 2px var(--c); }
.appt.waiting::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: ping 1.6s infinite; box-shadow: 0 0 0 0 var(--warn); }
.appt.dragging { opacity: .4; }
.appt.ghost-new { border: 2px dashed var(--brand); background: var(--brand-soft); cursor: pointer; display: grid; place-items: center; color: var(--brand); font-weight: 800; animation: none; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.week { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); min-width: 900px; }
.week-day { border-left: 1px solid var(--line); min-height: 400px; }
.week-day:first-child { border-left: 0; }
.week-day header { position: sticky; top: 0; background: var(--surface); padding: 12px; border-bottom: 1px solid var(--line); z-index: 2; }
.week-day header.today b { color: var(--brand); }
.week-day .slots { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.week-pill { --c: var(--brand); display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); font-size: 12px; cursor: pointer; animation: fadeUp .3s var(--ease) both; }
.week-pill b { font-variant-numeric: tabular-nums; color: var(--c); }

/* ── Campaigns ───────────────────────────────────────── */
.camp { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 2fr) 230px; gap: 18px; align-items: center; }
.camp > :last-child { justify-content: flex-end; }
.tile .row.between { flex-wrap: nowrap; min-width: 0; } .tile .row.between > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tile .row.between > .badge { flex-shrink: 0; }
.camp + .camp { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.camp-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.camp-bars div span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.camp-bars b { font-size: 13px; }
.phone { width: 300px; margin: 0 auto; border-radius: 34px; padding: 12px; background: #111827; box-shadow: var(--shadow-3); }
.phone-screen { border-radius: 24px; overflow: hidden; background: #e9e1d6; min-height: 380px; display: flex; flex-direction: column; }
.phone-top { background: #0b6b55; color: #fff; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 13px; }
.phone-body { padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1;
  background-image: radial-gradient(rgba(0, 0, 0, .05) 1px, transparent 1px); background-size: 14px 14px; }
.phone .bubble { max-width: 92%; color: #111; background: #fff; }
.phone .bubble.out { background: #d9fdd3; }

/* ── Settings ────────────────────────────────────────── */
.settings { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.settings-nav { position: sticky; top: 90px; padding: 10px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 700; color: var(--ink-2); transition: background .2s, color .2s; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.settings-nav a .ok-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--wa); }
.settings-nav .note { margin-top: 10px; padding: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 8px; }
.section-title { margin-bottom: 14px; } .section-title h2 { font-size: 22px; font-weight: 800; } .section-title p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row .t { font-weight: 800; } .setting-row .s { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.tile > span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.tile b { font-size: 16px; font-weight: 800; }
.copy-field { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-width: 0; }
.copy-field > :first-child, .tile b { min-width: 0; overflow-wrap: anywhere; }
.tile { min-width: 0; }
.quality { display: inline-flex; gap: 3px; margin-right: 8px; } .quality i { width: 14px; height: 6px; border-radius: 3px; background: var(--wa); } .quality i.off { background: var(--line-strong); }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { position: relative; padding: 16px; border-radius: 12px; border: 1px dashed var(--line-strong); }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 10px; }
.code { max-width: 100%; position: relative; border-radius: 14px; background: #0f1222; color: #d6daf5; font: 500 12.5px/1.6 var(--mono); padding: 16px 18px; overflow: auto; }
.code .k { color: #c4a7ff; } .code .s { color: #8ee6b4; } .code .c { color: #6c7299; } .code .n { color: #ffcc80; }
.code-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.hours { display: flex; flex-direction: column; gap: 8px; }
.hours .h-row { display: grid; grid-template-columns: 110px auto 1fr 1fr; gap: 10px; align-items: center; }
.hours .h-row.closed .input { opacity: .4; pointer-events: none; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; transition: transform .2s var(--spring); }
.swatch:hover { transform: scale(1.08); } .swatch.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface) inset; }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer; background: var(--surface); text-align: left; transition: border-color .2s, transform .2s; }
.theme-card:hover { transform: translateY(-2px); } .theme-card.on { border-color: var(--brand); }
.theme-card .pv { height: 70px; border-radius: 9px; margin-bottom: 8px; display: grid; grid-template-columns: 26% 1fr; overflow: hidden; border: 1px solid var(--line); }
.auto-reply { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, opacity .2s; animation: fadeUp .3s var(--ease) both; }
.auto-reply.off { opacity: .6; }
.ar-head { flex-wrap: wrap; } .ar-head > [data-k='name'] { flex: 1 1 180px; width: auto; min-width: 0; } .ar-head > select { max-width: 100%; }
.auto-reply .kw { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Overlays ────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 30, .38); backdrop-filter: blur(3px); animation: fadeIn .2s var(--ease); }
.scrim.out { animation: fadeOut .2s var(--ease) forwards; }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3); animation: modalIn .35s var(--spring); }
.modal.wide { width: min(880px, calc(100vw - 32px)); }
.modal.out { animation: modalOut .18s var(--ease) forwards; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; } .modal-head h3 { font-size: 18px; font-weight: 800; } .modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.modal-body { padding: 14px 20px; } .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
@keyframes modalOut { to { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
.drawer { position: fixed; z-index: 61; top: 10px; right: 10px; bottom: 10px; width: min(480px, calc(100vw - 20px)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; animation: drawerIn .45s var(--spring); overflow: hidden; }
.drawer.out { animation: drawerOut .22s var(--ease) forwards; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 22px 22px; }
.drawer-hero { padding: 22px; display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, var(--brand-soft), transparent); }
@keyframes drawerIn { from { transform: translateX(110%); } }
@keyframes drawerOut { to { transform: translateX(110%); } }
.popover { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); padding: 6px; min-width: 220px; animation: popIn .22s var(--ease); transform-origin: top right; }
.popover.out { animation: popOut .15s var(--ease) forwards; }
.popover .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; text-align: left; cursor: pointer; font-weight: 700; }
.popover .mi:hover { background: var(--surface-2); }
.popover .mi small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.popover .mi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes popOut { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
.notif .ni { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--info-soft); color: var(--info); }
.notif .ni.urgent { background: var(--bad-soft); color: var(--bad); } .notif .ni.success { background: var(--ok-soft); color: var(--ok); }

.palette { position: fixed; z-index: 80; left: 50%; top: 12vh; width: min(620px, calc(100vw - 32px)); transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); overflow: hidden; animation: paletteIn .3s var(--spring); }
.palette.out { animation: fadeOut .15s forwards; }
.palette input { width: 100%; height: 58px; border: 0; outline: none; padding: 0 18px 0 50px; font-size: 16px; font-weight: 600; background: transparent; border-bottom: 1px solid var(--line); }
.palette .pi { position: absolute; left: 18px; top: 19px; color: var(--faint); }
.palette .results { max-height: 420px; overflow-y: auto; padding: 8px; }
.palette .group { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.palette .res { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.palette .res.on { background: var(--brand-soft); color: var(--brand-ink); }
.palette .res small { color: var(--muted); font-weight: 600; margin-left: auto; }
.palette .hint-row { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); font-weight: 600; }
@keyframes paletteIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.98); } }

.toasts { position: fixed; z-index: 100; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 380px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-3); font-weight: 600; animation: toastIn .45s var(--spring); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
.toast .ti { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex-shrink: 0; }
.toast.ok .ti { background: var(--ok); } .toast.bad .ti { background: var(--bad); } .toast.wa .ti { background: var(--wa); }
.toast small { display: block; opacity: .7; font-size: 12px; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-weight: 800; cursor: pointer; opacity: .8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ── Motion ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.enter > * { animation: fadeUp .5s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .05s; } .enter > *:nth-child(3) { animation-delay: .1s; } .enter > *:nth-child(4) { animation-delay: .15s; }
.enter > *:nth-child(5) { animation-delay: .2s; } .enter > *:nth-child(6) { animation-delay: .25s; } .enter > *:nth-child(n+7) { animation-delay: .3s; }
.view.leaving { opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pulse-once { animation: pulseOnce .8s var(--ease); }
@keyframes pulseOnce { 30% { transform: scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1499px) {
  /* Today: the patient flow gets the full width; the side panels pair up underneath. */
  .g-today:has(> #flow) { grid-auto-flow: row dense; }
  .g-today > #flow, .g-today > #load { grid-column: span 12; }
  .g-today > #wa, .g-today > #reminders { grid-column: span 6; }
  .thread-actions [data-assign] .lbl { display: none; }
}
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 320px 1fr; } .inbox > .side-info { display: none; }
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 6; } .span-3 { grid-column: span 6; }
  .camp { grid-template-columns: 1fr 1fr; } .camp > :last-child { justify-content: flex-start; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-105%); transition: transform .4s var(--spring); box-shadow: var(--shadow-3); background: var(--side); }
  .sidebar.open { transform: none; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(10, 12, 30, .38); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .sidebar.open + .side-scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .clock small, .search-btn kbd { display: none; }
  .g-today > * { grid-column: span 12 !important; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .settings-nav a { flex-shrink: 0; white-space: nowrap; } .settings-nav .note { display: none; }
  .inbox { grid-template-columns: 1fr; } .inbox:not(.has-thread) { height: auto; }
  .inbox.has-thread .inbox-list { display: none; } .inbox:not(.has-thread) .thread { display: none; }
  .inbox.has-thread { height: calc(100vh - 200px); height: calc(100dvh - 200px); min-height: 420px; }
  .sched-bar { flex-wrap: wrap; }
  .who-chips { order: 10; flex-basis: 100%; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .steps, .theme-cards { grid-template-columns: 1fr; }
  .camp { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .mini-grid, .form-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(4, 80%); scroll-snap-type: x mandatory; } .lane { scroll-snap-align: start; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 24px; }
  .page-head > :first-child { min-width: 0; }
  .page-head .actions { width: 100%; } .page-head .actions .btn { flex: 1 1 auto; }
  .clock, #theme-btn { display: none; }
  .topbar { gap: 8px; }
  .search-btn { width: auto; flex: 1; min-width: 0; }
  .search-btn kbd { display: none; }
  #new-btn { width: 42px; padding: 0; } #new-btn > span { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; } .stat .value { font-size: 22px; } .stat .label { font-size: 12px; gap: 8px; } .stat .foot { font-size: 11.5px; } .stat .spark { display: none; }
  .thread-actions .lbl { display: none; }
  .thread-head { gap: 8px; padding: 10px 12px; }
  .topbar > .grow { display: none; }
  .card-head h3 { white-space: normal; }
  .tl-row, .tl-hours { grid-template-columns: 90px 1fr 44px; }
  .hours .h-row { grid-template-columns: 1fr auto; } .hours .h-row .input { grid-column: span 1; }
}

/* ── Sign-in ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg-grad); }
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px; }
.login-card h1 { font-size: 24px; font-weight: 800; margin-top: 6px; }
.login-card > .muted { margin: -8px 0 0; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand small { display: block; color: var(--muted); font-weight: 600; }
.login-card .btn.primary { height: 44px; }
.login-error { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 700; font-size: 13px; }
.demo-box { display: grid; gap: 8px; margin-top: 6px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.demo-head { display: flex; align-items: center; gap: 8px; }
.demo-acc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .2s, transform .15s; }
.demo-acc:hover { border-color: var(--brand); }
.demo-acc:active { transform: scale(.98); }
.demo-acc b { display: block; line-height: 1.3; }
.demo-acc small { display: block; font-size: 12px; line-height: 1.4; }
