/* ===== Tokens ===== */
:root {
  --deep: #0E3B43;
  --deep-2: #0A2F35;
  --teal: #0F7A73;
  --teal-hover: #0B665F;
  --mint: #D8F0EC;
  --mint-2: #EDF8F6;
  --bg: #F5F8F8;
  --surface: #FFFFFF;
  --ink: #10282D;
  --muted: #5A7075;
  --line: #DCE5E5;
  --line-strong: #C5D3D3;
  --amber: #B7791F;
  --amber-bg: #FDF3E1;
  --danger: #B93C30;
  --danger-bg: #FBECEA;
  --ok: #1E7A4C;
  --ok-bg: #E4F4EA;
  --blue: #2F7FC1;
  --violet: #6D55C4;
  --focus: 0 0 0 3px rgba(15, 122, 115, .28);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 40, 45, .06), 0 8px 24px -12px rgba(16, 40, 45, .18);
  --font-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --p-filling: #2F7FC1;
  --p-root_canal: #D58A1C;
  --p-crown: #6D55C4;
  --p-extraction: #C0473B;
  color-scheme: light;
}
[data-theme="dark"] {
  --deep: #0A2328;
  --deep-2: #071A1E;
  --teal: #37B5A9;
  --teal-hover: #4BC7BB;
  --mint: #12332F;
  --mint-2: #0F2A27;
  --bg: #0B181B;
  --surface: #102226;
  --ink: #E2EDED;
  --muted: #92A9AD;
  --line: #1E383D;
  --line-strong: #2B4A50;
  --amber: #E9B35C;
  --amber-bg: #2E2413;
  --danger: #EE7D71;
  --danger-bg: #351A17;
  --ok: #5ECB92;
  --ok-bg: #12301F;
  --focus: 0 0 0 3px rgba(55, 181, 169, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -.01em; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3 { letter-spacing: 0; }
p { margin: 0; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
.i { flex: none; }
[dir="rtl"] .flip { transform: scaleX(-1); }
[dir="ltr"] .flip-back { transform: scaleX(-1); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
[data-theme="light"] .show-dark, [data-theme="dark"] .show-light { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 500; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal); color: #fff; }
[data-theme="dark"] .btn-primary { color: #04201D; }
.btn-primary:hover { background: var(--teal-hover); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--mint-2); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; cursor: pointer; color: inherit;
}
.icon-btn:hover { background: var(--mint-2); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--teal); cursor: pointer; padding: 4px 0; font-size: 13.5px; font-weight: 500; }
.lang-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; font-size: 14px; padding: 8px 10px; border-radius: 10px; }
.lang-link:hover { background: var(--mint-2); text-decoration: none; }

/* ===== Brand ===== */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--deep); color: var(--mint); }
[data-theme="dark"] .brand-mark { background: var(--mint); color: var(--teal); }
.brand-light { color: #fff; }
.brand-light .brand-mark { background: rgba(255, 255, 255, .1); color: #BFE9E3; }

/* ===== Forms ===== */
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 500; font-size: 14px; padding: 0; }
.opt { color: var(--muted); font-weight: 400; }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); opacity: .7; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
.input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
[dir="rtl"] .input[dir="ltr"] { text-align: right; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; padding-inline-end: 36px; }
[dir="rtl"] .select { background-position: 15px 50%, 20px 50%; }
.has-error .input { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 46px; }
.input-icon { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.input-icon:hover, .input-icon.is-on { color: var(--teal); }
.input-row { display: flex; gap: 10px; }
.grow { flex: 1; }
.strength { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.strength-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }
.strength[data-level="1"] i { width: 25%; }
.strength[data-level="2"] i { width: 50%; background: var(--amber); }
.strength[data-level="3"] i { width: 75%; background: var(--teal); }
.strength[data-level="4"] i { width: 100%; background: var(--ok); }
.strength em { font-style: normal; min-width: 52px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--teal); }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-track { flex: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background .2s; margin-top: 2px; }
.switch-track i { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track i { inset-inline-start: 21px; }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-text { display: flex; flex-direction: column; }
.switch-text small { color: var(--muted); font-size: 13px; }

.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-card { position: relative; cursor: pointer; }
.role-card input { position: absolute; opacity: 0; }
.role-card-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; height: 100%; transition: border-color .15s, background .15s; }
.role-card-body small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.role-card input:checked + .role-card-body { border-color: var(--teal); background: var(--mint-2); box-shadow: inset 0 0 0 1px var(--teal); }
.role-card input:focus-visible + .role-card-body { box-shadow: var(--focus); }
.role-card input:disabled + .role-card-body { opacity: .6; cursor: not-allowed; }

/* ===== Toasts ===== */
.toasts { position: fixed; z-index: 100; inset-block-end: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100% - 40px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 12px; background: var(--deep); color: #fff; box-shadow: var(--shadow); font-size: 14.5px; animation: toast-in .25s ease-out; }
[dir="rtl"] .toast { padding: 12px 16px 12px 12px; }
.toast span { flex: 1; }
.toast-error { background: var(--danger); }
.toast-close { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; display: grid; place-items: center; padding: 4px; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ===== Public site ===== */
.site-body { background: var(--surface); }
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header-row { display: flex; align-items: center; gap: 24px; height: 68px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--muted); font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover { color: var(--ink); background: var(--mint-2); text-decoration: none; }
.site-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.hero { padding: 64px 0 72px; background: linear-gradient(var(--mint-2), var(--surface) 70%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.hero-title { font-size: clamp(34px, 4.6vw, 54px); font-weight: 700; line-height: 1.12; color: var(--deep); max-width: 14em; }
[data-theme="dark"] .hero-title { color: var(--ink); }
[lang="ar"] .hero-title { line-height: 1.3; }
.hero-sub { margin-top: 20px; font-size: 18px; color: var(--muted); max-width: 34em; line-height: 1.7; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero-note { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 14px; }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px 20px; box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-caption { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--teal); }
.arch { width: 100%; max-width: 380px; margin: 4px auto 0; overflow: visible; }
.arch-static { width: 100%; max-width: 280px; }
.tooth rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; transition: fill .15s, stroke .15s; }
.arch .tooth { cursor: pointer; outline: none; }
.arch .tooth:hover rect, .arch .tooth:focus-visible rect { stroke: var(--teal); stroke-width: 2.2; }
.tooth[data-state] rect { stroke: transparent; }
.tooth[data-state="filling"] rect { fill: var(--p-filling); }
.tooth[data-state="root_canal"] rect { fill: var(--p-root_canal); }
.tooth[data-state="crown"] rect { fill: var(--p-crown); }
.tooth[data-state="extraction"] rect { fill: var(--p-extraction); }
@keyframes bump { 50% { transform: scale(1.18); } }
.arch-label { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.arch-total-label { font-size: 12px; fill: var(--muted); font-family: var(--font-body); }
.arch-total { font-size: 30px; font-weight: 700; fill: var(--deep); font-family: var(--font-display); }
[data-theme="dark"] .arch-total { fill: var(--ink); }
.arch-static .tooth rect { fill: rgba(255,255,255,.06); stroke: rgba(191, 233, 227, .35); }
.arch-static .tooth[data-state] rect { stroke: transparent; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; }
.legend-chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--p-filling); }
.legend-chip[data-proc="root_canal"] i { background: var(--p-root_canal); }
.legend-chip[data-proc="crown"] i { background: var(--p-crown); }
.legend-chip[data-proc="extraction"] i { background: var(--p-extraction); }
.chart-plan { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.plan-items { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.plan-items li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.plan-items li i { width: 8px; height: 8px; border-radius: 50%; }
.plan-items .plan-price { font-variant-numeric: tabular-nums; color: var(--muted); }
.plan-items .plan-empty { display: block; color: var(--muted); }
.plan-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-weight: 500; }
.plan-total strong { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.chart-foot { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--mint-2); font-size: 13.5px; color: var(--ink); }
.chart-foot .i { margin-top: 3px; color: var(--teal); }
.chart-foot span { flex: 1; }
.demo-tag { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; margin-top: 2px; }

.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(26px, 3vw, 36px); color: var(--deep); }
[data-theme="dark"] .section-head h2 { color: var(--ink); }
.section-head p { margin-top: 12px; color: var(--muted); font-size: 17px; }
.features { padding: 88px 0; background: var(--bg); }
.feature-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 32px; align-items: start; }
.feature-lead { background: var(--deep); color: #E3F1EF; border-radius: 20px; padding: 32px; position: sticky; top: 92px; }
.feature-lead h3 { font-size: 24px; margin-top: 18px; color: #fff; }
.feature-lead p { margin-top: 10px; color: #B8D4D0; line-height: 1.7; }
.feature-lead .feature-icon { background: rgba(255,255,255,.1); color: #BFE9E3; }
.feature-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--mint); color: var(--teal); flex: none; }
.wa-mock { margin-top: 28px; padding: 18px; border-radius: 16px; background: #E9E1D6; }
.wa-bubble { background: #fff; color: #1B2B2E; border-radius: 12px; border-start-start-radius: 4px; padding: 12px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; max-width: 290px; box-shadow: 0 1px 1px rgba(0,0,0,.1); }
.wa-bubble b { color: #0F7A73; font-size: 13px; }
.wa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #E5E5E5; color: #0B7A6E; font-weight: 600; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
.feature { display: flex; gap: 14px; }
.feature h3 { font-size: 17px; }
.feature p { margin-top: 6px; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

.pricing { padding: 88px 0 96px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.plan.is-featured { border: 2px solid var(--teal); box-shadow: var(--shadow); }
.plan-badge { position: absolute; top: -13px; inset-inline-start: 24px; background: var(--teal); color: #fff; font-size: 12.5px; font-weight: 600; padding: 3px 12px; border-radius: 20px; }
[data-theme="dark"] .plan-badge { color: #04201D; }
.plan h3 { font-size: 20px; }
.plan-desc { color: var(--muted); font-size: 14.5px; margin-top: -8px; }
.plan-price { display: flex; align-items: baseline; gap: 8px; }
.plan-price strong { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--deep); line-height: 1; }
[data-theme="dark"] .plan-price strong { color: var(--ink); }
.plan-price span { color: var(--muted); font-size: 14px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.plan-features li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.plan-features .i { color: var(--teal); margin-top: 4px; }
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; background: var(--surface); }
.site-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* ===== Auth ===== */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); min-height: 100vh; }
.auth-main { display: flex; flex-direction: column; padding: 24px clamp(20px, 5vw, 64px) 40px; background: var(--surface); }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-form { width: 100%; max-width: 440px; margin: auto; padding-block: 40px; }
.auth-title { font-size: 28px; color: var(--deep); }
[data-theme="dark"] .auth-title { color: var(--ink); }
.auth-sub { color: var(--muted); margin: 6px 0 28px; }
.auth-form .alert { margin-bottom: 18px; }
.auth-alt { margin-top: 24px; text-align: center; color: var(--muted); font-size: 14.5px; }
.auth-side { background: var(--deep); color: #E3F1EF; display: flex; align-items: center; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.auth-side-inner { max-width: 380px; }
.auth-side h2 { font-size: 28px; color: #fff; margin-top: 28px; line-height: 1.35; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 16px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: #C7DEDB; }
.auth-points .i { color: #7FD3C8; }

/* ===== App shell ===== */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; background: var(--deep); color: #CFE3E0; padding: 18px 14px 14px; overflow-y: auto; z-index: 50; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .08); }
.sidebar-close { display: none; }
.clinic-chip { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.clinic-chip-name { color: #fff; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clinic-chip-role { font-size: 12.5px; color: #8FB7B1; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin: 14px 12px 4px; font-size: 12px; color: #7FA6A0; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: #CFE3E0; font-size: 14.5px; font-weight: 500; position: relative; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(127, 211, 200, .14); color: #fff; }
.nav-item.is-active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #7FD3C8; }
[dir="rtl"] .nav-item.is-active::before { border-radius: 3px 0 0 3px; }
.nav-item.is-soon { color: #6F948F; cursor: default; }
.nav-item span { flex: 1; }
.soon { font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(255, 255, 255, .07); color: #8FB7B1; }
.sidebar-user { display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border-radius: 10px; color: #fff; }
.me:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.me-text b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: #8FB7B1; font-size: 12px; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.search-trigger { display: flex; align-items: center; gap: 10px; width: min(380px, 100%); height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 14px; }
.search-trigger span { flex: 1; text-align: start; }
.search-trigger:hover { border-color: var(--line-strong); }
kbd { font-family: inherit; font-size: 11.5px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted); direction: ltr; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.content { padding: 28px; width: 100%; max-width: 1200px; }

/* ===== App content ===== */
.page-title { font-size: 26px; color: var(--ink); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2, .panel-title { font-size: 17px; }

.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-head .muted { margin-top: 2px; }
.trial-chip { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); font-size: 14px; font-weight: 500; }
[dir="rtl"] .trial-chip { padding: 8px 14px 8px 8px; }
.trial-chip a { background: var(--surface); color: var(--ink); padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.trial-chip a:hover { text-decoration: none; background: var(--bg); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 18px 22px; }
.kpi + .kpi { border-inline-start: 1px solid var(--line); }
.kpi-label { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value.is-empty { color: var(--line-strong); }
.kpi-hint { font-size: 12.5px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-areas: "setup activity" "setup quick"; gap: 20px; align-items: start; }
.setup { grid-area: setup; }
.activity { grid-area: activity; }
.quick { grid-area: quick; }
.ring { width: 52px; height: 52px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring-track { stroke: var(--line); }
.ring-fill { stroke: var(--teal); stroke-linecap: round; transition: stroke-dasharray .6s ease-out; }
.ring text { transform: rotate(90deg); transform-origin: 22px 22px; font-size: 11px; font-weight: 600; fill: var(--ink); font-family: var(--font-body); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.check-item:first-child { border-top: 0; }
.check-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px dashed var(--line-strong); display: grid; place-items: center; color: #fff; }
.check-item.is-done .check-dot { background: var(--teal); border: 0; }
[data-theme="dark"] .check-item.is-done .check-dot { color: #04201D; }
.check-item.is-done .check-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.check-item.is-soon .check-text { color: var(--muted); }
.check-text { flex: 1; }
.check-link { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-weight: 500; }
.check-link:hover { color: var(--teal); text-decoration: none; }
.check-item .soon { background: var(--bg); color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.feed li { display: flex; gap: 12px; align-items: flex-start; }
.feed p { font-size: 14px; line-height: 1.5; }
.feed time { font-size: 12.5px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; }
.quick-list { display: flex; flex-direction: column; gap: 4px; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; font-size: 14.5px; }
.quick-item .i { color: var(--teal); }
.quick-item:hover { background: var(--mint-2); text-decoration: none; }
.kbd-hint { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.avatar { --h: 170; width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: hsl(var(--h) 45% 26%); background: hsl(var(--h) 55% 88%); font-family: var(--font-body); }
[data-theme="dark"] .avatar { color: hsl(var(--h) 55% 85%); background: hsl(var(--h) 30% 24%); }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; font-weight: 500; font-size: 13px; color: var(--muted); padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.table td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-muted td { opacity: .6; }
.row-action { text-align: end; }
.person { display: flex; align-items: center; gap: 12px; }
.person div { display: flex; flex-direction: column; min-width: 0; }
.person small { color: var(--muted); font-size: 13px; text-align: start; }
.you { font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 10px; background: var(--mint); color: var(--teal); margin-inline-start: 4px; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); }
.pill-owner { background: var(--deep); color: #fff; border-color: transparent; }
[data-theme="dark"] .pill-owner { background: var(--mint); color: var(--teal); }
.pill-doctor { background: var(--mint); color: var(--teal); border-color: transparent; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status.is-on::before { background: var(--ok); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.side-panel { position: sticky; top: 84px; }
.settings-form { display: flex; flex-direction: column; gap: 20px; max-width: 880px; }
.settings-section .panel-title { margin-bottom: 18px; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }

.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.error-code { font-family: var(--font-display); font-size: 88px; font-weight: 700; color: var(--mint); line-height: 1; margin-top: 24px; -webkit-text-stroke: 2px var(--teal); }
.error-page h1 { font-size: 26px; }
.error-page .btn { margin-top: 10px; }

/* ===== Command palette ===== */
.cmdk { position: fixed; inset: 0; z-index: 90; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.cmdk[hidden] { display: none; }
.cmdk-backdrop { position: absolute; inset: 0; background: rgba(6, 22, 25, .45); backdrop-filter: blur(2px); }
.cmdk-panel { position: relative; width: min(560px, 100%); background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); border: 1px solid var(--line); overflow: hidden; animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.cmdk-search { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-search input { flex: 1; height: 56px; border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: 8px; max-height: 340px; overflow-y: auto; }
.cmdk-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.cmdk-list li .i { color: var(--muted); }
.cmdk-list li[aria-selected="true"] { background: var(--mint-2); color: var(--teal); }
.cmdk-list li[aria-selected="true"] .i { color: var(--teal); }
.cmdk-empty { padding: 20px; text-align: center; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "setup" "activity" "quick"; }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; }
  .feature-layout { grid-template-columns: minmax(0, 1fr); }
  .feature-lead { position: static; }
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .plans { grid-template-columns: minmax(0, 1fr); max-width: 460px; margin-inline: auto; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-inline-start: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(6, 22, 25, .45); z-index: 40; }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 40px; }
}
@media (max-width: 720px) {
  .site-nav, .hide-sm { display: none; }
  .site-header-row { gap: 12px; }
  .hero { padding: 40px 0 56px; }
  .hero-sub { font-size: 16.5px; }
  .hero-cta .btn { flex: 1; }
  .feature-list { grid-template-columns: minmax(0, 1fr); }
  .features, .pricing { padding: 64px 0; }
  .grid-2, .grid-3, .role-grid { grid-template-columns: minmax(0, 1fr); }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .lang-link span { display: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 4px 0; border: 0; }
  .table td[data-label]:not(:first-child)::before { content: attr(data-label); display: inline-block; min-width: 110px; color: var(--muted); font-size: 13px; }
  .row-action { text-align: start; padding-top: 8px !important; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 26px; }
  .page-title { font-size: 22px; }
  .input-row { flex-direction: column; }
  .toasts { inset-inline: 16px; max-width: none; }
}
.form-layout > :only-child { grid-column: 1 / -1; max-width: 760px; }

/* ===== Phase 2: patients & appointments ===== */
:root { --st-scheduled: #5A7075; --st-confirmed: #2F7FC1; --st-arrived: #B7791F; --st-completed: #1E7A4C; --st-cancelled: #8A9A9D; --st-no_show: #B93C30; }
[data-theme="dark"] { --st-scheduled: #92A9AD; --st-confirmed: #6FB0E8; --st-arrived: #E9B35C; --st-completed: #5ECB92; --st-cancelled: #6B8286; --st-no_show: #EE7D71; }
textarea.input { min-height: 0; resize: vertical; line-height: 1.6; }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: 14px; width: auto; }
.select.input-sm { padding-inline-end: 32px; }
.center { text-align: center; justify-content: center; }
.hint-top { margin: -10px 0 16px; }
.prewrap { white-space: pre-wrap; }
.inline-form { display: inline; margin: 0; }
.dash-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 20px; white-space: nowrap; color: var(--st, var(--st-scheduled)); background: color-mix(in srgb, var(--st, var(--st-scheduled)) 12%, transparent); }
.st-scheduled { --st: var(--st-scheduled); } .st-confirmed { --st: var(--st-confirmed); } .st-arrived { --st: var(--st-arrived); }
.st-completed { --st: var(--st-completed); } .st-cancelled { --st: var(--st-cancelled); } .st-no_show { --st: var(--st-no_show); }
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.alerts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); }
.alerts.is-compact { padding: 8px 10px; margin: 12px 0 0; }
.alert-chip { font-size: 13px; font-weight: 500; padding: 2px 10px; border-radius: 20px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-dot { display: inline-flex; vertical-align: middle; color: var(--danger); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--amber-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); margin-bottom: 16px; font-size: 14.5px; }
.notice p { margin: 4px 0 10px; }
.notice.is-muted { background: var(--bg); border-color: var(--line); color: var(--muted); }
.notice.is-warn .i { color: var(--amber); margin-top: 3px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field > .i { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field .input { padding-inline-start: 40px; }
.filters .select { width: auto; min-width: 180px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); gap: 2px; }
.seg a, .seg label span { display: block; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.is-on, .seg input:checked + span { background: var(--mint); color: var(--teal); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.seg-input { align-self: flex-start; }
.chips-input { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-input label { position: relative; cursor: pointer; }
.chips-input input { position: absolute; opacity: 0; }
.chips-input span { display: inline-block; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line-strong); font-size: 14px; transition: .15s; }
.chips-input input:checked + span { background: var(--mint); border-color: var(--teal); color: var(--teal); font-weight: 500; }
.chips-input input:focus-visible + span { box-shadow: var(--focus); }
.row-link:hover td { background: var(--mint-2); }
a.person { color: var(--ink); }
a.person:hover { text-decoration: none; }
a.person:hover b { color: var(--teal); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.empty-state { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.empty-state h2 { font-size: 19px; margin-top: 14px; }
.empty-state p { max-width: 420px; margin: 8px auto 0; }
.empty-state .form-actions { margin-top: 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--mint); color: var(--teal); }

.patient-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 6px 0 16px; }
.patient-id { display: flex; gap: 16px; align-items: flex-start; }
.patient-id .muted { margin-top: 2px; }
.contact-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn.wa:hover { border-color: #1FA855; color: #1A8F48; }
.patient-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-row div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; }
.stat-row strong { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.stat-row span { color: var(--muted); font-size: 13px; }
.appt-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; }
.appt-list a { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; padding: 11px 8px; border-top: 1px solid var(--line); color: var(--ink); border-radius: 8px; }
.appt-list li:first-child a { border-top: 0; }
.appt-list a:hover { background: var(--mint-2); text-decoration: none; }
.appt-when, .appt-what { display: flex; flex-direction: column; line-height: 1.4; }
.appt-when small, .appt-what small { color: var(--muted); font-size: 12.5px; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 14px 0 0; font-size: 14.5px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.queue { list-style: none; margin: 0; padding: 0; }
.queue-item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.queue-item:first-child { border-top: 0; }
.queue-item.is-cancelled, .queue-item.is-no_show { opacity: .55; }
.queue-item.is-arrived { background: linear-gradient(90deg, color-mix(in srgb, var(--st-arrived) 8%, transparent), transparent); border-radius: 8px; }
.queue-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.queue-main { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.queue-main:hover { text-decoration: none; color: var(--teal); }
.queue-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-main small { color: var(--muted); font-size: 12.5px; }
.queue-act { min-width: 0; }
.dash-grid.is-staff { grid-template-areas: "setup quick"; }
.dash-grid .today { grid-area: setup; }
.dash-grid:not(.is-staff) { grid-template-areas: "setup activity" "checklist activity"; }
.dash-grid:not(.is-staff) .setup { grid-area: checklist; }

.picked { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.picked > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.picked small { color: var(--muted); font-size: 13px; text-align: start; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 10; inset-inline: 0; top: calc(100% + 6px); list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; }
.picker-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.picker-list li[aria-selected="true"], .picker-list li:hover { background: var(--mint-2); }
.picker-list li small { color: var(--muted); margin-inline-start: auto; font-size: 12.5px; }
.picker-list li.is-empty { cursor: default; color: var(--muted); }
.mode-pane { margin-top: 14px; }
.time-input { max-width: 220px; }
.free-slots { margin-top: 10px; }
.free-slots .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.slot-chips button:hover { border-color: var(--teal); color: var(--teal); }
.slot-chips button.is-on { background: var(--teal); color: #fff; border-color: var(--teal); }
.slot-chips p { color: var(--muted); font-size: 13.5px; }

.appt-card .picked { margin-top: 18px; }
.appt-top { display: flex; gap: 16px; align-items: flex-start; }
.appt-info { flex: 1; }
.appt-info p:last-child { margin-top: 4px; }
.appt-date { width: 64px; flex: none; text-align: center; border-radius: 14px; background: var(--deep); color: #fff; padding: 8px 0 10px; display: flex; flex-direction: column; }
[data-theme="dark"] .appt-date { background: var(--mint); color: var(--teal); }
.appt-date strong { font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.appt-date span { font-size: 12px; opacity: .8; }
.note-box { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--bg); font-size: 14.5px; }
.note-box p { margin-top: 4px; }
.appt-card .form-actions { margin-top: 18px; }
.status-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.status-actions .inline-form { display: block; }
.btn.is-danger { color: var(--danger); }
.btn.is-danger:hover { border-color: var(--danger); color: var(--danger); }
.wa-btn-solid { background: #1FA855; color: #fff; }
.wa-btn-solid:hover { background: #188C46; }
.side-panel .hint.center { margin-top: 8px; }

.cal-head { align-items: center; }
.cal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-nav { display: flex; align-items: center; gap: 2px; }
.btn.is-current { border-color: var(--teal); color: var(--teal); }
.cal-filter { display: flex; gap: 8px; }
.cal-hint { margin-bottom: 12px; }
.cal { overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.cal-header, .cal-body { display: grid; grid-template-columns: 72px repeat(var(--cols), minmax(180px, 1fr)); min-width: calc(72px + var(--cols) * 180px); }
.cal-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 3; }
.cal-col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; font-size: 14px; border-inline-start: 1px solid var(--line); min-width: 0; }
.cal-col-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-col-head small { color: var(--muted); font-weight: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.cal-body { position: relative; }
.cal-gutter { position: relative; }
.cal-hour { position: absolute; inset-inline-end: 10px; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cal-hour:first-child { transform: none; margin-top: 4px; }
.cal-col { position: relative; border-inline-start: 1px solid var(--line); }
.cal-slot { position: absolute; inset-inline: 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); display: flex; align-items: center; justify-content: center; color: transparent; }
.cal-slot.is-off { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 45%, transparent) 6px 7px); }
a.cal-slot:hover { background: var(--mint-2); color: var(--teal); text-decoration: none; }
.cal-appt { position: absolute; inset-inline: 4px; z-index: 2; display: flex; flex-direction: column; gap: 1px; overflow: hidden; padding: 5px 8px; border-radius: 8px; font-size: 12.5px; line-height: 1.35; color: var(--ink); background: color-mix(in srgb, var(--st) 14%, var(--surface)); border-inline-start: 3px solid var(--st); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.cal-appt:hover { text-decoration: none; filter: brightness(.97); z-index: 4; }
.cal-appt b { font-size: 13px; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt b .i { color: var(--danger); }
.cal-appt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt.st-cancelled, .cal-appt.st-no_show { opacity: .6; }
.cal-appt.st-cancelled b { text-decoration: line-through; }
.cal-now { position: absolute; inset-inline: 72px 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

@media (max-width: 1080px) {
  .dash-grid.is-staff { grid-template-areas: "setup" "quick"; }
  .dash-grid:not(.is-staff) { grid-template-areas: "setup" "checklist" "activity"; }
}
@media (max-width: 720px) {
  .queue-item { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .queue-act { grid-column: 2 / -1; }
  .appt-list a { grid-template-columns: 1fr auto; }
  .appt-what { grid-column: 1; grid-row: 2; }
  .stat-row div { padding: 10px 12px; }
  .filters .select { flex: 1; }
  .cal-tools { width: 100%; }
  .cal-filter { flex: 1; }
  .cal-filter .input { flex: 1; }
  .patient-actions .btn { flex: 1; }
}
.cmdk-hint { margin-inline-start: auto; color: var(--muted); font-size: 12.5px; }
.cmdk-list li span { flex: 1; }
[hidden] { display: none !important; }
.cal-col-head span { flex: initial; }
.cal-col-head > span:not(.avatar) { flex: 1; }
.panel > .panel-title + p, .panel > .panel-title + .prewrap { margin-top: 10px; }
@media (max-width: 960px) {
  .sidebar { box-shadow: none; }
  .nav-open .sidebar { box-shadow: 0 0 40px rgba(0,0,0,.3); }
}
.dash-grid:not(.is-staff) { grid-template-rows: auto 1fr; }
@media (max-width: 1080px) { .dash-grid:not(.is-staff) { grid-template-rows: none; } }

/* ===== Phase 3: dental chart & treatment plans ===== */
:root { --c-caries: #D2453A; --c-filling: #2F7FC1; --c-crown: #6D55C4; --c-planned: #E8A33D; --c-done: #1E7A4C; }
[data-theme="dark"] { --c-caries: #EE6B5F; --c-filling: #5EA6E6; --c-crown: #9A85EA; --c-planned: #F0B85C; --c-done: #5ECB92; }
.pstat { display: inline-block; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 20px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.ps-presented { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.ps-accepted { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); border-color: transparent; }
.ps-in_progress { background: var(--mint); color: var(--teal); border-color: transparent; }
.ps-completed { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.ps-declined { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.mini-progress { display: block; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; min-width: 90px; margin: 4px 0; }
.mini-progress.lg { height: 8px; margin: 8px 0 6px; }
.mini-progress.inline { display: inline-block; width: 90px; vertical-align: middle; }
.mini-progress span { display: block; height: 100%; background: var(--c-done); border-radius: 6px; }
.t-chip { display: inline-grid; place-items: center; min-width: 32px; height: 24px; padding: 0 6px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 500; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-on { color: var(--teal); border-bottom-color: var(--teal); }
.tabs b { font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; }
.tabs a.is-on b { background: var(--mint); border-color: transparent; }

.chart-app.is-busy { cursor: progress; }
.chart-app.is-busy .tooth-panel, .chart-app.is-busy .plan-panel { opacity: .7; pointer-events: none; }
.odo-card { margin-bottom: 20px; }
.odo-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.odo-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.odo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-caries { background: var(--c-caries); } .lg-filling { background: var(--c-filling); }
.lg-crown { border: 2.5px solid var(--c-crown); } .lg-planned { background: var(--c-planned); } .lg-done { background: var(--c-done); border-radius: 50%; }
.odo-scroll { overflow-x: auto; padding-bottom: 4px; }
.odo { min-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 0; user-select: none; }
.odo-sides { width: 100%; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.odo-row { display: flex; align-items: stretch; justify-content: center; }
.odo-half { display: flex; gap: 3px; }
.odo-mid { width: 2px; background: var(--line-strong); margin: 0 10px; border-radius: 2px; }
.odo-occlusal { width: 100%; display: flex; flex-direction: column; align-items: center; margin: 6px 0; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 2px; }
.odo-occlusal span:first-child { margin-top: -20px; background: var(--surface); padding: 0 8px; display: none; }
.odo-occlusal span { display: none; }
.tb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 42px; padding: 4px 1px; border: 1.5px solid transparent; border-radius: 10px; background: none; cursor: pointer; color: var(--ink); transition: background .12s, border-color .12s; }
.tb:hover { background: var(--mint-2); }
.tb.is-sel { background: var(--mint); border-color: var(--teal); }
.tb svg { width: 34px; height: 34px; overflow: visible; }
.tb polygon, .tb rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.3; stroke-linejoin: round; }
.tb .sf-caries { fill: var(--c-caries); }
.tb .sf-filling { fill: var(--c-filling); }
.tb .sf-planned { fill: color-mix(in srgb, var(--c-planned) 55%, var(--surface)); }
.tb.has-crown svg { filter: drop-shadow(0 0 0 var(--c-crown)); }
.tb.has-crown polygon, .tb.has-crown rect { stroke: var(--c-crown); stroke-width: 2.6; }
.tb .x { stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.tb.is-missing polygon, .tb.is-missing rect { fill: var(--bg); stroke-dasharray: 2 2; }
.tb.is-missing .t-num { color: var(--muted); text-decoration: line-through; }
.t-num { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.t-tags { display: flex; gap: 2px; min-height: 13px; }
.t-tags i { font-style: normal; font-size: 8.5px; font-weight: 700; letter-spacing: .02em; padding: 1px 3px; border-radius: 4px; background: var(--deep); color: #fff; line-height: 1.2; }
.tb.has-plan .t-num { color: var(--c-planned); }
.t-badge { position: absolute; top: -4px; right: -3px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--c-planned); color: #fff; padding: 0 4px; box-shadow: 0 0 0 2px var(--surface); }
.t-badge.is-done { background: var(--c-done); }
.t-badge svg { width: 11px; height: 11px; }
.odo-hint { display: flex; align-items: center; gap: 6px; margin-top: 12px; }

.chart-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.tooth-panel .panel-title { margin-bottom: 4px; }
.tp-lead { margin-bottom: 14px; }
.tp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tp-teeth { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tp-teeth span { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--mint); color: var(--teal); }
.tp-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.tooth-panel > .tp-block:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.tp-block h3 { font-size: 14.5px; font-family: var(--font-body); font-weight: 600; }
.small-chips span { padding: 5px 12px; font-size: 13px; }
.surf-pick { display: flex; flex-direction: column; gap: 6px; }
.surf-row { display: flex; gap: 6px; flex-wrap: wrap; }
.surf-row label { position: relative; cursor: pointer; }
.surf-row input { position: absolute; opacity: 0; }
.surf-row span { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 10px; line-height: 1.2; }
.surf-row b { font-size: 15px; }
.surf-row small { font-size: 10.5px; color: var(--muted); text-align: center; }
.surf-row input:checked + span { border-color: var(--teal); background: var(--mint); color: var(--teal); }
.surf-row input:focus-visible + span { box-shadow: var(--focus); }
.grid-2.tight { gap: 10px; }
.finding-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.finding-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.finding-list li > span:nth-child(2) { flex: 1; }
.fdot { width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
.fd-caries { background: var(--c-caries); } .fd-filling { background: var(--c-filling); } .fd-crown { background: var(--c-crown); }
.fd-root_canal { background: var(--deep); } .fd-implant { background: var(--c-done); } .fd-fractured { background: var(--amber); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn.sm:hover { color: var(--ink); }
.icon-btn.sm.is-done { color: var(--c-done); }

.pp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-head .panel-title { flex: 1; }
.pp-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.pp-meta b { flex: 1; min-width: 0; }
.pp-phase { font-size: 12.5px; font-family: var(--font-body); font-weight: 600; color: var(--muted); margin: 16px 0 6px; }
.pp-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pp-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.pp-item:hover { border-color: var(--line-strong); }
.pp-item.is-done { background: var(--ok-bg); border-color: transparent; }
.pp-item.is-done .pp-name b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pp-name { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.pp-name b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.pp-name small { color: var(--muted); font-size: 12px; text-align: start; }
.pp-price { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.input-xs { width: 96px; min-height: 32px; padding: 4px 8px; font-size: 14px; }
.pp-acts { display: flex; gap: 2px; }
.pp-progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 18px 0 10px; }
.pp-progress span { display: block; height: 100%; background: var(--c-done); }
.pp-totals, .doc-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; font-size: 14px; }
.pp-totals dt, .doc-totals dt { color: var(--muted); }
.pp-totals dd, .doc-totals dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.pp-totals .grand, .doc-totals .grand { color: var(--ink); font-weight: 700; font-size: 17px; font-family: var(--font-display); padding-top: 6px; border-top: 1px solid var(--line); }
.plan-panel .hint { margin-top: 12px; }

.plan-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.plan-doc { padding: 28px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--deep); }
[data-theme="dark"] .doc-head { border-color: var(--line-strong); }
.doc-clinic { font-family: var(--font-display); font-weight: 600; font-size: 19px; }
.doc-title { font-size: 22px; margin-top: 18px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 12px 0 0; font-size: 14px; }
.doc-meta dt { color: var(--muted); font-size: 12.5px; }
.doc-meta dd { margin: 0; font-weight: 500; }
.approved-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 12px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); font-size: 13.5px; font-weight: 500; }
.doc-table { margin-top: 20px; }
.doc-table .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table .phase-row th { background: none; color: var(--teal); font-size: 13px; padding-top: 16px; border-bottom: 1px solid var(--line); }
.doc-table td { padding: 10px 16px; }
.item-st { font-size: 12.5px; color: var(--muted); }
.item-st.is-done { color: var(--ok); font-weight: 500; }
.item-st.is-cancelled { text-decoration: line-through; }
.doc-totals { max-width: 320px; margin: 18px 0 0 auto; }
[dir="rtl"] .doc-totals { margin: 18px auto 0 0; }
.signatures { display: none; }
.tight-stack { gap: 12px; }
.copy-row { display: flex; gap: 8px; margin-top: 12px; }
.copy-row .input { flex: 1; min-width: 0; }
.wide { max-width: none; }
.price-cat { padding: 16px 20px 0; }
.price-table td { padding: 8px 12px; }
.price-table .input-sm { width: 100%; }
.price-input { max-width: 140px; }
.add-proc { margin-top: 24px; max-width: 880px; }
.align-end { align-self: end; padding-bottom: 12px; }

/* public approval page */
.public-body { background: linear-gradient(var(--mint-2), var(--bg) 320px); }
.pub { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
.pub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.pub-head > div { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.pub-head b { font-family: var(--font-display); font-size: 17px; }
.pub-head small { color: var(--muted); }
.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; box-shadow: var(--shadow); }
.pub-card h1 { font-size: 22px; }
.pub-card > .muted { margin-top: 6px; }
.pub-items { list-style: none; margin: 20px 0 16px; padding: 0; display: flex; flex-direction: column; }
.pub-items li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pub-items .pub-phase { display: block; border: 0; padding: 14px 0 2px; font-size: 13px; font-weight: 600; color: var(--teal); }
.pub-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pub .doc-totals { max-width: none; margin: 8px 0 0; }
.pub-approve { margin-top: 24px; }
.pub-approve .hint { margin-top: 10px; }
.pub-done { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); font-weight: 500; }
.pub-call { margin-top: 16px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 24px; }

.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .toasts, .scrim, .cmdk { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .plan-layout { display: block; }
  .plan-doc { border: 0; padding: 0; box-shadow: none; }
  .print-only, .signatures { display: flex !important; }
  .signatures { justify-content: space-between; gap: 40px; margin-top: 60px; font-size: 13px; color: #555; }
  .signatures div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
  .signatures span { border-bottom: 1px solid #999; height: 36px; }
  .pstat { border: 1px solid #999; }
}

@media (max-width: 1080px) {
  .chart-cols, .plan-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .pp-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pp-item .input-xs, .pp-item .pp-price { grid-column: 2; }
  .pp-acts { grid-column: 3; grid-row: 1 / span 2; }
  .plan-doc { padding: 18px; }
  .doc-table .phase-row th { display: block; }
}
.t-badge { top: 15px; right: -5px; }
.pp-totals dd.grand, .doc-totals dd.grand, .pp-totals dt.grand, .doc-totals dt.grand { border-top: 1px solid var(--line); }
.done-btn { gap: 6px; background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); font-weight: 600; }
.done-btn:hover { background: var(--ok); color: #fff; }
.done-btn.is-undo { background: none; border-color: transparent; color: var(--muted); font-weight: 500; }
.done-btn.is-undo:hover { background: var(--bg); color: var(--ink); }
.pp-acts { align-items: center; gap: 4px; }
.pp-item { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tooth name price" "tooth acts acts"; row-gap: 6px; }
.pp-item > .t-chip { grid-area: tooth; }
.pp-item > .pp-name { grid-area: name; }
.pp-item > .input-xs, .pp-item > .pp-price { grid-area: price; }
.pp-item > .pp-acts { grid-area: acts; justify-content: flex-end; }
@media (max-width: 720px) {
  .pp-item .input-xs, .pp-item .pp-price { grid-column: auto; }
  .pp-acts { grid-column: auto; grid-row: auto; }
}

/* ===== Phase 4: billing ===== */
.kpi-value.money { font-size: 26px; }
.kpi.is-alert .kpi-value { color: var(--danger); }
.row-btns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.wa-text { color: #1A8F48; }
.wa-text:hover { background: #E6F6EC; }
.invoice-form { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.suggest-link { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--mint-2); color: var(--teal); font-weight: 500; font-size: 14px; }
.suggest-link span { flex: 1; }
.suggest-link:hover { text-decoration: none; background: var(--mint); }
.check-lines { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.check-lines label { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check-lines label:has(input:checked) { border-color: var(--teal); background: var(--mint-2); }
.check-lines input { width: 18px; height: 18px; accent-color: var(--teal); margin: 0; }
.cl-name small { color: var(--muted); }
.cl-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.done-tag { font-style: normal; font-size: 11.5px; color: var(--ok); background: var(--ok-bg); padding: 1px 8px; border-radius: 10px; margin-inline-start: 4px; }
.lines { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 8px; }
.line-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) 70px 110px auto; gap: 8px; align-items: center; }
.line-row .input-sm { width: 100%; }
.sum-card .doc-totals { max-width: none; margin: 12px 0 18px; }
.opt-switch { padding: 12px 0; border-top: 1px solid var(--line); }
.sub-box { padding: 0 0 14px; gap: 12px; }
.sum-card > .btn { margin-top: 8px; }
.notice.is-ok { background: var(--ok-bg); border-color: transparent; color: var(--ink); }
.notice.is-ok > .i { color: var(--ok); margin-top: 2px; }
.grow { flex: 1; }
.balance-row { color: var(--teal) !important; }
.doc-sub { font-size: 16px; margin-top: 26px; }
.inst-table { margin-top: 8px; }
.fully-paid { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; }
details.collapsible summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.collapsible summary::-webkit-details-marker { display: none; }
details.collapsible summary::after { content: "+"; font-size: 20px; color: var(--muted); }
details.collapsible[open] summary::after { content: "−"; }
details.collapsible[open] summary { margin-bottom: 14px; }
.pay-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.pay-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.pay-list li:first-child { border-top: 0; }
.pay-list li > div { flex: 1; display: flex; flex-direction: column; }
.pay-list small { color: var(--muted); font-size: 12.5px; }
.pay-list li.is-void b { text-decoration: line-through; color: var(--muted); }
.mini-list { list-style: none; margin: 10px 0 0; padding: 0; }
.mini-list a { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-top: 1px solid var(--line); color: var(--ink); border-radius: 6px; }
.mini-list li:first-child a { border-top: 0; }
.mini-list a:hover { background: var(--mint-2); text-decoration: none; }
.mini-list a > span:first-child { flex: 1; display: flex; flex-direction: column; }
.mini-list small { color: var(--muted); font-size: 12px; }
.ml-amt { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-size: 14px; }
.stat-row.has-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-row .is-due { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-bg); }
.stat-row .is-due strong { color: var(--amber); font-size: 20px; }
.stat-row .is-clear strong { color: var(--ok); }
.receipt-body { background: var(--bg); }
.receipt { max-width: 440px; margin: 0 auto; padding: 24px 16px; }
.receipt-actions { display: flex; justify-content: space-between; margin-bottom: 14px; }
.receipt-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px; text-align: center; }
.receipt-card header { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; border-bottom: 2px dashed var(--line-strong); }
.receipt-card header small { color: var(--muted); }
.receipt-card h1 { font-size: 18px; margin-top: 18px; }
.receipt-no { color: var(--muted); font-size: 13px; }
.receipt-amount { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--deep); margin: 14px 0 6px; }
[data-theme="dark"] .receipt-amount { color: var(--ink); }
.receipt-card .details { text-align: start; border-top: 1px solid var(--line); padding-top: 14px; }
.receipt-thanks { margin-top: 20px; padding-top: 14px; border-top: 2px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; }
@media print {
  .receipt { padding: 0; }
  .receipt-card { border: 0; }
  .receipt-amount { color: #000; }
}
@media (max-width: 1080px) { .invoice-form { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .line-row { grid-template-columns: minmax(0, 1fr) 70px 100px auto; }
  .line-row select { grid-column: 1 / -1; }
  .stat-row.has-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pay-list .pstat { align-self: flex-start; margin-top: 4px; }
@media (min-width: 961px) { .kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }

/* ===== Phase 5: reports ===== */
.export-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.period-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.period-seg { flex-wrap: wrap; }
.period-custom { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 4px; border-radius: 12px; }
.period-custom.is-on { background: var(--mint-2); }
.period-custom label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.kpis-6 .kpi-value { font-size: 24px; }
.kpi-accent { background: var(--mint-2); }
.kpi-accent .kpi-value { color: var(--teal); }
.chart-panel { margin-bottom: 20px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-top: 24px; direction: ltr; }
.bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar-fill { position: relative; width: 100%; max-width: 48px; min-height: 2px; border-radius: 6px 6px 2px 2px; background: var(--teal); transition: height .4s ease-out; }
.bar-fill.is-zero { background: var(--line); }
.bar-fill em { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar:hover .bar-fill { background: var(--teal-hover); }
.bars.is-dense { gap: 3px; }
.bars.is-dense .bar-fill em { display: none; }
.bars.is-dense .bar:hover .bar-fill em { display: block; z-index: 2; background: var(--surface); padding: 1px 4px; border-radius: 4px; box-shadow: var(--shadow); color: var(--ink); }
.bars.is-dense .bar:nth-child(even) small { visibility: hidden; }
.table-note { padding: 10px 20px 14px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.hbar-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbar-list li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-label small { color: var(--muted); }
.hb-track { height: 8px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.hb-track i { display: block; height: 100%; background: var(--teal); border-radius: 6px; }
.hb-val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.wrap-strip { margin: 14px 0 0; }
.statement { margin-top: 20px; }
.statement .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total-row td { font-weight: 700; background: var(--bg); }
.commission-box { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
@media (min-width: 961px) { .kpis-6 { grid-auto-columns: minmax(0, 1fr); } }
@media (max-width: 960px) { .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis-6 .kpi:nth-child(4) { border-inline-start: 0; } .kpis-6 .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); } .kpis-6 .kpi:nth-child(3) { border-top: 0; } }
@media (max-width: 720px) { .report-grid { grid-template-columns: minmax(0, 1fr); } .kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bars { height: 170px; } }
@media print { .kpis { break-inside: avoid; } .statement { break-inside: auto; } }

/* ===== Phase 6: inventory ===== */
.count-dot { font-size: 11.5px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--danger); color: #fff; display: inline-grid; place-items: center; padding: 0 6px; }
.qty-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qty-cell b { font-variant-numeric: tabular-nums; font-size: 15px; }
.qty-cell small { color: var(--muted); }
.qty-cell.is-low b { color: var(--amber); }
.qty-cell.is-out b { color: var(--danger); }
.stock-bar { display: block; width: 120px; max-width: 100%; height: 5px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 6px; }
.stock-bar i { display: block; height: 100%; background: var(--c-done); border-radius: 4px; }
.is-low .stock-bar i, tr:has(.is-low) .stock-bar i { background: var(--amber); }
tr:has(.is-out) .stock-bar i { background: var(--danger); }
.stock-bar.lg { width: 100%; height: 8px; margin: 10px 0 8px; }
.balance-card .balance-num { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.balance-card .balance-num small { font-size: 16px; color: var(--muted); font-weight: 500; }
.balance-card.is-low .balance-num { color: var(--amber); }
.balance-card.is-low .stock-bar i { background: var(--amber); }
.balance-card.is-out .balance-num { color: var(--danger); }
.move-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; margin-bottom: 16px; }
.move-seg label span { text-align: center; padding: 7px 4px; font-size: 13px; }
.move-list { list-style: none; margin: 12px 0 0; padding: 0; }
.move-list li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.move-list li:first-child { border-top: 0; }
.move-list div { display: flex; flex-direction: column; min-width: 0; }
.move-list small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-qty { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; padding: 3px 6px; border-radius: 8px; font-size: 14px; }
.mv-qty.is-plus { color: var(--ok); background: var(--ok-bg); }
.mv-qty.is-minus { color: var(--danger); background: var(--danger-bg); }
.mv-bal { font-variant-numeric: tabular-nums; font-size: 13px; }
.mini-list.plain li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mini-list.plain li:first-child { border-top: 0; }
.mini-list.plain small { color: var(--muted); white-space: nowrap; }
.danger-zone { margin-top: 20px; max-width: 880px; }
.supplier-card { margin-bottom: 16px; }
.supplier-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.text-danger { color: var(--danger); font-weight: 600; }
.stock-notice { align-items: center; }
.stock-notice > .i { color: var(--amber); }
.mat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.proc-nav { display: flex; flex-direction: column; max-height: 70vh; overflow-y: auto; position: sticky; top: 84px; }
.proc-nav a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px; color: var(--ink); border-top: 1px solid var(--line); font-size: 14px; }
.proc-nav a:first-child { border-top: 0; }
.proc-nav a:hover { background: var(--mint-2); text-decoration: none; }
.proc-nav a.is-on { background: var(--mint); color: var(--teal); font-weight: 600; }
.proc-nav small { font-size: 11.5px; background: var(--bg); border: 1px solid var(--line); padding: 0 7px; border-radius: 10px; color: var(--muted); align-self: center; }
.mat-rows { display: flex; flex-direction: column; gap: 8px; }
.mat-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; align-items: center; }
.mat-row .input-sm { width: 100%; }
@media (max-width: 960px) { .mat-layout { grid-template-columns: minmax(0, 1fr); } .proc-nav { position: static; max-height: 260px; } }

/* ===== Phase 7: lab ===== */
.lab-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lab-col { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.lab-col header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.lab-col h2 { font-size: 14.5px; }
.lab-col header b { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.lab-col-at_lab { border-top: 3px solid var(--blue); }
.lab-col-received { border-top: 3px solid var(--c-done); }
.lab-col-preparing { border-top: 3px solid var(--line-strong); }
.lab-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.lab-card:hover { text-decoration: none; border-color: var(--teal); }
.lab-card.is-late { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger-bg) 55%, var(--surface)); }
.lc-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.lc-top b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-top small { color: var(--muted); font-size: 11.5px; }
.lc-work { font-size: 13.5px; }
.lc-teeth { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 0 6px; }
.lc-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.lc-due { font-weight: 500; }
.lc-due.is-late { color: var(--danger); font-weight: 600; }
.lc-due.is-soon { color: var(--amber); }
.lab-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
.lab-details { margin-top: 16px; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; padding-top: 18px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; top: 4px; inset-inline-start: 0; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.timeline li::after { content: ""; position: absolute; top: 9px; inset-inline-start: 16px; inset-inline-end: -4px; height: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.is-done::before { background: var(--c-done); border-color: var(--c-done); }
.timeline li.is-done::after { background: var(--c-done); }
.timeline li.is-late::before { border-color: var(--danger); }
.timeline small { color: var(--muted); font-size: 12px; }
.lab-link { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; font-size: 12.5px; font-weight: 500; }
.inline-lab-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.inline-lab-form .input { width: auto; min-width: 200px; }
.row-check { width: 18px; height: 18px; accent-color: var(--teal); }
.text-ok { color: var(--ok); }
@media (max-width: 960px) { .lab-board { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } .timeline li::after { display: none; } }

/* ===== Phase 8: subscriptions & platform console ===== */
.plan-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-top: 4px; border-radius: 10px; color: #BFE9E3; background: rgba(255,255,255,.05); font-size: 12.5px; }
.plan-chip:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.sub-banner { display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: var(--amber-bg); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); font-size: 14px; }
.sub-banner > .i { color: var(--amber); }
.sub-banner span { flex: 1; }
.sub-banner.is-expired { background: var(--danger-bg); }
.sub-banner.is-expired > .i { color: var(--danger); }
.sub-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.sub-state { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin-top: 4px; }
.sub-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--mint); color: var(--teal); }
.sub-status.is-expired .sub-icon { background: var(--danger-bg); color: var(--danger); }
.sub-status.is-trial .sub-icon { background: var(--amber-bg); color: var(--amber); }
.section-title { font-size: 18px; margin: 26px 0 14px; }
.period-pick { margin-bottom: 18px; flex-wrap: wrap; }
.save-tag { font-style: normal; font-size: 11px; background: var(--ok-bg); color: var(--ok); padding: 1px 6px; border-radius: 8px; margin-inline-start: 4px; }
.sub-plans { margin-top: 8px; }
.plan-pick { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.plan-pick input { position: absolute; opacity: 0; }
.plan-pick:has(input:checked) { border: 2px solid var(--teal); box-shadow: var(--shadow); background: var(--mint-2); }
.plan-pick:has(input:focus-visible) { box-shadow: var(--focus); }
.plan-total { margin-top: -6px; }
.sub-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; text-align: center; }
.sub-cta .btn { min-width: 280px; }
.pricing-wa { text-align: center; margin-top: 28px; }
.pricing-wa a { display: inline-flex; align-items: center; gap: 8px; color: #1A8F48; font-weight: 600; padding: 10px 18px; border-radius: 12px; background: #E8F7EE; }
.pricing-wa a:hover { text-decoration: none; background: #D6F1E1; }
[data-theme="dark"] .pricing-wa a { background: #12301F; color: #5ECB92; }

.platform-sidebar { background: #172231; }
[data-theme="dark"] .platform-sidebar { background: #0E1622; }
.platform-sidebar .brand-mark { background: rgba(233, 179, 92, .16); color: #F0C27A; }
.platform-chip { background: rgba(233, 179, 92, .1); }
.platform-chip .clinic-chip-name { color: #F0C27A; }
.platform-sidebar .nav-item.is-active::before { background: #F0C27A; }
.platform-sidebar .nav-item.is-active { background: rgba(240, 194, 122, .12); }
.nav-count { background: #E9B35C !important; color: #1B2330 !important; font-weight: 700; }
.topbar-search { flex: 1; max-width: 420px; }
.topbar-search .input { min-height: 40px; }
.content-wide { max-width: 1320px; }
.pa-kpis { margin-bottom: 14px; }
.pa-kpis + .report-grid { margin-top: 20px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22C55E; margin-inline-end: 6px; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: live 1.8s infinite; vertical-align: middle; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.report-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.funnel { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.funnel li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) 50px; gap: 12px; align-items: center; font-size: 14px; }
.fn-bar { height: 12px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.fn-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #3DBEB2); border-radius: 6px; }
[dir="rtl"] .fn-bar i { background: linear-gradient(-90deg, var(--teal), #3DBEB2); }
.funnel b { font-variant-numeric: tabular-nums; text-align: end; }
.sub-h { font-size: 13.5px; font-family: var(--font-body); color: var(--muted); margin-top: 20px; }
.panel-head.pad { padding: 16px 20px 0; margin-bottom: 8px; }
.stat-row.inner { margin: 12px 0 0; }
.stat-row.inner div { background: var(--bg); }
.align-end-btn { align-self: flex-end; }
.platform-login-body { background: linear-gradient(160deg, #172231, #0E3B43); min-height: 100vh; }
.platform-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.pl-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); }
.pl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.pl-head .brand-mark { background: #172231; color: #F0C27A; width: 42px; height: 42px; border-radius: 12px; }
.pl-head div { display: flex; flex-direction: column; line-height: 1.3; }
.pl-head small { color: var(--muted); }
.pl-card h1 { font-size: 22px; margin-bottom: 18px; }
.pl-lang { margin-top: 16px; }
@media (max-width: 1080px) { .report-grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .sub-banner { padding: 10px 16px; flex-wrap: wrap; } .sub-cta .btn { min-width: 0; width: 100%; } }

/* ===== Realistic odontogram ===== */
:root { --en-1: #FFFFFF; --en-2: #F6F3EC; --en-3: #E4DFD3; --t-line: #A9B4B6; --t-groove: #C9C2B3; }
[data-theme="dark"] { --en-1: #F3F1EA; --en-2: #DCD7CB; --en-3: #B9B3A5; --t-line: #7E8F93; --t-groove: #A39C8D; }
.odo-wrap { display: flex; justify-content: center; }
.odo2 { width: 100%; max-width: 560px; height: auto; display: block; user-select: none; overflow: visible; }
.odo2 .en-1 { stop-color: var(--en-1); }
.odo2 .en-2 { stop-color: var(--en-2); }
.odo2 .en-3 { stop-color: var(--en-3); }
.odo-axis { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 5; }
.odo-side { font-size: 12px; fill: var(--muted); font-family: var(--font-body); }
.odo-jaw { font-size: 11px; fill: var(--muted); text-anchor: middle; font-family: var(--font-body); letter-spacing: .04em; }
.tooth2 { cursor: pointer; outline: none; }
.tooth2 .t-shadow { fill: rgba(16, 40, 45, .14); }
.tooth2 .t-base { fill: url(#enamel); }
.tooth2 .sf { fill: transparent; transition: fill .15s; }
.tooth2 .sf-caries { fill: var(--c-caries); }
.tooth2 .sf-filling { fill: var(--c-filling); }
.tooth2 .sf-planned { fill: color-mix(in srgb, var(--c-planned) 60%, transparent); }
.tooth2 .sf-lines { stroke: var(--t-line); stroke-width: .6; opacity: 0; fill: none; transition: opacity .15s; }
.tooth2 .t-groove { fill: none; stroke: var(--t-groove); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.tooth2 .t-outline { fill: none; stroke: var(--t-line); stroke-width: 1.2; transition: stroke .15s, stroke-width .15s; }
.tooth2 .t-label { font-size: 12.5px; font-weight: 700; fill: var(--ink); text-anchor: middle; font-family: var(--font-display); }
.tooth2.is-primary .t-label { font-size: 11px; fill: #5C7DA8; }
.tooth2.is-primary .t-base { fill: url(#enamel); }
.tooth2.is-primary .t-outline { stroke: #93A9C6; }
.tooth2:hover .t-outline, .tooth2:focus-visible .t-outline { stroke: var(--teal); stroke-width: 1.8; }
.tooth2:hover .sf-lines, .tooth2.is-sel .sf-lines { opacity: .7; }
.tooth2.is-sel .t-outline { stroke: var(--teal); stroke-width: 2.6; }
.tooth2.is-sel .t-shadow { fill: color-mix(in srgb, var(--teal) 35%, transparent); transform: scale(1.18); }
.tooth2.is-sel .t-label { fill: var(--teal); }
.tooth2.has-crown .t-outline { stroke: var(--c-crown); stroke-width: 2.8; }
.tooth2.has-crown .t-base { fill: color-mix(in srgb, var(--c-crown) 14%, #fff); }
.tooth2.is-missing .t-base, .tooth2.is-missing .t-shadow, .tooth2.is-missing .t-groove { fill: transparent; stroke: none; }
.tooth2.is-missing .t-outline { stroke-dasharray: 3 3; stroke: var(--line-strong); }
.tooth2.is-missing .t-label { fill: var(--muted); text-decoration: line-through; }
.tooth2 .miss-x { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.tooth2 .rct { fill: #B5332A; stroke: #fff; stroke-width: 1.2; }
.tooth2.has-implant .t-base { fill: #DCE3E6; }
.tooth2 .implant { fill: #8FA3AD; stroke: #5E7079; stroke-width: 1; }
.tooth2 .implant-x { stroke: #fff; stroke-width: 1.4; stroke-linecap: round; }
.tooth2 .fracture { fill: none; stroke: #3A2E2A; stroke-width: 1.5; stroke-linejoin: round; }
.tooth2 .plan-ring { fill: none; stroke: var(--c-planned); stroke-width: 1.4; stroke-dasharray: 3 2.5; opacity: .9; }
.tooth2.has-plan .t-label { fill: var(--c-planned); }
.t-badge2 circle { fill: var(--c-planned); stroke: var(--surface); stroke-width: 2; }
.t-badge2 text { fill: #fff; font-size: 9.5px; font-weight: 700; text-anchor: middle; font-family: var(--font-body); }
.t-badge2.is-done circle { fill: var(--c-done); }
.t-badge2.is-done path { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lg-rct { background: #B5332A; border-radius: 50%; width: 9px; height: 9px; }
.lg-missing { border: 1.5px dashed var(--muted); }
.odo-card .odo-hint { justify-content: center; }
@media (min-width: 1200px) { .chart-app { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; } .odo-card { margin-bottom: 0; position: sticky; top: 84px; } .chart-cols { grid-template-columns: minmax(0, 1fr); } }
/* Palmer notation: the bracket shows the quadrant, as dentists write it */
.pm { display: inline-block; direction: ltr; padding: 0 3px 1px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; border: 0 solid currentColor; }
.pm-1 { border-right-width: 2px; border-bottom-width: 2px; }
.pm-2 { border-left-width: 2px; border-bottom-width: 2px; }
.pm-3 { border-left-width: 2px; border-top-width: 2px; padding: 1px 3px 0; }
.pm-4 { border-right-width: 2px; border-top-width: 2px; padding: 1px 3px 0; }
.t-chip .pm { padding-block: 0; }
.lc-teeth .pm, small .pm { border-width: 0; }
.lc-teeth .pm-1, small .pm-1 { border-right-width: 1.5px; border-bottom-width: 1.5px; }
.lc-teeth .pm-2, small .pm-2 { border-left-width: 1.5px; border-bottom-width: 1.5px; }
.lc-teeth .pm-3, small .pm-3 { border-left-width: 1.5px; border-top-width: 1.5px; }
.lc-teeth .pm-4, small .pm-4 { border-right-width: 1.5px; border-top-width: 1.5px; }

/* ===== X-rays & photos ===== */
.upload-panel { margin-bottom: 18px; }
.upload-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 12px; margin-bottom: 14px; }
.upload-opts .input-sm { width: 100%; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 16px; padding: 28px 16px; text-align: center; cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--teal); background: var(--mint-2); outline: none; }
.dropzone.is-flash { animation: flash .6s; }
@keyframes flash { 30% { background: var(--mint); border-color: var(--teal); } }
.dz-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--mint); color: var(--teal); }
.dz-title { font-weight: 600; font-size: 16px; margin-top: 10px; }
.dz-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.dz-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dz-formats { color: var(--muted); font-size: 12px; margin-top: 10px; }
.mobile-only { display: none; }
@media (pointer: coarse) { .mobile-only { display: inline-flex; } }
.upload-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 10px; align-items: center; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; background: var(--bg); }
.ul-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.ul-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ul-bar i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.upload-list .is-done .ul-state { color: var(--ok); }
.upload-list .is-error .ul-state { color: var(--danger); }
.upload-list .is-error .ul-bar i { background: var(--danger); }
.files-toolbar { display: flex; justify-content: space-between; margin-bottom: 14px; }
.files-toolbar .seg b { font-size: 11.5px; margin-inline-start: 4px; color: var(--muted); }
.files-day + .files-day { margin-top: 22px; }
.files-day h3 { font-size: 13.5px; font-family: var(--font-body); color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); padding: 0; cursor: pointer; text-align: start; transition: transform .15s, box-shadow .15s, border-color .15s; }
.file-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--teal); }
.fc-media { aspect-ratio: 4 / 3; background: #0B1517; display: grid; place-items: center; overflow: hidden; }
.fc-media img { width: 100%; height: 100%; object-fit: cover; }
.file-card.is-xray .fc-media img { object-fit: contain; }
.file-doc { font-weight: 800; font-size: 20px; color: #E2564B; background: #fff; border-radius: 8px; padding: 10px 12px; letter-spacing: .05em; }
.fc-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 10px 10px; font-size: 13px; }
.fc-info b { font-weight: 600; }
.fc-info small { width: 100%; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-tooth { font-size: 12px; font-weight: 700; background: var(--mint); color: var(--teal); border-radius: 6px; padding: 0 6px; }
.xr-strip { margin-bottom: 20px; }
.xr-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.xr-thumb { position: relative; flex: none; width: 128px; height: 96px; border-radius: 10px; overflow: hidden; background: #0B1517; display: grid; place-items: center; border: 1px solid var(--line); }
.xr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xr-thumb.is-xray img { object-fit: contain; }
.xr-cap { position: absolute; inset-inline: 0; bottom: 0; padding: 14px 8px 5px; font-size: 11.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr-thumb:hover { border-color: var(--teal); text-decoration: none; }
.xr-more { background: var(--bg); color: var(--teal); font-weight: 700; font-size: 18px; }
.xr-empty { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px; color: var(--teal); font-weight: 500; }
.xr-empty:hover { text-decoration: none; background: var(--mint-2); }
.tp-xrays { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tp-xrays a { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 11px; }
.tp-xrays img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #0B1517; border-radius: 8px; }
.stat-row.has-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* viewer */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-rows: auto 1fr auto auto; background: #070C0D; color: #E7EEEE; }
.viewer[hidden] { display: none; }
.vw-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.08); }
.vw-title { display: flex; flex-direction: column; min-width: 0; }
.vw-title b { font-size: 15px; }
.vw-title small { color: #9DB0B3; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-tools, .vw-bar { display: flex; align-items: center; gap: 4px; }
.vw-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: #E7EEEE; cursor: pointer; }
.vw-btn:hover { background: rgba(255,255,255,.1); }
.vw-btn.is-on { background: #E9B35C; color: #1B2330; }
.vw-btn[hidden] { display: none; }
.vw-stage { position: relative; overflow: hidden; touch-action: none; cursor: grab; }
.vw-stage:active { cursor: grabbing; }
.vw-stage img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; transition: opacity .2s; user-select: none; -webkit-user-drag: none; image-rendering: auto; }
.vw-stage iframe { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); border: 0; background: #fff; border-radius: 8px; }
.vw-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border: 0; border-radius: 12px; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; display: grid; place-items: center; }
.vw-nav:hover { background: rgba(0,0,0,.7); }
.vw-prev { left: 12px; } .vw-next { right: 12px; }
.vw-zoom { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 12px; background: rgba(0,0,0,.55); padding: 3px 10px; border-radius: 10px; pointer-events: none; direction: ltr; }
.vw-bar { justify-content: center; flex-wrap: wrap; padding: 8px 12px; background: rgba(255,255,255,.04); border-top: 1px solid rgba(255,255,255,.08); }
.vw-slider { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #9DB0B3; margin: 0 8px; }
.vw-slider input { width: 120px; accent-color: #3DBEB2; }
.vw-edit { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 14px; background: #0F1A1C; border-top: 1px solid rgba(255,255,255,.08); }
.vw-edit[hidden] { display: none; }
.vw-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #9DB0B3; }
.vw-edit label.grow { flex: 1; min-width: 180px; }
.vw-edit .input { background: #172427; color: #E7EEEE; border-color: #2B4044; }
@media (max-width: 720px) {
  .upload-opts { grid-template-columns: minmax(0, 1fr); }
  .files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vw-slider input { width: 80px; }
  .vw-nav { width: 38px; height: 52px; }
  .stat-row.has-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* website demo & login decoration (realistic arch) */
.arch-holder { display: flex; justify-content: center; margin-top: 4px; }
.arch-holder .odo2 { max-width: 400px; }
.chart-card .tooth2 .t-label { font-size: 13px; }
.tooth2.demo-filling .t-outline { stroke: var(--p-filling); }
.tooth2.demo-root_canal .t-outline { stroke: var(--p-root_canal); stroke-width: 2.6; }
.tooth2.demo-root_canal .t-base { fill: color-mix(in srgb, var(--p-root_canal) 18%, #fff); }
.tooth2.demo-crown .t-outline { stroke: var(--p-crown); stroke-width: 2.8; }
.tooth2.demo-extraction .t-base { fill: color-mix(in srgb, var(--p-extraction) 12%, #fff); }
.tooth2.demo-extraction .t-outline { stroke: var(--p-extraction); stroke-dasharray: 3 3; }
.tooth2.demo-extraction .miss-x { stroke: var(--p-extraction); stroke-width: 2.2; }
.tooth2.is-bump .t-outline { animation: tooth-pulse .45s ease-out; }
.tooth2.is-bump .t-base { animation: tooth-flash .45s ease-out; }
@keyframes tooth-pulse { 0% { stroke-width: 4.5; } }
@keyframes tooth-flash { 0% { opacity: .55; } }
.demo-total-label { font-size: 15px; fill: var(--muted); text-anchor: middle; font-family: var(--font-body); }
.demo-total { font-size: 46px; font-weight: 700; fill: var(--deep); text-anchor: middle; font-family: var(--font-display); }
[data-theme="dark"] .demo-total { fill: var(--ink); }
.demo-total-cur { font-size: 14px; fill: var(--muted); text-anchor: middle; font-family: var(--font-body); }
.plan-items .t-chip { min-width: 28px; height: 22px; margin-inline-end: 4px; }
.arch-static-wrap { display: flex; justify-content: center; }
.arch-static-wrap .odo2 { max-width: 260px; }
.arch-static .t-base { fill: rgba(255, 255, 255, .92); }
.arch-static .t-shadow { fill: rgba(0, 0, 0, .25); }
.arch-static .t-outline { stroke: rgba(191, 233, 227, .55); }
.arch-static .t-groove { stroke: rgba(14, 59, 67, .25); }
.arch-static .sf-lines { display: none; }

/* ===== clinic addresses ===== */
.slug-field { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); direction: ltr; }
.slug-field:focus-within { border-color: var(--teal); box-shadow: var(--focus); }
.slug-field .input { border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; flex: 1; text-align: left; font-weight: 600; }
.slug-field span { display: flex; align-items: center; padding: 0 12px; background: var(--bg); color: var(--muted); font-size: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.has-error .slug-field { border-color: var(--danger); }
.hint.is-ok { color: var(--ok); font-weight: 500; direction: ltr; text-align: start; }
.tenant-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--mint); color: var(--teal); font-weight: 600; margin-bottom: 14px; }
.forgot-link { text-align: center; font-size: 14px; }
.forgot-steps { display: flex; flex-direction: column; gap: 12px; }
.forgot-steps .panel { display: flex; flex-direction: column; gap: 6px; }
.forgot-steps .btn { margin-top: 8px; }
.welcome-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.welcome-box .auth-sub { margin: 0 0 6px; }
.welcome-spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--mint); border-top-color: var(--teal); animation: spin 1s linear infinite; margin-bottom: 10px; }
.welcome-box.is-ready .welcome-spinner { animation: none; border-color: var(--teal); background: var(--mint); }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome-host { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: var(--bg); font-weight: 600; color: var(--teal); margin: 6px 0 14px; }
.address-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; max-width: 880px; }
.address-host { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--teal); margin-top: 2px; }
.address-card .copy-row { min-width: 300px; margin: 0; }
.temp-pw .copy-row { max-width: 360px; }
.temp-pw p { margin: 4px 0 8px; }

/* viewer: canvas with markings, pen toolbar */
.vw-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.vw-canvas { position: absolute; left: 50%; top: 50%; transform-origin: center; transition: opacity .2s; }
.vw-canvas img { position: static; display: block; width: 100%; height: 100%; transform: none; }
.vw-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.viewer.is-drawing .vw-stage { cursor: crosshair; }
.viewer.is-drawing .vw-stage:active { cursor: crosshair; }
.vw-btn.vw-draw-btn.is-on { background: #3DBEB2; color: #062a27; }
.vw-pen { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: #10201f; border-top: 1px solid rgba(255,255,255,.08); }
.vw-pen[hidden] { display: none; }
.vw-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: var(--c); cursor: pointer; padding: 0; }
.vw-color.is-on { border-color: #fff; box-shadow: 0 0 0 2px #3DBEB2; }
.vw-width { width: 38px; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); background: transparent; display: grid; place-items: center; cursor: pointer; }
.vw-width i { display: block; width: 20px; background: #E7EEEE; border-radius: 4px; }
.vw-width.is-on { background: rgba(61, 190, 178, .25); border-color: #3DBEB2; }
.vw-sep { width: 1px; height: 24px; background: rgba(255,255,255,.15); margin: 0 6px; }
.vw-save { margin-inline-start: 8px; gap: 6px; }
.vw-save:disabled { opacity: .45; cursor: default; }
.fc-marked { font-size: 13px; color: #E2564B; font-weight: 700; }
.vw-btn:disabled { opacity: .35; cursor: default; }
.vw-btn:disabled:hover { background: transparent; }
.vw-tools .vw-save { margin-inline-end: 6px; gap: 6px; }
.fc-media img, .xr-thumb img, .tp-xrays img { transition: filter .2s; }

/* ===== plans: seats, storage, locked features ===== */
.nav-item.is-locked { color: #7FA6A0; }
.nav-item.is-locked:hover { color: #fff; }
.seat-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.seat { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.seat-label { font-size: 13px; color: var(--muted); }
.seat b { font-family: var(--font-display); font-size: 20px; }
.seat.is-full { border-color: color-mix(in srgb, var(--amber) 50%, transparent); background: var(--amber-bg); }
.seat.is-full .mini-progress span { background: var(--amber); }
.seat-plan .link-btn { align-self: flex-start; }
.storage-meter { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.storage-meter .mini-progress { flex: 1; max-width: 260px; }
.storage-meter.is-full { color: var(--danger); }
.storage-meter.is-full .mini-progress span { background: var(--danger); }
.locked-panel { display: flex; align-items: center; gap: 16px; margin-top: 20px; color: var(--ink); border-style: dashed; }
.locked-panel:hover { text-decoration: none; border-color: var(--teal); }
.locked-panel > div { flex: 1; }
.lock-icon { font-size: 26px; }
.locked-note { align-items: center; }
.locked-note p { margin: 2px 0 0; }
.usage-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.usage-box { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; }
.usage-box b { font-family: var(--font-display); font-size: 18px; }
.trial-hint { margin-bottom: 14px; }
.discount-tag { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--ok); background: var(--ok-bg); padding: 2px 10px; border-radius: 10px; margin-top: -6px; }
.plan-price s { font-size: 16px; }
.current-plan { align-self: flex-start; }
.pricing-note { font-size: 14px; color: var(--teal); font-weight: 500; margin-top: 6px; }
.usage-lines { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.usage-lines div { display: flex; justify-content: space-between; }
.usage-lines span { color: var(--muted); }
@media (max-width: 720px) { .seat-meters, .usage-row { grid-template-columns: minmax(0, 1fr); } }
.usage-box.is-over { border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: var(--amber-bg); }
.usage-box.is-over .mini-progress span { background: var(--amber); }
