/* ============================================================
   Pearl Dental: design tokens
   ============================================================ */
:root {
  --bg: #eef2f0;
  --bg-glow: rgba(25, 194, 173, .16);
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #eef2f0;
  --line: #e2e8e5;
  --line-2: #edf1ef;
  --ink: #0e1a19;
  --ink-2: #4a5754;
  --ink-3: #87938f;
  --brand: #0d7a70;
  --brand-2: #19c2ad;
  --brand-soft: #e0f3ef;
  --brand-ink: #0a5a52;
  --side: #0a1716;
  --side-2: #0f2321;
  --side-ink: #9fb3ae;
  --good: #16803c; --good-soft: #e3f5e8;
  --warn: #b25d07; --warn-soft: #fdf0dc;
  --bad: #c2361d; --bad-soft: #fde6e0;
  --info: #4f46e5; --info-soft: #ebeafe;
  --t-teal: #0d7a70; --t-teal-s: #dff3ef;
  --t-indigo: #5146d8; --t-indigo-s: #ebe9fd;
  --t-amber: #b8680c; --t-amber-s: #fcefdc;
  --t-rose: #c63b5f; --t-rose-s: #fce7ec;
  --wa: #1fa855;
  --shadow-sm: 0 1px 2px rgba(14, 26, 25, .05);
  --shadow: 0 1px 2px rgba(14, 26, 25, .04), 0 8px 24px -8px rgba(14, 26, 25, .08);
  --shadow-lg: 0 30px 80px -20px rgba(14, 26, 25, .35);
  --r: 20px;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Plus Jakarta Sans', Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #070d0c;
  --bg-glow: rgba(45, 212, 191, .10);
  --surface: #0f1918;
  --surface-2: #0c1514;
  --surface-3: #142120;
  --line: #1c2b29;
  --line-2: #162321;
  --ink: #e9f1ef;
  --ink-2: #a5b5b1;
  --ink-3: #6c7d79;
  --brand: #2dd4bf;
  --brand-2: #5eead4;
  --brand-soft: #0f302c;
  --brand-ink: #99f6e4;
  --side: #050b0a;
  --side-2: #0b1716;
  --good: #4ade80; --good-soft: #0f2a1a;
  --warn: #fbbf24; --warn-soft: #2a200d;
  --bad: #fb7d5b; --bad-soft: #2e1610;
  --info: #a5b4fc; --info-soft: #1a1c38;
  --t-teal: #2dd4bf; --t-teal-s: #0f2e2a;
  --t-indigo: #a5a1ff; --t-indigo-s: #1c1a3a;
  --t-amber: #f5b451; --t-amber-s: #2c210f;
  --t-rose: #fb8aa6; --t-rose-s: #331520;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  --shadow-lg: 0 30px 80px -10px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 12% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, var(--t-indigo) 6%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.003em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--brand-2) 35%, transparent); }
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* ============================================================
   Shell
   ============================================================ */
.app { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 14px 0 14px 14px; }
.side-in {
  height: 100%; border-radius: 26px; padding: 20px 14px 14px; color: var(--side-ink);
  background:
    radial-gradient(240px 200px at 0% 0%, rgba(45, 212, 191, .16), transparent 70%),
    linear-gradient(180deg, var(--side-2), var(--side));
  display: flex; flex-direction: column; gap: 6px; overflow: hidden; position: relative;
  box-shadow: 0 20px 50px -20px rgba(4, 20, 18, .55);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 2px 8px 18px; }
.brand img { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 8px 20px rgba(20, 184, 166, .35); }
.brand strong { display: block; color: #fff; font-family: var(--display); font-weight: 500; font-size: 18px; letter-spacing: -.01em; line-height: 1.15; }
.brand span { font-size: 12px; color: #6f8a85; }
.side-label { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #557570; padding: 6px 12px; }
#nav { display: flex; flex-direction: column; gap: 3px; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s; position: relative;
}
#nav a .ico { width: 19px; height: 19px; opacity: .85; }
#nav a:hover { background: rgba(255, 255, 255, .05); color: #e6f5f2; }
#nav a.active { background: linear-gradient(90deg, rgba(45, 212, 191, .18), rgba(45, 212, 191, .04)); color: #fff; }
#nav a.active .ico { color: #5eead4; opacity: 1; }
#nav a.active::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #2dd4bf; box-shadow: 0 0 12px #2dd4bf; }
#nav a .badge { margin-left: auto; background: #f97316; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; box-shadow: 0 0 0 3px rgba(249, 115, 22, .15); }
#nav a .badge.soft { background: rgba(45, 212, 191, .16); color: #5eead4; box-shadow: none; }

.next-up {
  margin-top: auto; border-radius: 18px; padding: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .06); transition: background .15s;
}
.next-up:hover { background: rgba(255, 255, 255, .07); }
.next-up .nu-k { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6f8a85; }
.next-up .nu-k b { color: #5eead4; letter-spacing: 0; text-transform: none; font-size: 12px; }
.next-up .who { margin-top: 10px; }
.next-up .who b { color: #fff; font-size: 13.5px; }
.next-up .who small { color: #7f9893; font-size: 12px; }
.next-up.empty-nu { cursor: default; color: #6f8a85; font-size: 12.5px; }
.side-foot { display: flex; gap: 8px; align-items: center; padding-top: 10px; margin-top: 8px; border-top: 1px solid rgba(255, 255, 255, .06); }
.me { flex: 1; display: flex; gap: 10px; align-items: center; min-width: 0; padding: 4px; }
.me .avatar { background: linear-gradient(135deg, #2dd4bf, #0d7a70); }
.me b { display: block; color: #e6f5f2; font-size: 13px; }
.me small { display: block; color: #6f8a85; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .06); color: #a7d9cf; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.theme-btn:hover { background: rgba(255, 255, 255, .1); }
.theme-btn .ico { width: 17px; height: 17px; }
.book-link {
  margin-top: 8px; font-size: 12px; padding: 9px 12px; border-radius: 12px; color: #9fe9dc; font-weight: 600;
  display: flex; align-items: center; gap: 8px; background: rgba(45, 212, 191, .08);
}
.book-link:hover { background: rgba(45, 212, 191, .14); }
.book-link .ico { width: 14px; height: 14px; margin-left: auto; opacity: .7; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }

main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 18px 36px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, transparent) 60%, transparent);
  backdrop-filter: blur(10px);
}
.search { position: relative; flex: 1; max-width: 480px; }
.search > .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 17px; height: 17px; }
.search input {
  width: 100%; height: 46px; border: 1px solid var(--line); background: var(--surface); border-radius: 15px;
  padding: 0 74px 0 42px; outline: none; transition: border .15s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--sans); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 7px; }
.search-results {
  position: absolute; top: 54px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 6px; display: none; max-height: 400px; overflow: auto;
}
.search-results.open { display: block; animation: pop2 .16s ease both; }
@keyframes pop2 { from { opacity: 0; transform: translateY(-4px); } }
.search-results button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 12px; cursor: pointer; text-align: left; }
.search-results button:hover, .search-results button.hl { background: var(--surface-2); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.today-chip { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 15px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow-sm); }
.today-chip .ico { width: 16px; height: 16px; color: var(--brand); }
.view { padding: 12px 36px 72px; max-width: 1480px; width: 100%; }
.view.enter > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.view.enter > *:nth-child(2) { animation-delay: .05s; }
.view.enter > *:nth-child(3) { animation-delay: .1s; }
.view.enter > *:nth-child(4) { animation-delay: .15s; }
.view.enter > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ============================================================
   Primitives
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 17px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s, filter .15s; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn .ico { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #fff), var(--brand)); border-color: transparent; color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 20px -6px color-mix(in srgb, var(--brand) 60%, transparent);
}
:root[data-theme="dark"] .btn.primary { color: #04201c; background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.glass { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); color: #fff; box-shadow: none; backdrop-filter: blur(6px); }
.btn.glass:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); }
.btn.white { background: #fff; color: #0a4d46; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(0,0,0,.4); }
.btn.white:hover { filter: brightness(.97); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; gap: 6px; }
.btn.sm .ico { width: 14px; height: 14px; }
.btn.icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 4px; }
.card-h h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; }
.card-h .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.card-b { padding: 14px 22px 22px; }
.link { color: var(--brand); font-weight: 700; font-size: 12.5px; cursor: pointer; background: var(--brand-soft); border: 0; padding: 6px 11px; border-radius: 99px; white-space: nowrap; transition: filter .15s; }
.link:hover { filter: brightness(.97); }

.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 26px; flex-wrap: wrap; }
.page-h h1 { font-family: var(--display); font-weight: 400; font-size: 40px; letter-spacing: -.025em; margin: 0; line-height: 1.05; }
.page-h p { margin: 8px 0 0; color: var(--ink-3); font-size: 14.5px; }
.eyebrow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--brand); margin-bottom: 8px; display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; letter-spacing: .02em; position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 4px 10px -4px rgba(0,0,0,.3); }
.avatar.lg { width: 66px; height: 66px; border-radius: 20px; font-size: 22px; }
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 11.5px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.who small { color: var(--ink-3); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty .ico { width: 44px; height: 44px; padding: 11px; border-radius: 14px; background: var(--surface-2); color: var(--ink-3); margin-bottom: 10px; }

/* ============================================================
   Dashboard
   ============================================================ */
.hero-banner {
  position: relative; overflow: hidden; border-radius: 28px; padding: 32px 34px; margin-bottom: 20px; color: #e8fffa;
  background:
    radial-gradient(500px 300px at 85% 120%, rgba(94, 234, 212, .35), transparent 60%),
    radial-gradient(400px 260px at 0% 0%, rgba(255, 255, 255, .10), transparent 60%),
    linear-gradient(125deg, #0b3d38 0%, #0d6b62 55%, #10897c 100%);
  display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: center;
  box-shadow: 0 30px 60px -30px rgba(8, 70, 63, .7);
}
.hb-art { position: absolute; right: 330px; top: -50px; width: 300px; opacity: .07; pointer-events: none; color: #fff; }
.hb-art svg { width: 100%; height: auto; }
.hb-rings { position: absolute; inset: 0; pointer-events: none; background: repeating-radial-gradient(circle at 105% -20%, transparent 0 38px, rgba(255,255,255,.04) 38px 39px); }
.hb-main { position: relative; }
.hb-date { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8be3d4; }
.hero-banner h1 { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1.04; letter-spacing: -.03em; margin: 10px 0 10px; color: #fff; }
.hero-banner h1 em { font-style: italic; color: #a7f3e4; }
.hero-banner p { margin: 0; color: #b7e9df; font-size: 15px; max-width: 520px; }
.hb-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hb-stats { display: flex; gap: 32px; margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); flex-wrap: wrap; }
.hb-stats div b { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; color: #fff; line-height: 1; }
.hb-stats div span { font-size: 12px; color: #8fd8ca; }
.hb-next {
  position: relative; border-radius: 22px; padding: 20px; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .4);
}
.hb-next .k { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #9fe9dc; }
.hb-next .k .live { display: inline-flex; gap: 6px; align-items: center; letter-spacing: 0; text-transform: none; font-size: 12px; color: #d1fff6; background: rgba(0,0,0,.18); padding: 3px 10px; border-radius: 99px; }
.hb-next .who { margin: 16px 0 14px; }
.hb-next .who b { color: #fff; font-size: 17px; }
.hb-next .who small { color: #a9e2d7; }
.hb-next .when { display: flex; align-items: baseline; gap: 10px; }
.hb-next .when b { font-family: var(--display); font-weight: 400; font-size: 34px; color: #fff; line-height: 1; letter-spacing: -.02em; }
.hb-next .when span { color: #a9e2d7; font-size: 13px; }
.hb-next .alert-mini { margin-top: 12px; font-size: 12px; font-weight: 700; color: #ffd7cb; background: rgba(239, 68, 68, .22); padding: 6px 10px; border-radius: 10px; display: inline-flex; gap: 6px; align-items: center; }
.hb-next .alert-mini .ico { width: 14px; height: 14px; }
.hb-next .btns { display: flex; gap: 8px; margin-top: 16px; }
.hb-next .btns .btn { flex: 1; }
.hb-next.none { text-align: center; color: #b7e9df; }
.hb-next.none .ico { width: 40px; height: 40px; color: #8be3d4; margin: 8px auto; display: block; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 20px 20px 18px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.kpi .k-top { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.kpi .k-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--t-teal-s); color: var(--t-teal); flex: none; }
.kpi .k-ico .ico { width: 18px; height: 18px; }
.k-ico.indigo { background: var(--t-indigo-s); color: var(--t-indigo); }
.k-ico.amber { background: var(--t-amber-s); color: var(--t-amber); }
.k-ico.rose { background: var(--t-rose-s); color: var(--t-rose); }
.delta { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.delta.up { background: var(--good-soft); color: var(--good); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--surface-2); color: var(--ink-3); }
.kpi .k-val { font-family: var(--display); font-size: 36px; font-weight: 400; letter-spacing: -.03em; margin-top: 16px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-family: var(--sans); font-size: 14px; color: var(--ink-3); font-weight: 600; margin-right: 4px; letter-spacing: 0; }
.kpi .k-foot { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.kpi .k-viz { margin-top: auto; padding-top: 14px; }
.kpi.hero { background: linear-gradient(140deg, #0d6b62, #0b3d38); color: #e6fffa; border: 0; }
.kpi.hero .k-top { color: #a7f3d0; }
.kpi.hero .k-ico { background: rgba(255,255,255,.12); color: #fff; }
.kpi.hero .k-foot, .kpi.hero .k-val small { color: #99d8cd; }
.spark { display: block; width: 100%; height: 42px; color: var(--brand); overflow: visible; }
.spark .hit { fill: transparent; cursor: default; }
.spark .pt { opacity: 0; transition: opacity .1s; }
.spark g:hover .pt { opacity: 1; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 42px; }
.mini-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--t-indigo) 25%, transparent); min-height: 3px; position: relative; }
.mini-bars i.cur { background: var(--t-indigo); }
.mini-bars i:hover { background: color-mix(in srgb, var(--t-indigo) 60%, transparent); }
.mini-bars i:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; white-space: nowrap; z-index: 3; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--t-amber), color-mix(in srgb, var(--t-amber) 60%, #fff)); }
.meter-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 7px; font-weight: 600; }
.stack-av { display: flex; align-items: center; }
.stack-av .avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 10.5px; border: 2px solid var(--surface); margin-left: -8px; box-shadow: none; }
.stack-av .avatar:first-child { margin-left: 0; }
.stack-av span { margin-left: 10px; font-size: 12px; color: var(--ink-3); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* timeline */
.timeline { display: flex; flex-direction: column; position: relative; }
.tl-item { display: grid; grid-template-columns: 70px 18px 1fr; gap: 12px; align-items: center; padding: 4px 0; cursor: pointer; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 90px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.tl-item:first-child::before { top: 50%; }
.tl-item:last-child::before { bottom: 50%; }
.tl-item:only-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--c, var(--brand)); position: relative; z-index: 1; justify-self: center; }
.tl-item.now .tl-dot { background: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 22%, transparent); }
.tl-item.done .tl-dot { background: var(--c); }
.tl-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; transition: background .15s; min-width: 0; }
.tl-card .who { flex: 1; }
.tl-item:hover .tl-card { background: var(--surface-2); }
.tl-item.now .tl-card { background: color-mix(in srgb, var(--c) 8%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent); }
.tl-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; text-align: right; }
.tl-time small { display: block; color: var(--ink-3); font-weight: 500; font-size: 11.5px; }
.tl-item.done .tl-card, .tl-item.done .tl-time { opacity: .5; }
.now-tag { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--brand); text-transform: uppercase; display: block; }

.due-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.due-row:first-child { border-top: 0; }
.due-row .who { flex: 1; }
.due-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.due-amt small { display: block; font-weight: 600; font-size: 11.5px; }

/* collections chart */
.chart { position: relative; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: 210px auto; margin-top: 18px; }
.chart .y { position: relative; }
.chart .y span { position: absolute; right: 10px; transform: translateY(50%); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.chart .plot { position: relative; border-bottom: 1px solid var(--line); }
.chart .grid-l { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.chart .cols { position: absolute; inset: 0; display: flex; gap: 2px; align-items: flex-end; }
.chart .c { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.chart .c i { width: min(48px, 60%); border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--brand) 28%, var(--surface)); transition: background .15s; min-height: 2px; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom; }
.chart .c:nth-child(2) i { animation-delay: .04s; } .chart .c:nth-child(3) i { animation-delay: .08s; } .chart .c:nth-child(4) i { animation-delay: .12s; } .chart .c:nth-child(5) i { animation-delay: .16s; } .chart .c:nth-child(6) i { animation-delay: .2s; }
@keyframes grow { from { transform: scaleY(0); } }
.chart .c.cur i { background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.chart .c:hover i { background: color-mix(in srgb, var(--brand) 60%, var(--surface)); }
.chart .c.cur:hover i { background: var(--brand-ink); }
.chart .c .tip { position: absolute; bottom: calc(var(--h) + 10px); left: 50%; transform: translateX(-50%) translateY(4px); background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 700; padding: 7px 11px; border-radius: 10px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 3; text-align: center; }
.chart .c .tip small { display: block; font-weight: 500; opacity: .7; font-size: 11px; }
.chart .c:hover .tip { opacity: 1; transform: translateX(-50%); }
.chart .c .val { position: absolute; bottom: calc(var(--h) + 6px); font-size: 11.5px; font-weight: 700; color: var(--ink); transition: opacity .12s; }
.chart .c:hover .val { opacity: 0; }
.chart .xl { grid-column: 2; display: flex; gap: 2px; padding-top: 10px; }
.chart .xl span { flex: 1; text-align: center; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.chart .xl span.cur { color: var(--ink); font-weight: 700; }
.chart-total { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.chart-total b { font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: -.02em; }
.chart-total span { color: var(--ink-3); font-size: 12.5px; }

/* plan health */
.health-bar { display: flex; gap: 2px; height: 14px; border-radius: 6px; overflow: hidden; margin: 8px 0 14px; }
.health-bar i { display: block; height: 100%; transition: filter .15s; }
.health-bar i:hover { filter: brightness(1.12); }
.health-row { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; font-weight: 600; }
.health-row .sw { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; }
.health-row .sw .ico { width: 13px; height: 13px; }
.health-row b { font-variant-numeric: tabular-nums; }
.health-row .amt { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; font-weight: 500; }

.rank { display: flex; flex-direction: column; gap: 13px; }
.rank-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 13px; }
.rank-row span { font-weight: 600; }
.rank-row b { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.rank-row .track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rank-row .track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

.request { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: linear-gradient(90deg, var(--warn-soft), color-mix(in srgb, var(--warn-soft) 40%, var(--surface))); margin-top: 8px; border: 1px solid color-mix(in srgb, var(--warn) 15%, transparent); }
.request:first-child { margin-top: 0; }
.request .who { flex: 1; }

/* ============================================================
   Schedule
   ============================================================ */
.sched-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.week-strip { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.week-strip button {
  flex: 1; min-width: 64px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px;
  padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; transition: all .15s; box-shadow: var(--shadow-sm);
}
.week-strip button:hover { border-color: var(--brand); }
.week-strip button small { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.week-strip button b { font-size: 21px; font-family: var(--display); font-weight: 500; }
.week-strip button i { font-style: normal; font-size: 11px; color: var(--brand); font-weight: 700; height: 15px; }
.week-strip button.sel { background: linear-gradient(160deg, #0d6b62, #0b3d38); color: #fff; border-color: transparent; box-shadow: 0 10px 22px -10px rgba(8, 70, 63, .8); }
.week-strip button.sel small, .week-strip button.sel i { color: #9fe9dc; }
.week-strip button.today:not(.sel) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.week-strip button.closed { opacity: .45; }

.sched { overflow: auto; max-height: calc(100vh - 300px); min-height: 440px; }
.sched-grid { display: grid; position: relative; min-width: 640px; }
.sched-head { display: contents; }
.sched-head > div { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); padding: 14px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; gap: 10px; align-items: center; }
.sched-head .dr small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.sched-head .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 11.5px; }
.times { border-right: 1px solid var(--line-2); }
.times div { height: var(--row); font-size: 11px; color: var(--ink-3); text-align: right; padding: 0 10px; transform: translateY(-8px); font-variant-numeric: tabular-nums; font-weight: 600; }
.times div:first-child { transform: none; }
.lane { position: relative; border-right: 1px solid var(--line-2); }
.lane:last-child { border-right: 0; }
.slot { height: var(--row); border-top: 1px dashed var(--line-2); cursor: pointer; transition: background .1s; }
.slot.hour { border-top: 1px solid var(--line); }
.slot:hover { background: var(--brand-soft); }
.slot:hover::after { content: '+ Book this slot'; display: block; font-size: 11.5px; color: var(--brand); font-weight: 700; padding: 7px 12px; }
.appt {
  position: absolute; left: 6px; right: 6px; border-radius: 12px; padding: 8px 10px 8px 14px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  transition: transform .12s, box-shadow .15s; z-index: 2;
}
.appt::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.appt:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--c) 50%, transparent); z-index: 3; }
.appt b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.appt small { display: block; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .st { position: absolute; top: 8px; right: 8px; }
.appt .st .ico { width: 15px; height: 15px; }
.appt.requested { border-style: dashed; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 9%, var(--surface)) 0 8px, var(--surface) 8px 16px); }
.appt.done { opacity: .55; }
.appt.cancelled, .appt.no-show { opacity: .4; text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #ef4444; z-index: 4; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .2); }

/* ============================================================
   Tables / toolbars
   ============================================================ */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 2px; box-shadow: var(--shadow-sm); }
.seg button { white-space: nowrap; border: 0; background: none; padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--ink-3); cursor: pointer; transition: all .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--surface); box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .3); }
.seg button .n { opacity: .55; margin-left: 5px; font-weight: 600; }
.input-s { height: 44px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 14px; outline: none; min-width: 260px; box-shadow: var(--shadow-sm); }
.input-s:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl th:first-child { border-top-left-radius: var(--r); }
.tbl th:last-child { border-top-right-radius: var(--r); }
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.phone { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-weight: 600; }
.wa-mini { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--wa) 13%, transparent); color: var(--wa); border: 0; cursor: pointer; transition: all .15s; flex: none; }
.wa-mini:hover { background: var(--wa); color: #fff; transform: scale(1.06); }
.wa-mini .ico { width: 15px; height: 15px; }

/* ============================================================
   Plans
   ============================================================ */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.plan { padding: 20px; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; }
.plan:hover { transform: translateY(-3px); box-shadow: 0 24px 40px -20px rgba(14, 26, 25, .25); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.plan-amt { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plan-amt .big { font-family: var(--display); font-size: 27px; font-weight: 400; letter-spacing: -.02em; }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.pips { display: flex; gap: 3px; }
.pips i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.pips i.paid { background: var(--brand); }
.pips i.over { background: var(--bad); }
.pips i.soon { background: #f59e0b; }
.plan-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 13px; }

.sched-list { display: flex; flex-direction: column; }
.inst { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.inst:first-child { border-top: 0; }
.inst .n { width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; color: var(--ink-2); }
.inst .n .ico { width: 16px; height: 16px; }
.inst.paid .n { background: var(--brand); color: #fff; border-color: var(--brand); }
:root[data-theme="dark"] .inst.paid .n { color: #04201c; }
.inst.over .n { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.inst-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   Reminders
   ============================================================ */
.rem { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--line-2); }
.rem:first-child { border-top: 0; }
.rem .body { flex: 1; min-width: 0; }
.bubble { margin-top: 10px; background: #dcf8c6; color: #10251a; padding: 11px 14px; border-radius: 4px 16px 16px 16px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; position: relative; max-width: 580px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
:root[data-theme="dark"] .bubble { background: #173627; color: #dff5e5; }
.wa-banner { display: flex; gap: 16px; align-items: center; padding: 18px 22px; border-radius: var(--r); margin-bottom: 20px; background: linear-gradient(110deg, color-mix(in srgb, var(--wa) 13%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--wa) 22%, var(--line)); }
.wa-banner .wa-logo { width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(160deg, #2fd16a, #1a9a4c); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 10px 20px -8px rgba(31, 168, 85, .6); }
.wa-banner .wa-logo .ico { width: 24px; height: 24px; }
.wa-banner p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }

/* ============================================================
   Patient file
   ============================================================ */
.p-head { display: flex; gap: 18px; align-items: center; min-width: 0; }
.p-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 28px; letter-spacing: -.02em; }
.p-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--ink-3); font-size: 13px; align-items: center; }
.alert { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 14px; background: var(--bad-soft); color: var(--bad); font-weight: 700; font-size: 13px; border: 1px solid color-mix(in srgb, var(--bad) 18%, transparent); }
.alert .ico { width: 17px; height: 17px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px; }
.mini-stats small { color: var(--ink-3); font-size: 11px; display: block; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mini-stats b { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 13px 14px; font-weight: 700; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-color: var(--brand); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 12px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; }

.chart-wrap { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 18px; padding: 20px 12px; }
.arch { display: flex; justify-content: center; gap: 2px; }
.arch .half { display: flex; gap: 2px; }
.arch .half + .half { border-left: 2px solid var(--line); padding-left: 4px; margin-left: 2px; }
.arch-gap { height: 1px; background: var(--line); margin: 10px 20px; }
.tooth { width: 34px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border: 0; background: none; padding: 3px 0; border-radius: 9px; transition: background .12s, transform .12s; }
.tooth:hover { background: var(--surface); transform: translateY(-1px); }
.tooth svg { width: 26px; height: 32px; }
.tooth.lower svg { transform: scaleY(-1); }
.tooth small { font-size: 10.5px; color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.legend button { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface); padding: 6px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; cursor: pointer; }
.legend button i { width: 10px; height: 10px; border-radius: 3px; }
.legend button.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* ============================================================
   Overlays
   ============================================================ */
#overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.layer { position: absolute; inset: 0; }
.scrim { position: absolute; inset: 0; background: rgba(5, 16, 14, .45); backdrop-filter: blur(4px); animation: fade .2s both; pointer-events: auto; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; pointer-events: auto;
  animation: pop .24s cubic-bezier(.2, .9, .3, 1.15) both; border: 1px solid var(--line); overflow: hidden;
}
.modal.wide { width: min(780px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -47%) scale(.98); } }
.drawer {
  position: absolute; right: 12px; top: 12px; bottom: 12px; width: min(740px, calc(100vw - 24px)); background: var(--bg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; pointer-events: auto; animation: slide .32s cubic-bezier(.2, .8, .2, 1) both; border-radius: 28px; overflow: hidden; border: 1px solid var(--line);
}
@keyframes slide { from { transform: translateX(60px); opacity: 0; } }
.m-h { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 8px; gap: 12px; }
.m-h h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 25px; letter-spacing: -.02em; }
.drawer > .m-h { background: var(--surface); border-bottom: 1px solid var(--line); padding: 24px 26px 20px !important; }
.m-b { padding: 14px 26px 22px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.drawer > .m-b { padding-top: 18px !important; }
.m-f { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 26px; border-top: 1px solid var(--line-2); background: var(--surface); }
.m-f .spacer { flex: 1; }
.x { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); flex: none; transition: background .15s, transform .2s; }
.x:hover { background: var(--line); transform: rotate(90deg); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field input, .field select, .field textarea {
  height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); padding: 0 13px; outline: none; width: 100%;
  transition: border .15s, box-shadow .15s, background .15s;
}
.field textarea { height: auto; min-height: 86px; padding: 11px 13px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.preview-box { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 18px; padding: 16px 18px; }
.preview-box h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.pv-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.pv-row:first-of-type { border-top: 0; }
.pv-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.pv-sum div { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }
.pv-sum div small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.pv-sum div b { font-size: 16px; font-variant-numeric: tabular-nums; }
.status-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.status-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--ink-2); transition: all .12s; }
.status-pick button:hover { border-color: var(--ink-3); }
.status-pick button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* settings */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.set-nav { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { padding: 10px 14px; border-radius: 12px; font-weight: 600; color: var(--ink-2); transition: background .12s; }
.set-nav a:hover { background: var(--surface); color: var(--ink); }
.set-sec { scroll-margin-top: 96px; }
.row-edit { display: grid; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
.row-edit:first-child { border-top: 0; }
.row-edit input { height: 40px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); padding: 0 11px; outline: none; width: 100%; min-width: 0; }
.row-edit input:focus { border-color: var(--brand); background: var(--surface); }
.row-edit input[type=color] { padding: 3px; width: 40px; cursor: pointer; }
.copy-box { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-box input { flex: 1; min-width: 200px; height: 42px; border: 1px solid var(--line); border-radius: 13px; padding: 0 13px; background: var(--surface-2); font-family: ui-monospace, monospace; font-size: 13px; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; }
.vars code { font-size: 11.5px; background: var(--brand-soft); color: var(--brand-ink); padding: 3px 8px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.vars code:hover { filter: brightness(.95); }

/* toast */
#toasts { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast .ico { width: 17px; height: 17px; color: var(--brand-2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero-banner { grid-template-columns: 1fr 300px; }
}
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-banner { grid-template-columns: 1fr; }
  .hb-art { right: -60px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; padding: 0; }
  .side-in { border-radius: 22px 22px 0 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; }
  .brand, .side-label, .next-up, .side-foot, .book-link { display: none; }
  #nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  #nav a { flex-direction: column; gap: 3px; font-size: 10px; padding: 8px 2px; flex: 1; align-items: center; }
  #nav a.active::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  #nav a .badge { position: absolute; top: 2px; right: calc(50% - 24px); margin: 0; font-size: 9.5px; padding: 0 5px; }
  .topbar { padding: 12px 16px; }
  .view { padding: 8px 16px 120px; }
  .hide-sm, .today-chip { display: none; }
  .top-actions .btn { width: 46px; height: 46px; padding: 0; }
  .search kbd { display: none; }
  .page-h h1 { font-size: 32px; }
  .hero-banner { padding: 24px 20px; border-radius: 24px; }
  .hero-banner h1 { font-size: 34px; }
  .settings { grid-template-columns: 1fr; }
  .set-nav { display: none; }
  .form { grid-template-columns: 1fr; }
  .tbl .hide-m { display: none; }
  .input-s { min-width: 0; flex: 1; }
  .drawer { right: 0; top: 0; bottom: 0; width: 100vw; border-radius: 0; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .k-val { font-size: 26px; }
  .kpi .k-ico { display: none; }
  .delta { font-size: 10.5px; padding: 2px 6px; }
  .hb-stats { gap: 18px; }
  .mini-stats { grid-template-columns: 1fr 1fr 1fr; }
  .mini-stats div { padding: 10px; }
  .mini-stats b { font-size: 14px; }
  .tooth { width: 19px; }
  .tooth svg { width: 16px; height: 22px; }
  .tooth small { font-size: 8.5px; }
  .inst { grid-template-columns: 32px 1fr; }
  .inst-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .tl-item { grid-template-columns: 58px 14px 1fr; }
  .tl-item::before { left: 77px; }
  .tl-card > .chip { display: none; }
}
.grid-2 > *, .grid-3 > *, .kpis > * { min-width: 0; }
@media (max-width: 860px) { .hb-art { display: none; } .hb-actions .btn { flex: 1; } }
.grid-3 { align-items: start; }

/* WhatsApp preview (website demo mode) */
.wa-preview { position: fixed; right: 24px; bottom: 24px; z-index: 90; width: 340px; border-radius: 22px; overflow: hidden; background: #efe7dd; box-shadow: var(--shadow-lg); animation: waIn .35s cubic-bezier(.2,.9,.3,1.15) both; transition: opacity .3s, transform .3s; }
.wa-preview.out { opacity: 0; transform: translateY(10px); }
@keyframes waIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.wa-preview .wp-h { display: flex; gap: 10px; align-items: center; padding: 12px 12px 12px 14px; background: #075e54; color: #fff; }
.wa-preview .wp-h > div:nth-child(2) { flex: 1; min-width: 0; }
.wa-preview .wp-h b { display: block; font-size: 14px; }
.wa-preview .wp-h small { color: #b4e3d9; font-size: 11.5px; }
.wa-preview .wp-h .x { width: 30px; height: 30px; background: rgba(255,255,255,.12); color: #fff; }
.wa-preview .wp-b { padding: 14px; max-height: 300px; overflow: auto; background: #efe7dd radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px) 0 0 / 14px 14px; }
.wa-preview .bubble.out { margin: 0 0 0 auto; background: #d9fdd3; color: #111b21; border-radius: 14px 4px 14px 14px; max-width: 92%; padding-bottom: 20px; }
.wa-preview .wp-t { position: absolute; right: 10px; bottom: 4px; font-size: 10.5px; color: #667781; }
.wa-preview .ticks { color: #8696a0; letter-spacing: -3px; margin-left: 2px; transition: color .3s; }
.wa-preview.read .ticks { color: #53bdeb; }
@media (max-width: 520px) { .wa-preview { left: 12px; right: 12px; width: auto; bottom: 96px; } }
