/* ============================================================
   OrthoMetry UI v2 â€” preview page language, scoped to .ui-v2-page
   Generated from ui-preview/preview.css. Do not edit by hand.
   ============================================================ */

@property --p {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

.ui-v2-page {
  font-family: var(--ui-font);
  color: var(--text);
  --ui-font: 'Geist', 'Segoe UI', system-ui, sans-serif;
  --ui-mono: 'Geist Mono', 'Consolas', monospace;
}
/* ---------- Direction tokens ---------- */
.ui-v2-page[data-direction="atrium"] {
  --bg: #05080D;
  --bg-2: #070B12;
  --workspace: rgba(10, 15, 24, 0.72);
  --sidebar: rgba(8, 12, 20, 0.84);
  --surface: rgba(17, 25, 39, 0.72);
  --surface-solid: #111927;
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --input: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #F4F7FB;
  --text-2: #A9B6C8;
  --text-3: #6F7E94;
  --accent: #2DD4BF;
  --accent-2: #38BDF8;
  --accent-ink: #042F2E;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --sky: #38BDF8;
  --violet: #A78BFA;
  --gold: #F5B84B;
  --rose: #FB7185;
  --success: #34D399;
  --track: rgba(255, 255, 255, 0.07);
  --card-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.8);
  --card-shadow-hover: 0 30px 70px -28px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(45, 212, 191, 0.08);
  --nav-active: linear-gradient(90deg, rgba(45, 212, 191, 0.16), rgba(45, 212, 191, 0.045));
  --nav-active-border: rgba(45, 212, 191, 0.18);
  --glow: rgba(45, 212, 191, 0.25);
  --titlebar: #05080D;
  --scroll: rgba(255, 255, 255, 0.14);
  --orb-a: rgba(45, 212, 191, 0.13);
  --orb-b: rgba(56, 189, 248, 0.10);
  --orb-c: rgba(245, 184, 75, 0.055);
  --sidebar-text: #F4F7FB;
  --sidebar-text-2: #A9B6C8;
  --sidebar-text-3: #6F7E94;
  --sidebar-border: rgba(255, 255, 255, 0.075);
  --sidebar-surface: rgba(255, 255, 255, 0.04);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
}

.ui-v2-page[data-direction="porcelain"] {
  --bg: #F3F1EB;
  --bg-2: #EFEDE6;
  --workspace: rgba(255, 255, 255, 0.68);
  --sidebar: rgba(13, 23, 38, 0.95);
  --surface: #FFFFFF;
  --surface-solid: #FFFFFF;
  --surface-2: #F7F5F0;
  --surface-hover: #F2EFE8;
  --input: #F7F5F0;
  --border: #E6E1D6;
  --border-strong: #D6CFC1;
  --text: #14202E;
  --text-2: #5B6B7E;
  --text-3: #8A97A6;
  --accent: #0F766E;
  --accent-2: #0284C7;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --sky: #0284C7;
  --violet: #7C3AED;
  --gold: #B7791F;
  --rose: #E11D48;
  --success: #059669;
  --track: rgba(20, 32, 46, 0.08);
  --card-shadow: 0 12px 30px -18px rgba(20, 32, 46, 0.18);
  --card-shadow-hover: 0 24px 50px -24px rgba(20, 32, 46, 0.25);
  --nav-active: linear-gradient(90deg, rgba(45, 212, 191, 0.18), rgba(45, 212, 191, 0.04));
  --nav-active-border: rgba(45, 212, 191, 0.22);
  --glow: rgba(15, 118, 110, 0.18);
  --titlebar: #0A121E;
  --scroll: rgba(20, 32, 46, 0.18);
  --orb-a: rgba(183, 121, 31, 0.10);
  --orb-b: rgba(15, 118, 110, 0.07);
  --orb-c: rgba(2, 132, 199, 0.045);
  --sidebar-text: #F4F7FB;
  --sidebar-text-2: #A9B6C8;
  --sidebar-text-3: #6F7E94;
  --sidebar-border: rgba(255, 255, 255, 0.075);
  --sidebar-surface: rgba(255, 255, 255, 0.04);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
}

.ui-v2-page[data-direction="noir"] {
  --bg: #070708;
  --bg-2: #0A0A0C;
  --workspace: rgba(14, 14, 16, 0.78);
  --sidebar: rgba(10, 10, 12, 0.9);
  --surface: rgba(20, 20, 23, 0.78);
  --surface-solid: #141417;
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --input: rgba(255, 255, 255, 0.04);
  --border: rgba(226, 177, 92, 0.12);
  --border-strong: rgba(226, 177, 92, 0.24);
  --text: #F7F2E8;
  --text-2: #B8AE9C;
  --text-3: #7E7669;
  --accent: #E2B15C;
  --accent-2: #C9923F;
  --accent-ink: #1A1205;
  --accent-soft: rgba(226, 177, 92, 0.12);
  --sky: #8FA7C4;
  --violet: #B39DDB;
  --gold: #E2B15C;
  --rose: #E57373;
  --success: #7BC8A4;
  --track: rgba(255, 255, 255, 0.07);
  --card-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.85);
  --card-shadow-hover: 0 30px 70px -28px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(226, 177, 92, 0.10);
  --nav-active: linear-gradient(90deg, rgba(226, 177, 92, 0.16), rgba(226, 177, 92, 0.04));
  --nav-active-border: rgba(226, 177, 92, 0.22);
  --glow: rgba(226, 177, 92, 0.22);
  --titlebar: #070708;
  --scroll: rgba(226, 177, 92, 0.2);
  --orb-a: rgba(226, 177, 92, 0.12);
  --orb-b: rgba(201, 146, 63, 0.07);
  --orb-c: rgba(143, 167, 196, 0.04);
  --sidebar-text: #F7F2E8;
  --sidebar-text-2: #B8AE9C;
  --sidebar-text-3: #7E7669;
  --sidebar-border: rgba(226, 177, 92, 0.10);
  --sidebar-surface: rgba(255, 255, 255, 0.035);
  --sidebar-hover: rgba(255, 255, 255, 0.055);
}


@scope (.ui-v2-page) {
/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Geist', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: 'Geist Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; }
.success { color: var(--success) !important; }
.gold { color: var(--gold) !important; }
.muted { color: var(--text-3); }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ambient .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .9;
  animation: orbFloat 18s ease-in-out infinite alternate;
}
.orb-a { width: 620px; height: 520px; left: -140px; top: -180px; background: var(--orb-a); }
.orb-b { width: 560px; height: 460px; right: -120px; top: -120px; background: var(--orb-b); animation-delay: -6s; }
.orb-c { width: 700px; height: 520px; left: 40%; bottom: -320px; background: var(--orb-c); animation-delay: -11s; }
.grain {
  position: absolute; inset: 0; opacity: .22;
  background-image: radial-gradient(rgba(255,255,255,.10) .5px, transparent .5px);
  background-size: 4px 4px;
  mix-blend-mode: overlay;
}
html[data-direction="porcelain"] .grain { opacity: .10; }

@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 26px, 0) scale(1.08); }
}

/* ---------- App frame ---------- */
.app-frame { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; }

.titlebar {
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
  background: var(--titlebar);
  border-bottom: 1px solid var(--sidebar-border);
  user-select: none;
  -webkit-app-region: drag;
}
.titlebar-drag { display: flex; align-items: center; gap: 8px; height: 100%; }
.titlebar-icon { width: 17px; height: 17px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.titlebar-title { font-size: 11.5px; font-weight: 600; letter-spacing: .01em; color: var(--sidebar-text-2); }
.titlebar-tag {
  font-size: 8.5px; font-weight: 600; letter-spacing: .04em; color: #38BDF8;
  background: rgba(56, 189, 248, .10); border: 1px solid rgba(56, 189, 248, .22);
  padding: 2px 6px; border-radius: 4px;
}
.titlebar-right { display: flex; align-items: center; gap: 10px; -webkit-app-region: no-drag; }
.preview-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 8px; font-weight: 700; letter-spacing: .12em;
  color: #F5B84B; background: rgba(245, 184, 75, .10);
  border: 1px solid rgba(245, 184, 75, .22); padding: 3px 7px; border-radius: 999px;
}
.pulse-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }

.win-controls { display: flex; height: 38px; }
.win-btn {
  width: 42px; height: 38px; display: grid; place-items: center;
  background: none; border: none; color: #94A3B8; cursor: default;
  transition: background .15s, color .15s;
}
.win-btn svg { width: 11px; height: 11px; stroke-width: 1.2; }
.win-btn:hover { background: rgba(255,255,255,.06); color: #F8FAFC; }
.win-close:hover { background: #E81123; color: #fff; }

.app-body {
  flex: 1; min-height: 0;
  display: flex; gap: 12px;
  padding: 0 12px 12px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 252px; flex: none;
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border: 1px solid var(--sidebar-border);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(26px);
  box-shadow: var(--card-shadow);
  transition: background-color .35s ease, border-color .35s ease;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 17px 16px 11px;
}
.brand-mark { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(0,0,0,.4)); }
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-word { width: 138px; height: auto; display: block; }
.brand-text span {
  font-size: 7px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--sidebar-text-3); white-space: nowrap;
}

.clinic-switcher {
  display: flex; align-items: center; gap: 9px;
  margin: 0 11px 6px; padding: 8px 9px;
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-border);
  border-radius: 12px; cursor: pointer; text-align: left;
  transition: background .2s, border-color .2s, transform .2s;
}
.clinic-switcher:hover { background: var(--sidebar-hover); border-color: rgba(255,255,255,.14); transform: translateY(-1px); }
.clinic-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(45,212,191,.22), rgba(56,189,248,.12));
  border: 1px solid rgba(45,212,191,.28);
  color: #5EEAD4; font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
}
.clinic-meta { display: flex; flex-direction: column; min-width: 0; }
.clinic-meta strong { font-size: 11px; font-weight: 600; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-meta small { font-size: 9px; color: var(--sidebar-text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 13px; height: 13px; color: var(--sidebar-text-3); flex: none; margin-left: auto; }

.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 10px 8px; }
.nav::-webkit-scrollbar { width: 0; }
.nav-list { position: relative; }
.nav-section {
  padding: 13px 11px 6px;
  font-size: 8px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--sidebar-text-3);
}
.nav-section:first-child { padding-top: 5px; }

.nav-glider {
  position: absolute; left: 0; right: 0; top: 0; height: 42px;
  border-radius: 11px;
  background: var(--nav-active);
  border: 1px solid var(--nav-active-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 22px -14px var(--glow);
  z-index: 0; pointer-events: none;
  transition: transform .48s cubic-bezier(.22,1,.36,1), height .3s ease, background .35s, border-color .35s;
}

.nav-item {
  position: relative; z-index: 1;
  width: 100%; height: 42px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 11px; margin: 1px 0;
  background: none; border: none; border-radius: 11px;
  color: var(--sidebar-text-2);
  font-size: 11.5px; font-weight: 500; text-align: left;
  cursor: pointer; user-select: none; overflow: hidden;
  transition: color .2s ease, transform .2s ease;
}
.nav-item:hover { color: var(--sidebar-text); }
.nav-item:active { transform: scale(.985); }
.nav-item.active { color: var(--sidebar-text); font-weight: 600; }
.nav-icon {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--icon-accent, #2DD4BF) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--icon-accent, #2DD4BF) 20%, transparent);
  color: #D7E1EC;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s, border-color .25s, box-shadow .25s, color .25s;
}
.nav-icon svg { width: 16px; height: 16px; }
.nav-icon .accent { stroke: var(--icon-accent, #2DD4BF); }
.nav-item:hover .nav-icon {
  transform: none;
  color: #D7E1EC;
  border-color: color-mix(in srgb, var(--icon-accent, #2DD4BF) 20%, transparent);
  box-shadow: none;
}
.nav-item.active .nav-icon {
  transform: none;
  color: #D7E1EC;
  background: color-mix(in srgb, var(--icon-accent, #2DD4BF) 11%, transparent);
  border-color: color-mix(in srgb, var(--icon-accent, #2DD4BF) 20%, transparent);
  box-shadow: none;
}
.nav-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto; flex: none;
  font-size: 8.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 6px; border-radius: 999px;
  color: var(--sidebar-text-3);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--sidebar-border);
}
.nav-item.active .nav-badge { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); }

.sidebar-footer {
  flex: none; display: flex; flex-direction: column; gap: 5px;
  padding: 9px 11px 11px;
  border-top: 1px solid var(--sidebar-border);
}
.sync-card {
  padding: 9px 10px; border-radius: 11px;
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-border);
  margin-bottom: 2px;
}
.sync-top { display: flex; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 600; color: var(--sidebar-text-2); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 8px var(--glow); animation: pulse 2.4s ease-in-out infinite; }
.sync-time { margin-left: auto; font-size: 8.5px; font-weight: 500; color: var(--sidebar-text-3); }
.sync-card p { margin: 4px 0 7px; font-size: 9px; line-height: 1.4; color: var(--sidebar-text-3); }
.sync-bar { height: 3px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.sync-bar span { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.sidebar-row {
  height: 36px; display: flex; align-items: center; gap: 9px;
  padding: 0 9px; border-radius: 9px;
  background: none; border: none; color: var(--sidebar-text-2);
  font-size: 10.5px; font-weight: 500; cursor: pointer;
  transition: background .2s, color .2s;
}
.sidebar-row:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.row-icon { width: 23px; height: 23px; display: grid; place-items: center; color: var(--sidebar-text-3); }
.row-icon svg { width: 15px; height: 15px; }
.row-label { min-width: 0; }
.switch-mini {
  margin-left: auto; width: 29px; height: 17px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid var(--sidebar-border);
  position: relative; transition: background .25s, border-color .25s;
}
.switch-mini span {
  position: absolute; top: 2px; left: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: #94A3B8;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s;
}
.switch-mini.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.switch-mini.on span { transform: translateX(12px); background: var(--accent); }

.user-card {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 11px;
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-border);
  cursor: pointer; text-align: left;
  transition: background .2s, border-color .2s;
}
.user-card:hover { background: var(--sidebar-hover); border-color: rgba(255,255,255,.14); }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { font-size: 10.5px; font-weight: 600; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: 8.5px; color: var(--sidebar-text-3); margin-top: 1px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--a, #2DD4BF), var(--b, #0EA5E9));
  color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .01em;
  border: 2px solid var(--surface-solid);
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.avatar-sm { width: 30px; height: 30px; font-size: 9.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; border-width: 3px; }

/* ---------- Workspace ---------- */
.workspace {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--workspace);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(26px);
  box-shadow: var(--card-shadow);
  transition: background-color .35s ease, border-color .35s ease;
}

.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 52%, transparent);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.crumb svg { width: 11px; height: 11px; }
.crumb strong { color: var(--text-2); font-weight: 600; }
.live-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 8px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 3px 7px; border-radius: 999px;
}
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.search-trigger {
  width: 286px; height: 34px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 9px; border-radius: 9px;
  background: var(--input); border: 1px solid var(--border);
  color: var(--text-3); font-size: 10.5px; text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text-2); }
.search-trigger svg { width: 14px; height: 14px; flex: none; }
.search-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font-family: 'Geist Mono', monospace; font-size: 8px; font-weight: 500;
  padding: 2px 5px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
}
.search-trigger kbd { margin-left: auto; flex: none; }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2);
  cursor: pointer; position: relative;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.small svg { width: 13px; height: 13px; }
.icon-btn.has-dot::after {
  content: ''; position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rose); border: 2px solid var(--bg-2);
}

.btn {
  height: 36px; padding: 0 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 11px; font-weight: 600; letter-spacing: -.01em;
  cursor: pointer; position: relative; overflow: hidden;
  white-space: nowrap; user-select: none;
  transition: transform .16s ease, box-shadow .25s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn svg { width: 14px; height: 14px; flex: none; }
.btn:active { transform: scale(.97); }
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--accent-2)));
  box-shadow: 0 8px 22px -12px var(--glow), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.28) 48%, transparent 70%);
  transform: translateX(-130%); transition: transform .65s ease; pointer-events: none;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -12px var(--glow), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-primary:hover::after { transform: translateX(130%); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 10.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.28); transform: scale(0); animation: ripple .65s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---------- Page viewport ---------- */
.page-viewport {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 24px 28px 140px;
  position: relative;
  scroll-behavior: smooth;
}
.route-progress {
  position: sticky; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--glow);
  border-radius: 999px; opacity: 0; z-index: 40; margin-bottom: -2px;
}
.route-progress.running { animation: route .55s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes route { 0% { width: 0; opacity: 1; } 70% { width: 82%; opacity: 1; } 100% { width: 100%; opacity: 0; } }

.page { display: none; }
.page.active { display: block; animation: pageIn .55s cubic-bezier(.16,1,.3,1) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translate3d(var(--enter-x, 0px), 14px, 0) scale(.997); }
  to { opacity: 1; transform: none; }
}
.reveal { animation: rise .6s cubic-bezier(.16,1,.3,1) both; animation-delay: calc(var(--i, 0) * 55ms + 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-head-copy { min-width: 0; }
.eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-size: 9px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 7px;
}
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--glow); flex: none; }
.page-head h1 {
  font-size: 29px; font-weight: 650; letter-spacing: -.035em; line-height: 1.08;
  color: var(--text); margin: 0;
}
.grad-text {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-head p { margin: 7px 0 0; font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.page-head-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.count-badge {
  display: inline-block; vertical-align: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: 0;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 3px 8px; border-radius: 999px; margin-left: 5px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s ease, border-color .3s ease, background-color .35s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow-hover);
}
.table-card:hover, .tabs-card:hover, .calendar-card:hover, .settings-card:hover, .form-card:hover { transform: none; }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 15px 17px 11px;
}
.card-head h3, .aside-head h3, .panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.card-head p { margin: 3px 0 0; font-size: 9.5px; color: var(--text-3); }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 0;
  color: var(--accent); font-size: 9.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: gap .2s ease, opacity .2s ease;
}
.link-btn:hover { gap: 7px; opacity: .85; }
.link-btn svg { width: 12px; height: 12px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 11px; }
.kpi { padding: 14px 15px 12px; min-height: 132px; overflow: hidden; }
.kpi::after {
  content: ''; position: absolute; right: -30px; top: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 20%, transparent);
  color: var(--tone, var(--accent));
}
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-icon.teal { --tone: var(--accent); }
.kpi-icon.sky { --tone: var(--sky); }
.kpi-icon.violet { --tone: var(--violet); }
.kpi-icon.gold { --tone: var(--gold); }
.kpi-icon.rose { --tone: var(--rose); }
.delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 999px;
}
.delta svg { width: 10px; height: 10px; }
.delta.up { color: var(--success); background: color-mix(in srgb, var(--success) 11%, transparent); }
.delta.down { color: var(--rose); background: color-mix(in srgb, var(--rose) 10%, transparent); }
.kpi-value {
  font-size: 28px; font-weight: 650; letter-spacing: -.045em; line-height: 1;
  color: var(--text); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-value.mono { font-size: 21px; letter-spacing: -.03em; }
.kpi-label { margin-top: 5px; font-size: 10px; color: var(--text-3); }
.spark { height: 26px; margin-top: 9px; }
.spark svg { width: 100%; height: 100%; overflow: visible; }
.spark-line { stroke: var(--accent); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }
@keyframes drawSpark { to { stroke-dashoffset: 0; } }
.kpi-foot { margin-top: 10px; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack i {
  width: 22px; height: 22px; border-radius: 50%; margin-left: -5px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a, #2DD4BF), var(--b, #0EA5E9));
  border: 2px solid var(--surface-solid);
  color: #fff; font-size: 7px; font-style: normal; font-weight: 700;
}
.avatar-stack i:first-child { margin-left: 0; }
.avatar-stack i:last-child { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }

/* ---------- Pills & dots ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 8.5px; font-weight: 600; letter-spacing: .01em;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2);
  background: var(--surface-2); white-space: nowrap;
}
.pill.teal { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.pill.sky { color: var(--sky); background: color-mix(in srgb, var(--sky) 11%, transparent); border-color: color-mix(in srgb, var(--sky) 20%, transparent); }
.pill.gold { color: var(--gold); background: color-mix(in srgb, var(--gold) 11%, transparent); border-color: color-mix(in srgb, var(--gold) 20%, transparent); }
.pill.rose { color: var(--rose); background: color-mix(in srgb, var(--rose) 10%, transparent); border-color: color-mix(in srgb, var(--rose) 20%, transparent); }
.pill.slate { color: var(--text-3); }
.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.dot.teal { color: var(--accent); }
.dot.sky { color: var(--sky); }
.dot.gold { color: var(--gold); }
.dot.rose { color: var(--rose); }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 11px; margin-bottom: 11px; }
.dash-grid.lower { grid-template-columns: 1.35fr 1fr; }

.schedule-list { padding: 0 7px 7px; }
.schedule-row {
  display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: background .18s, border-color .18s, transform .18s;
}
.schedule-row:hover { background: var(--surface-hover); border-color: var(--border); transform: translateX(2px); }
.schedule-time { font-family: 'Geist Mono', monospace; font-size: 9px; color: var(--text-3); }
.schedule-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.schedule-main .avatar { width: 30px; height: 30px; font-size: 9px; }
.schedule-info { min-width: 0; }
.schedule-info strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-info small { display: block; font-size: 9px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.donut-wrap { display: grid; place-items: center; padding: 4px 0 9px; }
.donut {
  width: 136px; height: 136px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0);
  display: grid; place-items: center; position: relative;
  animation: donutGrow 1.1s cubic-bezier(.16,1,.3,1) both;
  box-shadow: 0 0 40px -18px var(--glow);
}
@keyframes donutGrow { from { --p: 0; } }
.donut::before {
  content: ''; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--surface-solid); border: 1px solid var(--border);
}
.donut-hole { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.donut-hole strong { font-size: 27px; font-weight: 650; letter-spacing: -.05em; line-height: 1; }
.donut-hole strong span { font-size: 12px; color: var(--text-3); margin-left: 1px; }
.donut-hole small { font-size: 7.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); margin-top: 4px; }
.legend { display: flex; flex-direction: column; gap: 6px; padding: 0 17px; }
.legend > div { display: grid; grid-template-columns: 7px 1fr auto; align-items: center; gap: 7px; font-size: 9.5px; color: var(--text-2); }
.legend strong { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--text); font-weight: 500; }
.week-bars {
  display: flex; align-items: flex-end; gap: 7px; height: 62px;
  margin: 12px 17px 22px; padding-top: 8px; border-top: 1px solid var(--border);
}
.week-bars > div {
  flex: 1; height: var(--h); border-radius: 3px 3px 2px 2px;
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  position: relative; transition: height .45s cubic-bezier(.16,1,.3,1), background .2s;
  animation: barGrow .8s cubic-bezier(.16,1,.3,1) both;
}
.week-bars > div:hover { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.week-bars > div.today { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); box-shadow: 0 0 18px -6px var(--glow); }
.week-bars span { position: absolute; left: 0; right: 0; bottom: -15px; text-align: center; font-size: 7.5px; color: var(--text-3); }
.week-bars .today span { color: var(--accent); }
@keyframes barGrow { from { height: 0; } }

.recent-list { padding: 0 7px 7px; }
.recent-row {
  display: grid; grid-template-columns: 1fr 86px auto; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: 10px; cursor: pointer;
  transition: background .18s, transform .18s;
}
.recent-row:hover { background: var(--surface-hover); transform: translateX(2px); }
.recent-patient { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent-patient .avatar { width: 30px; height: 30px; font-size: 9px; }
.recent-info { min-width: 0; }
.recent-info strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-info small { display: block; font-size: 9px; color: var(--text-3); margin-top: 1px; }
.recent-progress { min-width: 0; }
.progress { height: 5px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress > span {
  display: block; height: 100%; width: var(--pct);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: progressGrow 1s cubic-bezier(.16,1,.3,1) both;
}
@keyframes progressGrow { from { width: 0; } }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 0 13px; }
.action-tile {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 9px; border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  text-align: left; cursor: pointer; overflow: hidden;
  transition: transform .2s cubic-bezier(.16,1,.3,1), border-color .2s, background .2s, box-shadow .2s;
}
.action-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 10px 24px -18px rgba(0,0,0,.35);
}
.action-tile:active { transform: scale(.98); }
.action-tile strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); }
.action-tile small { display: block; font-size: 8.5px; color: var(--text-3); margin-top: 1px; }
.action-icon {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 20%, transparent);
  color: var(--tone, var(--accent)); font-size: 13px;
}
.action-icon svg { width: 16px; height: 16px; }
.action-icon.teal { --tone: var(--accent); }
.action-icon.sky { --tone: var(--sky); }
.action-icon.violet { --tone: var(--violet); }
.action-icon.gold { --tone: var(--gold); }
.action-icon.orange { --tone: #FB923C; }
.action-icon.rose { --tone: var(--rose); }

.retention-strip {
  display: block;
  margin: 11px 13px 13px; padding: 9px 11px;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.retention-head { display: flex; align-items: center; gap: 9px; }
.retention-copy { flex: 1; display: grid; grid-template-columns: 7px 1fr; column-gap: 7px; align-items: center; }
.retention-copy strong { font-size: 10px; font-weight: 600; color: var(--text); }
.retention-copy small { grid-column: 2; font-size: 8.5px; color: var(--text-3); margin-top: 1px; }
.retention-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.retention-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--surface-solid) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.retention-row:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.retention-row .retention-name { flex: 1; min-width: 0; }
.retention-row .retention-name strong { display: block; font-size: 9.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.retention-row .retention-name small { display: block; font-size: 8px; color: var(--text-3); }
.retention-row .pill { font-size: 7.5px; padding: 2px 6px; }
.retention-empty { padding: 7px 2px 1px; font-size: 8.5px; color: var(--text-3); }

/* ---------- Toolbar / table ---------- */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 10px; margin-bottom: 11px;
}
.toolbar:hover { transform: none; }
.search-field {
  flex: 1; min-width: 210px; height: 36px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 10px; border-radius: 9px;
  background: var(--input); border: 1px solid var(--border);
  color: var(--text-3);
  transition: border-color .2s, box-shadow .2s;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field svg { width: 14px; height: 14px; flex: none; }
.search-field input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text); font-size: 10.5px; }
.search-field input::placeholder { color: var(--text-3); }
.search-field kbd { flex: none; }
.filter-chips {
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
}
.chip {
  height: 28px; padding: 0 9px; border-radius: 7px;
  background: none; border: none; color: var(--text-3);
  font-size: 9.5px; font-weight: 600; cursor: pointer; overflow: hidden;
  transition: background .2s, color .2s, box-shadow .2s;
}
.chip:hover { color: var(--text-2); }
.chip.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.select-btn {
  height: 36px; padding: 0 10px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--input); border: 1px solid var(--border); color: var(--text-2);
  font-size: 9.5px; font-weight: 500; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.select-btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.select-btn svg { width: 13px; height: 13px; }
.select-btn .chev { margin-left: 2px; width: 11px; height: 11px; }

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.data-table thead th {
  text-align: left; padding: 11px 14px;
  font-size: 8.5px; font-weight: 700; letter-spacing: .085em; text-transform: uppercase;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  position: sticky; top: 0; z-index: 2; backdrop-filter: blur(10px);
  white-space: nowrap;
}
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent); color: var(--text-2); vertical-align: middle; line-height: 1.35; }
.data-table thead th:first-child, .data-table tbody td:first-child { padding-left: 18px; }
.data-table thead th:last-child, .data-table tbody td:last-child { padding-right: 18px; }
.data-table tbody tr { cursor: pointer; transition: background .16s ease; }
.data-table tbody tr:hover { background: var(--surface-hover); transform: none; box-shadow: none; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-family: 'Geist Mono', monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table.compact td { padding: 8px 14px; }
.patient-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.patient-cell .avatar { width: 30px; height: 30px; font-size: 9px; border-width: 1.5px; flex: none; }
.patient-cell-copy { min-width: 0; flex: 1 1 auto; }
.patient-cell strong { display: block; font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.patient-cell small { display: block; font-size: 8.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.patient-clinic-inline { color: var(--text-2); font-weight: 600; }
.patient-clinic-inline::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--clinic-dot, var(--accent)); margin-right: 4px; vertical-align: middle;
}
.data-table td.clinic-cell { color: var(--text); font-weight: 600; white-space: nowrap; max-width: 155px; overflow: hidden; text-overflow: ellipsis; }
#patientsTable tbody tr:hover { background: var(--surface-hover); transform: none; box-shadow: none; }
#patientsTable tbody td:first-child { color: var(--text-2); font-weight: 400; min-width: 215px; }
#patientsTable tbody td:nth-child(2) { white-space: nowrap; font-size: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
#patientsTable tbody td:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
#patientsTable tbody td:nth-child(4) { white-space: nowrap; }
#patientsTable th:nth-child(6), #patientsTable tbody td.prev-visit-td { min-width: 150px; max-width: 220px; }
#patientsTable tbody td:nth-child(7) { white-space: nowrap; font-variant-numeric: tabular-nums; }
#patientsTable tbody td.num { font-weight: 600; color: var(--text); }
#patientsTable th:last-child, #patientsTable tbody td:last-child { min-width: 96px; white-space: nowrap; }
#patientsTable .prev-visit-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
#patientsTable .prev-visit-wires { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 0; max-width: 100%; }
#patientsTable .patient-wire-date { font-family: 'Geist Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; font-size: 8.5px; color: var(--text-3); line-height: 1.25; white-space: nowrap; }
#patientsTable .prev-visit-empty { color: var(--text-3); font-size: 10.5px; }
.table-progress { width: 76px; }
.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 13px; border-top: 1px solid var(--border);
  font-size: 9px; color: var(--text-3);
}
.table-foot strong { color: var(--text-2); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 3px; }
.page-btn {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--border); background: none; color: var(--text-3);
  font-size: 9.5px; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.page-btn:hover { background: var(--surface-hover); color: var(--text-2); }
.page-btn.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent); }

/* ---------- Patient detail ---------- */
.detail-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 7px; border-radius: 7px;
  background: none; border: none; color: var(--text-2);
  font-size: 9.5px; font-weight: 600; cursor: pointer;
  transition: background .2s, color .2s;
}
.back-btn:hover { background: var(--surface-hover); color: var(--text); }
.back-btn svg { width: 13px; height: 13px; }
.detail-crumb { font-size: 9px; color: var(--text-3); }
.detail-crumb span { font-family: 'Geist Mono', monospace; color: var(--text-2); }

.patient-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 18px; margin-bottom: 11px; flex-wrap: wrap;
}
.patient-hero:hover { transform: none; }
.patient-hero-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.patient-hero-copy { min-width: 0; }
.patient-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.patient-name-row h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.035em; }
.patient-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 4px; font-size: 9.5px; color: var(--text-3); }
.patient-meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .55; }
.patient-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 8.5px; font-weight: 500; padding: 2px 7px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.patient-hero-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 11px; align-items: start; }
.detail-main { min-width: 0; }
.tabs-card { padding: 0; overflow: hidden; }
.tabs {
  display: flex; align-items: center; gap: 1px;
  padding: 0 12px; border-bottom: 1px solid var(--border);
  position: relative; overflow-x: auto;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  height: 42px; padding: 0 11px; flex: none;
  background: none; border: none; color: var(--text-3);
  font-size: 9.5px; font-weight: 600; cursor: pointer;
  position: relative; z-index: 1; white-space: nowrap;
  transition: color .2s;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); }
.tab-indicator {
  position: absolute; bottom: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px; box-shadow: 0 0 10px var(--glow);
  transition: transform .35s cubic-bezier(.22,1,.36,1), width .35s cubic-bezier(.22,1,.36,1);
}
.tab-panel { display: none; padding: 16px 17px 18px; }
.tab-panel.active { display: block; animation: panelIn .35s cubic-bezier(.16,1,.3,1) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mini-card { padding: 11px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-label { display: block; font-size: 8px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.mini-progress-row { display: flex; align-items: baseline; justify-content: space-between; margin: 7px 0 6px; }
.mini-progress-row strong { font-size: 17px; font-weight: 650; letter-spacing: -.03em; }
.mini-progress-row span { font-size: 8.5px; color: var(--accent); font-weight: 600; }
.mini-card small { display: block; margin-top: 5px; font-size: 8.5px; color: var(--text-3); }
.next-appt { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.date-tile {
  width: 38px; height: 40px; flex: none; border-radius: 8px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.date-tile strong { font-size: 14px; color: var(--accent); line-height: 1; }
.date-tile small { font-size: 7px; color: var(--accent); letter-spacing: .08em; margin-top: 2px; }
.next-appt strong { display: block; font-size: 10px; font-weight: 600; }
.next-appt small { display: block; font-size: 8.5px; color: var(--text-3); margin-top: 1px; }
.balance-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; }
.balance-row strong { font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head .muted { font-size: 8.5px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.summary-grid > div { padding: 9px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.summary-grid span { display: block; font-size: 8.5px; color: var(--text-3); }
.summary-grid strong { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 600; color: var(--text); }

.visit-timeline { position: relative; padding-left: 4px; }
.visit-timeline::before { content: ''; position: absolute; left: 7px; top: 16px; bottom: 16px; width: 1px; background: var(--border); }
.visit-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 8px 0 8px 18px; }
.visit-row::before {
  content: ''; position: absolute; left: 4px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.visit-row strong { display: block; font-size: 10.5px; font-weight: 600; }
.visit-row small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--text-3); }
.visit-date { font-family: 'Geist Mono', monospace; font-size: 8.5px; color: var(--text-3); }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.photo-tile {
  aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--border); position: relative;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(255,255,255,.02) 8px 9px);
  display: flex; align-items: flex-end; padding: 7px;
  font-size: 8px; color: var(--text-3); cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.photo-tile::before {
  content: '◈'; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 26px; color: color-mix(in srgb, var(--accent) 20%, transparent);
}
.photo-tile:hover { border-color: var(--border-strong); transform: scale(1.012); }
.photo-tile span { position: relative; z-index: 1; }

.ceph-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ceph-card { padding: 10px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.ceph-card span { display: block; font-size: 8px; color: var(--text-3); }
.ceph-card strong { display: block; margin: 4px 0 2px; font-size: 16px; font-weight: 650; letter-spacing: -.03em; }
.ceph-card small { font-size: 8px; color: var(--text-3); }
.notice {
  display: flex; gap: 7px; align-items: flex-start;
  margin-top: 10px; padding: 9px 10px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
}
.notice .status-dot { margin-top: 3px; }
.notice p { margin: 0; font-size: 9px; line-height: 1.5; color: var(--text-2); }

.finance-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 10px; }
.finance-rows > div:last-child { border-bottom: none; }
.finance-rows span { color: var(--text-3); }
.finance-rows strong { font-size: 10.5px; font-weight: 600; color: var(--text); }

.detail-aside { display: flex; flex-direction: column; gap: 11px; }
.aside-card { padding: 13px 14px; }
.aside-card:hover { transform: none; }
.aside-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.ring-row { display: flex; align-items: center; gap: 11px; }
.ring {
  width: 70px; height: 70px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0);
  display: grid; place-items: center; position: relative;
}
.ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface-solid); border: 1px solid var(--border); }
.ring span { position: relative; z-index: 1; font-size: 13px; font-weight: 650; letter-spacing: -.03em; }
.ring-copy strong { display: block; font-size: 10px; font-weight: 600; }
.ring-copy small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--text-3); }
.aside-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.aside-stats > div { padding: 7px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.aside-stats span { display: block; font-size: 8px; color: var(--text-3); }
.aside-stats strong { display: block; margin-top: 1px; font-size: 10.5px; font-weight: 600; }
.aside-actions { display: flex; flex-direction: column; gap: 4px; }
.aside-actions button {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 7px; border-radius: 8px;
  background: none; border: 1px solid transparent;
  color: var(--text-2); font-size: 9.5px; text-align: left; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.aside-actions button:hover { background: var(--surface-hover); border-color: var(--border); color: var(--text); }
.aside-actions .action-icon { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-list > div { display: flex; align-items: flex-start; gap: 7px; }
.activity-list .dot { margin-top: 4px; }
.activity-list p { margin: 0; }
.activity-list strong { display: block; font-size: 9.5px; font-weight: 600; color: var(--text-2); }
.activity-list small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--text-3); }

/* ---------- Calendar ---------- */
.week-nav { display: flex; align-items: center; gap: 4px; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 11px; align-items: start; }
.calendar-card { padding: 0; overflow: hidden; }
.calendar-head { display: grid; grid-template-columns: 50px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.day-head { padding: 8px 4px; text-align: center; border-left: 1px solid var(--border); }
.day-head:first-child { border-left: none; }
.day-head span { display: block; font-size: 7.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.day-head strong { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.day-head.today { background: var(--accent-soft); }
.day-head.today strong { color: var(--accent); }
.calendar-body { display: grid; grid-template-columns: 50px minmax(0, 1fr); height: 600px; }
.time-col { position: relative; border-right: 1px solid var(--border); }
.time-label { position: absolute; right: 6px; transform: translateY(-50%); font-family: 'Geist Mono', monospace; font-size: 7.5px; color: var(--text-3); }
.calendar-days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 60px);
}
.day-column { position: relative; border-left: 1px solid var(--border); min-width: 0; }
.day-column:first-child { border-left: none; }
.day-column.today { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.appt {
  position: absolute; left: 2px; right: 2px;
  border-radius: 6px; padding: 4px 5px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 13%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 24%, transparent);
  border-left: 2px solid var(--tone, var(--accent));
  overflow: hidden; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, z-index .16s;
}
.appt:hover { transform: translateY(-1px) scale(1.012); z-index: 8; box-shadow: 0 8px 18px -10px rgba(0,0,0,.55); }
.appt strong { display: block; font-size: 8px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { display: block; margin-top: 1px; font-size: 7px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.teal { --tone: var(--accent); }
.appt.sky { --tone: var(--sky); }
.appt.violet { --tone: var(--violet); }
.appt.gold { --tone: var(--gold); }
.appt.rose { --tone: var(--rose); }
.now-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--rose); z-index: 7; box-shadow: 0 0 8px color-mix(in srgb, var(--rose) 50%, transparent); }
.now-line::before { content: ''; position: absolute; left: -3px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--rose); }

.agenda-card { padding: 13px 13px 11px; display: flex; flex-direction: column; }
.agenda-list { flex: 1; display: flex; flex-direction: column; gap: 4px; margin-bottom: 9px; max-height: 520px; overflow-y: auto; }
.agenda-row {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 7px; align-items: center;
  padding: 6px; border-radius: 8px; cursor: pointer;
  transition: background .18s;
}
.agenda-row:hover { background: var(--surface-hover); }
.agenda-row .time { font-family: 'Geist Mono', monospace; font-size: 8px; color: var(--text-3); }
.agenda-row strong { display: block; font-size: 9.5px; font-weight: 600; }
.agenda-row small { display: block; margin-top: 1px; font-size: 8px; color: var(--text-3); }
.agenda-row .dot { width: 5px; height: 5px; }

/* ---------- Finances ---------- */
.finance-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 11px; margin-bottom: 11px; }
.chart-card { padding-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 7px; height: 190px; padding: 6px 17px 24px; }
.bar {
  flex: 1; height: var(--h); border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 14%, transparent));
  position: relative; cursor: pointer;
  transition: filter .2s, transform .2s;
  animation: barGrow .8s cubic-bezier(.16,1,.3,1) both;
}
.bar:hover { filter: brightness(1.25); transform: translateY(-2px); }
.bar.current { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent)); box-shadow: 0 0 22px -6px var(--glow); }
.bar span { position: absolute; left: 0; right: 0; bottom: -17px; text-align: center; font-size: 7.5px; color: var(--text-3); }
.mix-list { display: flex; flex-direction: column; gap: 8px; padding: 0 15px; }
.mix-list > div { display: grid; grid-template-columns: 7px 1fr auto 32px; gap: 7px; align-items: center; font-size: 9.5px; color: var(--text-2); }
.mix-list strong { font-size: 9.5px; font-weight: 500; color: var(--text); }
.mix-list small { text-align: right; font-size: 8.5px; color: var(--text-3); }
.stack-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; margin: 13px 15px 15px; background: var(--track); }
.stack-bar span { width: var(--w); background: var(--c); }
.stack-bar span:first-child { border-radius: 999px 0 0 999px; }
.stack-bar span:last-child { border-radius: 0 999px 999px 0; }

/* ---------- Forms ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 11px; align-items: start; }
.form-card { padding: 17px 18px; }
.form-card:hover { transform: none; }
.form-section-head { margin: 3px 0 11px; }
.form-section-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; }
.form-section-head p { margin: 3px 0 0; font-size: 9px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 15px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 8px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.field input, .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 9px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--input); color: var(--text);
  font-size: 10.5px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { height: auto; padding: 8px 9px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; padding-top: 13px; border-top: 1px solid var(--border); }
.form-aside { display: flex; flex-direction: column; gap: 11px; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { display: flex; gap: 7px; font-size: 9.5px; line-height: 1.45; color: var(--text-2); }
.check { width: 16px; height: 16px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 8px; font-weight: 700; }
.aside-copy { margin: 0 0 10px; font-size: 9.5px; line-height: 1.55; color: var(--text-2); }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; align-items: start; }
.settings-card { padding: 15px 16px; }
.settings-card:hover { transform: none; }
.direction-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.direction-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; text-align: left;
  transition: border-color .2s, background .2s;
}
.direction-option:hover { border-color: var(--border-strong); }
.direction-option.active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.direction-option strong { display: block; font-size: 9.5px; font-weight: 600; }
.direction-option small { display: block; margin-top: 1px; font-size: 8px; color: var(--text-3); }
.direction-option .swatch-chip { width: 24px; height: 24px; }
.swatch-chip { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(0,0,0,.16); flex: none; }
.swatch-chip.atrium { background: linear-gradient(135deg, #0B1220 30%, #2DD4BF); }
.swatch-chip.porcelain { background: linear-gradient(135deg, #F5F3EE 30%, #0F766E); }
.swatch-chip.noir { background: linear-gradient(135deg, #0A0A0C 30%, #E2B15C); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.setting-row strong { display: block; font-size: 10px; font-weight: 600; }
.setting-row small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--text-3); }

/* Clinic Logo (Settings) */
.clinic-logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.clinic-logo-preview { width: 84px; height: 84px; flex: none; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.clinic-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: none; }
.clinic-logo-preview .clinic-logo-empty { font-size: 8.5px; color: var(--text-3); text-align: center; padding: 4px; }
.clinic-logo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px; }
.clinic-logo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.clinic-logo-hint { font-size: 8.5px; line-height: 1.5; color: var(--text-3); }

/* Backup & restore */
.backup-card { grid-column: 1 / -1; }
.backup-actions-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.backup-status { min-width: 220px; flex: 1; }
.backup-status strong { display: block; font-size: 10px; font-weight: 600; color: var(--text); }
.backup-status small { display: block; margin-top: 2px; font-size: 8.5px; line-height: 1.45; color: var(--text-3); }
.backup-buttons { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.backup-progress { margin-top: 9px; }
.backup-progress-track { height: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.backup-progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s ease; }
.backup-progress small { display: block; margin-top: 4px; font-size: 8.5px; color: var(--text-3); }
.backup-auto-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border); }
.backup-auto-copy { min-width: 0; }
.backup-auto-copy strong { display: block; font-size: 10px; font-weight: 600; color: var(--text); }
.backup-auto-copy small { display: block; margin-top: 2px; font-size: 8.5px; line-height: 1.45; color: var(--text-3); }
.backup-auto-row .switch { flex-shrink: 0; }

/* Cloud drive connect row */
.drive-connect-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  margin-bottom: 8px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.drive-connect-row.connected {
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  background: var(--accent-soft);
}
.drive-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-solid);
  border: 1px solid var(--border);
}
.drive-mark svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drive-copy { flex: 1; min-width: 0; }
.drive-copy strong { display: block; font-size: 10px; font-weight: 600; }
.drive-copy small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-connect-row .btn { flex: none; }

/* Password card */
.password-grid { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.password-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}
.password-foot small { font-size: 8.5px; color: var(--text-3); }
.password-foot small strong { color: var(--accent); font-weight: 600; }
.sync-channels-card .setting-row:first-of-type { border-top: none; }
.sync-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 13px 12px;
}
.sync-channel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.sync-channel-head { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.sync-channel-head > div { min-width: 0; }
.sync-channel-head strong { display: block; font-size: 10.5px; font-weight: 600; }
.sync-channel-head small { display: block; margin-top: 2px; font-size: 8.5px; line-height: 1.45; color: var(--text-3); }
.sync-channel-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.sync-channel-icon.sky {
  background: color-mix(in srgb, var(--sky) 12%, transparent);
  color: var(--sky);
  border-color: color-mix(in srgb, var(--sky) 25%, transparent);
}
.sync-channel-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-2);
}
.sync-channel .sync-actions { padding: 0; }
.sync-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 9px; }
.sync-result { min-height: 14px; padding: 0 13px 13px; font-size: 8.5px; color: var(--text-3); line-height: 1.45; }
@media (max-width: 900px) {
  .sync-channel-grid { grid-template-columns: 1fr; }
}
.settings-card { display: flex; flex-direction: column; }
.settings-card .aside-copy { margin-bottom: 8px; }
.settings-card .setting-row:first-of-type { border-top: none; }
.settings-grid { align-items: start; }

/* Finance currency switcher */
.finance-currency { gap: 4px; flex-wrap: nowrap; }
.finance-currency .chip {
  font-size: 8.5px;
  padding: 4px 9px;
  min-width: 0;
  letter-spacing: .04em;
}
.finance-currency .chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.switch { position: relative; width: 34px; height: 19px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--track); border: 1px solid var(--border); transition: background .25s, border-color .25s; }
.switch span::before { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--text-3); transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s; }
.switch input:checked + span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.switch input:checked + span::before { transform: translateX(15px); background: var(--accent); }
.switch input:disabled + span { opacity: .4; cursor: not-allowed; }
.switch input:disabled:checked + span { opacity: .4; }
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 25px; padding: 0 8px; border: none; border-radius: 6px; background: none; color: var(--text-3); font-size: 8.5px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.segmented button:hover { color: var(--text-2); }
.segmented button.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.12); }

/* ---------- Generic module ---------- */
.module-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 11px; }
.recent-activity-card { padding: 15px 16px; min-width: 0; }
.recent-activity-card .aside-head { margin-bottom: 9px; }
.recent-activity-card .activity-list { min-width: 0; }
.recent-activity-card .activity-list > div { min-width: 0; }
.recent-activity-card .activity-list p { min-width: 0; overflow-wrap: anywhere; }
.module-hero { display: flex; align-items: center; gap: 16px; padding: 19px; }
.module-hero:hover { transform: none; }
.module-illustration {
  width: 96px; height: 96px; flex: none; border-radius: 18px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--accent-soft), transparent 65%), var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent); font-size: 38px;
}
.module-hero h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.module-hero p { margin: 5px 0 9px; font-size: 10px; line-height: 1.55; color: var(--text-2); }
.module-tags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- Preview dock ---------- */
.preview-dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 120; display: flex; align-items: center; gap: 12px;
  padding: 7px 9px 7px 13px; border-radius: 14px;
  background: rgba(7, 11, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(26px);
  color: #E7EDF6; font-family: 'Geist', sans-serif;
  animation: dockIn .55s cubic-bezier(.16,1,.3,1) both;
}
@keyframes dockIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.97); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.dock-group { display: flex; align-items: center; gap: 7px; }
.dock-label { font-size: 7.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7E8DA3; }
.swatches { display: flex; gap: 3px; }
.swatch {
  display: flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 7px; border-radius: 7px;
  background: none; border: 1px solid transparent;
  color: #A9B6C8; font-size: 8.5px; font-weight: 600; cursor: pointer; overflow: hidden;
  transition: background .2s, border-color .2s, color .2s;
}
.swatch:hover { background: rgba(255,255,255,.05); color: #fff; }
.swatch.active { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
.dock-divider { width: 1px; height: 22px; background: rgba(255,255,255,.1); }
.preview-dock .segmented { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); padding: 2px; }
.preview-dock .segmented button { color: #7E8DA3; font-size: 8px; height: 24px; }
.preview-dock .segmented button.active { background: rgba(255,255,255,.1); color: #fff; }
.dock-hint { display: flex; align-items: center; gap: 4px; background: none; border: none; color: #7E8DA3; font-size: 8px; cursor: pointer; }
.dock-hint kbd { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.09); color: #A9B6C8; }
.dock-close {
  width: 24px; height: 24px; border-radius: 6px;
  background: none; border: 1px solid rgba(255,255,255,.08);
  color: #7E8DA3; font-size: 12px; cursor: pointer;
  transition: background .2s, color .2s;
}
.dock-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.dock-reopen {
  position: fixed; right: 16px; bottom: 16px; z-index: 120;
  padding: 8px 12px; border-radius: 9px;
  background: rgba(7,11,18,.92); border: 1px solid rgba(255,255,255,.13);
  color: #E7EDF6; font-size: 9px; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(20px); box-shadow: 0 18px 40px -18px rgba(0,0,0,.8);
}

/* ---------- Command palette ---------- */
.palette-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  background: rgba(2, 5, 10, 0.62);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.palette {
  width: 600px; max-width: 92vw;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.85);
  animation: paletteIn .28s cubic-bezier(.16,1,.3,1) both;
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }
.palette-input-row { display: flex; align-items: center; gap: 9px; padding: 0 14px; height: 54px; border-bottom: 1px solid var(--border); }
.palette-input-row svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.palette-input-row input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 12.5px; }
.palette-input-row input::placeholder { color: var(--text-3); }
.palette-results { max-height: 380px; overflow-y: auto; padding: 5px; }
.palette-section { padding: 9px 9px 4px; font-size: 7.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.palette-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); font-size: 10.5px;
  transition: background .15s, color .15s;
}
.palette-item.active { background: var(--accent-soft); color: var(--text); }
.palette-item .p-icon {
  width: 26px; height: 26px; flex: none; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
}
.palette-item .p-icon svg { width: 14px; height: 14px; }
.palette-item strong { font-weight: 600; color: inherit; }
.palette-item .meta { margin-left: auto; font-size: 8px; color: var(--text-3); }
.palette-foot { display: flex; align-items: center; gap: 14px; padding: 7px 13px; border-top: 1px solid var(--border); font-size: 8px; color: var(--text-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: 3px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 180;
  display: grid; place-items: center; padding: 20px;
  background: rgba(2, 5, 10, 0.6);
  backdrop-filter: blur(7px);
  animation: fadeIn .2s ease both;
}
.modal {
  width: 440px; max-width: 92vw;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 20px 20px 18px;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.85);
  position: relative;
  animation: modalIn .3s cubic-bezier(.16,1,.3,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.975); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); font-size: 15px; cursor: pointer;
  transition: background .2s, color .2s;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.modal p { margin: 4px 0 0; font-size: 10px; line-height: 1.55; color: var(--text-2); }
.modal-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 11px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; right: 16px; bottom: 66px; z-index: 220; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; pointer-events: none; }
.toast {
  min-width: 260px; max-width: 330px;
  padding: 10px 12px 11px 14px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.7);
  position: relative; overflow: hidden;
  animation: toastIn .35s cubic-bezier(.16,1,.3,1) both;
  pointer-events: auto;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(18px) scale(.97); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toastOut .24s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px) scale(.97); } }
.toast::before { content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.toast strong { display: block; font-size: 10px; font-weight: 600; color: var(--text); }
.toast small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--text-3); }
.toast-life { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); animation: toastLife 3.4s linear forwards; }
@keyframes toastLife { from { width: 100%; } to { width: 0; } }

/* ---------- Theme flash ---------- */
.theme-flash {
  position: fixed; z-index: 300; width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  transform: translate(-50%, -50%) scale(0); opacity: .35;
  pointer-events: none; animation: themeFlash .7s ease-out forwards;
}
@keyframes themeFlash { to { transform: translate(-50%, -50%) scale(90); opacity: 0; } }

/* ---------- Density ---------- */
body.compact .data-table td { padding-top: 6px; padding-bottom: 6px; }
body.compact .schedule-row, body.compact .recent-row { padding-top: 5px; padding-bottom: 5px; }
body.compact .kpi { min-height: 118px; padding-top: 12px; }
body.compact .page-viewport { padding-top: 18px; }

/* ---------- Motion preferences ---------- */
html[data-motion="subtle"] .page.active { animation-duration: .34s; }
html[data-motion="subtle"] .reveal { animation-duration: .4s; animation-delay: calc(var(--i, 0) * 28ms + 40ms); }
html[data-motion="subtle"] .nav-glider { transition-duration: .3s; }
html[data-motion="subtle"] .card:hover { transform: none; }
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation-duration: .001ms !important;
  animation-delay: 0ms !important;
  transition-duration: .001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .sidebar { width: 232px; }
  .page-viewport { padding: 21px 22px 140px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid, .dash-grid.lower, .finance-grid, .settings-grid, .module-grid { grid-template-columns: 1fr; }
  .detail-grid, .form-layout { grid-template-columns: 1fr; }
  .detail-aside, .form-aside { display: grid; grid-template-columns: repeat(3, 1fr); }
  .calendar-layout { grid-template-columns: 1fr; }
  .agenda-card { max-height: 340px; }
  .agenda-list { max-height: 220px; }
}
@media (max-width: 1120px) {
  .sidebar { width: 76px; }
  .brand { justify-content: center; padding: 16px 8px 10px; }
  .brand-text, .clinic-meta, .clinic-switcher .chev, .nav-label, .nav-badge,
  .sidebar-footer .sync-card, .sidebar-footer .row-label, .sidebar-footer .switch-mini,
  .sidebar-footer .user-meta, .sidebar-footer .user-card .chev { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .clinic-switcher { justify-content: center; margin: 0 8px 6px; padding: 8px 0; }
  .nav { padding: 2px 8px 8px; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-icon { width: 32px; height: 32px; }
  .nav-glider { left: 4px; right: 4px; }
  .sidebar-footer { align-items: center; }
  .sidebar-row { justify-content: center; width: 100%; }
  .user-card { justify-content: center; padding: 6px; }
  .search-trigger { width: 210px; }
}
@media (max-width: 860px) {
  .app-body { padding: 0 8px 8px; gap: 8px; }
  .workspace { border-radius: 16px; }
  .topbar { padding: 0 14px; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; }
  .page-head h1 { font-size: 24px; }
  .overview-grid, .summary-grid, .ceph-grid, .form-grid, .photo-grid { grid-template-columns: 1fr 1fr; }
  .detail-aside, .form-aside { grid-template-columns: 1fr; }
  .preview-dock { flex-wrap: wrap; max-width: calc(100vw - 24px); justify-content: center; }
  .dock-hint { display: none; }
}
@media (max-height: 780px) {
  .page-viewport { padding-top: 18px; }
  .page-head { margin-bottom: 15px; }
  .kpi { min-height: 120px; }
}

}

/* ---------- Patient page v2 layout ---------- */
@scope (.ui-v2-page) {
  .patient-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 288px;
    gap: 11px;
    align-items: start;
  }
  .patient-main { min-width: 0; }
  .patient-aside { display: flex; flex-direction: column; gap: 11px; }
  .ui-v2-profile-details { margin-top: 14px; }
  .aside-stats .wide { grid-column: 1 / -1; }
  .patient-hero-actions { position: relative; }
  .v2-more-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 190px;
    padding: 5px;
    border-radius: 10px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    box-shadow: 0 18px 40px -18px rgba(0,0,0,.45);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .v2-more-menu[hidden] { display: none; }
  .v2-more-menu button {
    text-align: left;
    padding: 8px 9px;
    border-radius: 7px;
    border: none;
    background: none;
    color: var(--text-2);
    font-size: 10.5px;
    cursor: pointer;
  }
  .v2-more-menu button:hover { background: var(--surface-hover); color: var(--text); }
  .v2-more-menu button.danger { color: var(--rose); }
  .patient-meta .badge,
  .patient-meta .badge-clinic {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    color: var(--text-3) !important;
    font-size: 9.5px !important;
    font-weight: 500 !important;
  }
  .patient-name-row .badge-status {
    font-size: 8.5px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
    background: var(--accent-soft);
    color: var(--accent);
  }
  .patient-hero .avatar-lg { width: 64px; height: 64px; font-size: 20px; }
  .patient-hero .avatar { --a: var(--accent); --b: var(--accent-2); }
}

@media (max-width: 1100px) {
  .ui-v2-page .patient-body { grid-template-columns: 1fr; }
  .ui-v2-page .patient-aside { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .ui-v2-page .patient-aside { grid-template-columns: 1fr; }
}

/* ---------- Tab glider (two rows) ---------- */
.tabs.ui-tabs .ui-tab-row { position: relative; }
.tabs.ui-tabs .ui-tab-glider {
  position: absolute;
  top: 0;
  left: 0;
  height: 36px;
  border-radius: 8px;
  background: var(--ui-accent-soft);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 22%, transparent);
  z-index: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.22,1,.36,1), width .32s cubic-bezier(.22,1,.36,1), opacity .18s ease;
}
.tabs.ui-tabs .tab { position: relative; z-index: 1; background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.tabs.ui-tabs .tab.active { background: transparent !important; border-color: transparent !important; color: var(--ui-accent); }
.tabs.ui-tabs .tab.active::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--ui-accent), var(--ui-accent-2));
  transform-origin: left;
  animation: uiTabLine .32s cubic-bezier(.22,1,.36,1) both;
}
@keyframes uiTabLine { from { transform: scaleX(.2); opacity: .4; } to { transform: scaleX(1); opacity: 1; } }

/* ---------- Theme flash (matches the approved preview) ---------- */
.theme-flash {
  position: fixed;
  z-index: 300;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  transform: translate(-50%, -50%) scale(0);
  opacity: .35;
  pointer-events: none;
  animation: themeFlash .7s ease-out forwards;
}
@keyframes themeFlash { to { transform: translate(-50%, -50%) scale(90); opacity: 0; } }
html[data-motion="off"] .theme-flash { display: none; }

/* ---------- Patient page shell ---------- */
body.ui-patient-detail .ui-topbar { display: none; }
body.ui-patient-detail .tabs.ui-tabs { top: 0; }
body.ui-patient-detail .page-viewport { padding-top: 18px; }

/* ---------- Motion settings ---------- */
html[data-motion="subtle"] .tabs.ui-tabs .ui-tab-glider { transition-duration: .18s; }
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation-duration: .001ms !important;
  animation-delay: 0ms !important;
  transition-duration: .001ms !important;
}

/* ---------- Settings + mobile entry ---------- */
.v2-mobile-entry {
  max-width: 720px;
  width: min(720px, 92vw);
}
.v2-mobile-entry[data-mode="apk"],
.v2-mobile-entry[data-mode="pair"] {
  max-width: 440px;
  width: min(440px, 92vw);
}
.v2-scan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.v2-scan-grid.v2-scan-grid--single {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}
.v2-scan-grid.v2-scan-grid--single .v2-scan-card {
  width: 100%;
  max-width: 360px;
}
.v2-scan-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
  text-align: center;
}
.v2-scan-card h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.v2-scan-card p {
  margin: 8px 0 0;
  font-size: 9.5px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.45;
}
.v2-scan-card small { display: block; margin-top: 4px; font-size: 8.5px; color: var(--text-muted); }
.v2-qr-wrap {
  position: relative;
  width: 196px;
  height: 196px;
  margin: 0 auto;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--ui-border);
  overflow: hidden;
}
.v2-qr-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.v2-scan-line {
  position: absolute;
  left: 12px; right: 12px; top: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--ui-accent), transparent);
  box-shadow: 0 0 12px var(--ui-accent);
  animation: v2Scan 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes v2Scan {
  0%, 100% { transform: translateY(0); opacity: .25; }
  50% { transform: translateY(168px); opacity: 1; }
}
.v2-scan-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ui-accent-soft);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 18%, transparent);
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.v2-scan-note .status-dot { margin-top: 3px; }
@media (max-width: 640px) {
  .v2-scan-grid { grid-template-columns: 1fr; }
}

.v2-mobile-entry .modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.v2-mobile-entry .btn-close {
  position: static;
  margin-left: auto;
  flex: none;
}

/* ---------- Compact density for v2 pages ---------- */
body.compact .ui-v2-page .data-table tbody td { padding-top: 8px; padding-bottom: 8px; }
body.compact .ui-v2-page .schedule-row,
body.compact .ui-v2-page .recent-row { padding-top: 5px; padding-bottom: 5px; }
body.compact .ui-v2-page .kpi { min-height: 108px; padding-top: 12px; }
body.compact .ui-v2-page .page-head { margin-bottom: 14px; }
body.compact .ui-v2-page .card-head { padding-top: 12px; padding-bottom: 9px; }

/* ============================================================================
   Clinic manager modal — preview language + entrance animation
   ========================================================================== */
#clinicManagerModal {
  background: rgba(8, 14, 22, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: clinicOverlayIn .2s ease both;
}
#clinicManagerModal .clinic-modal {
  width: min(620px, 92vw);
  max-width: 620px;
  border-radius: 18px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  box-shadow: 0 40px 90px -40px rgba(8, 14, 22, 0.55);
  overflow: hidden;
  animation: clinicModalIn .32s cubic-bezier(.22, 1, .36, 1) both;
}
#clinicManagerModal .clinic-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--ui-border);
  background:
    radial-gradient(340px 150px at 0% 0%, var(--ui-accent-soft), transparent 70%),
    var(--ui-surface);
}
#clinicManagerModal .clinic-modal-copy .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ui-accent);
  margin-bottom: 5px;
}
#clinicManagerModal .clinic-modal-copy h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.02em;
  color: var(--ui-text);
}
#clinicManagerModal .clinic-modal-copy p {
  margin: 5px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ui-text-2);
}
#clinicManagerModal .btn-close {
  position: static;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
  color: var(--ui-text-2);
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
#clinicManagerModal .btn-close:hover {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}
#clinicManagerModal .modal-body { padding: 18px 22px 8px; }
#clinicManagerModal .clinic-add-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
#clinicManagerModal .clinic-add-field {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
  padding: 0 12px;
}
#clinicManagerModal .clinic-add-field:focus-within {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
}
#clinicManagerModal .clinic-add-field svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--ui-text-3);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#clinicManagerModal .clinic-add-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ui-text);
  font-size: 11.5px;
}
#clinicManagerModal .clinic-add-field input::placeholder { color: var(--ui-text-3); }
#clinicManagerModal #btnAddClinicSubmit {
  height: 40px;
  border-radius: 11px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  white-space: nowrap;
}
#clinicManagerModal #btnAddClinicSubmit svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
#clinicManagerModal .clinic-color-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
}
#clinicManagerModal .clinic-color-label {
  flex: none;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ui-text-3);
}
#clinicManagerModal .clinic-color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
#clinicManagerModal .clinic-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--clinic-color);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--clinic-color) 55%, transparent);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
#clinicManagerModal .clinic-color-swatch:hover { transform: scale(1.14); }
#clinicManagerModal .clinic-color-swatch.selected {
  border-color: var(--ui-surface);
  box-shadow: 0 0 0 2px var(--clinic-color), 0 0 0 4px var(--ui-surface);
  transform: scale(1.12);
}
#clinicManagerModal .clinic-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--clinic-color);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--clinic-color) 45%, transparent);
}
#clinicManagerModal .clinic-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ui-text-3);
}
#clinicManagerModal .clinic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
}
#clinicManagerModal .clinic-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
  animation: clinicItemIn .28s cubic-bezier(.22, 1, .36, 1) both;
}
#clinicManagerModal .clinic-item:hover {
  border-color: color-mix(in srgb, var(--ui-accent) 30%, transparent);
  background: var(--ui-surface);
  transform: translateY(-1px);
}
#clinicManagerModal .clinic-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ui-accent-soft);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 20%, transparent);
  font-size: 13px;
  flex: none;
}
#clinicManagerModal .clinic-item-name {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ui-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#clinicManagerModal .clinic-item-tag {
  flex: none;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ui-accent);
  background: var(--ui-accent-soft);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 20%, transparent);
  border-radius: 999px;
  padding: 2px 7px;
}
#clinicManagerModal .btn-delete-clinic {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-text-3);
  cursor: pointer;
  font-size: 10px;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
#clinicManagerModal .btn-delete-clinic:hover {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}
#clinicManagerModal .clinic-item-empty {
  padding: 22px 14px;
  text-align: center;
  font-size: 10.5px;
  color: var(--ui-text-3);
  border: 1px dashed var(--ui-border);
  border-radius: 11px;
}
#clinicManagerModal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
}
@keyframes clinicOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes clinicModalIn {
  from { opacity: 0; transform: translateY(14px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes clinicItemIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
html[data-motion="off"] #clinicManagerModal,
html[data-motion="off"] #clinicManagerModal .clinic-modal,
html[data-motion="off"] #clinicManagerModal .clinic-item { animation: none; }

/* Mobile sync channel tiles: white in Porcelain, theme surface in dark modes. */
html[data-direction="porcelain"] .sync-channel { background: #FFFFFF; }
html[data-direction="porcelain"] .sync-channel .btn { background: #FFFFFF; }
html[data-direction="porcelain"] #page-mobile-sync .data-table thead tr,
html[data-direction="porcelain"] #page-mobile-sync .data-table thead th {
  background: #FFFFFF !important;
}
