/* Dentra - app styles
   Look: soft blue-grey canvas inside a white frame, white rounded cards, blue + pink accents,
   dark navy pills for times and the active navigation item. */

:root {
  --frame: #ffffff;
  --canvas: #edf1f5;
  --card: #ffffff;
  --tile: #f4f7fa;
  --tile-2: #eaf0f6;
  --line: #e2e8ef;
  --line-2: #d3dbe4;
  --text: #1c2531;
  --text-2: #475467;
  --muted: #8491a2;
  --primary: #3a89e4;
  --primary-600: #2a71c9;
  --primary-50: #eaf3fd;
  --primary-100: #d6e7fb;
  --pink: #e48aad;
  --pink-600: #c45f87;
  --pink-50: #fcedf3;
  --navy: #29313c;
  --navy-2: #3a4452;
  --green: #189e68;
  --green-50: #e5f6ee;
  --amber: #c98a06;
  --amber-50: #fcf4e1;
  --red: #dc4349;
  --red-50: #fdecec;
  --purple: #7466df;
  --purple-50: #f0eefc;
  --grey-50: #f0f2f5;
  --r-xl: 26px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 37, 49, .04), 0 6px 18px rgba(28, 37, 49, .05);
  --shadow-lg: 0 18px 50px rgba(28, 37, 49, .16);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --brand-font: Poppins, 'Plus Jakarta Sans', system-ui, sans-serif;
  --side-w: 236px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #0f141b; --canvas: #151c25; --card: #1b2430; --tile: #212c39; --tile-2: #263342;
    --line: #2a3644; --line-2: #364456; --text: #e7ecf2; --text-2: #b9c3cf; --muted: #8592a3;
    --primary: #5ea0ee; --primary-600: #82b6f3; --primary-50: rgba(94,160,238,.13); --primary-100: rgba(94,160,238,.22);
    --pink: #ec9dbd; --pink-600: #f2b3cc; --pink-50: rgba(236,157,189,.13); --navy: #3b4a5d; --navy-2: #4a5b70;
    --green: #3cc48a; --green-50: rgba(60,196,138,.13); --amber: #e6aa35; --amber-50: rgba(230,170,53,.14);
    --red: #f06a6f; --red-50: rgba(240,106,111,.14); --purple: #9b90f0; --purple-50: rgba(155,144,240,.14); --grey-50: #222c38;
    --shadow: 0 1px 2px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --frame: #0f141b; --canvas: #151c25; --card: #1b2430; --tile: #212c39; --tile-2: #263342;
  --line: #2a3644; --line-2: #364456; --text: #e7ecf2; --text-2: #b9c3cf; --muted: #8592a3;
  --primary: #5ea0ee; --primary-600: #82b6f3; --primary-50: rgba(94,160,238,.13); --primary-100: rgba(94,160,238,.22);
  --pink: #ec9dbd; --pink-600: #f2b3cc; --pink-50: rgba(236,157,189,.13); --navy: #3b4a5d; --navy-2: #4a5b70;
  --green: #3cc48a; --green-50: rgba(60,196,138,.13); --amber: #e6aa35; --amber-50: rgba(230,170,53,.14);
  --red: #f06a6f; --red-50: rgba(240,106,111,.14); --purple: #9b90f0; --purple-50: rgba(155,144,240,.14); --grey-50: #222c38;
  --shadow: 0 1px 2px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--frame); color: var(--text);
  font: 400 14px/1.5 var(--font); font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num, .r { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.t-red { color: var(--red); } .t-blue { color: var(--primary); } .t-green { color: var(--green); } .t-amber { color: var(--amber); } .t-grey { color: var(--muted); } .t-pink { color: var(--pink-600); }
.hl { color: var(--primary); }

/* ----------------------------------------------------------------- boot */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--frame); z-index: 100; transition: opacity .25s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-mark { width: 54px; height: 54px; border-radius: 16px; background: linear-gradient(135deg, #5aa2f0, #2f74d0); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 22px 14px 16px; background: var(--frame); }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 22px; color: var(--text); text-decoration: none !important; }
.side-brand .brand-mark-svg { width: 40px; height: 40px; flex: none; }
.side-brand b { display: block; font: 600 16px/1.15 var(--brand-font); color: var(--primary); letter-spacing: -.01em; }
.side-brand span { display: block; font: 500 12px/1.2 var(--brand-font); color: var(--muted); }
.nav { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; display: flex; flex-direction: column; gap: 1px; padding-bottom: 12px; }
.nav-group { font-size: 11px; font-weight: 600; color: var(--muted); padding: 10px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 3px 10px 3px 5px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 13.5px; text-decoration: none !important; border: 0; background: none; text-align: left; width: 100%; }
.nav-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--text-2); transition: background .15s, color .15s; }
.nav-ic .ic { width: 20px; height: 20px; }
.nav-item:hover { color: var(--text); }
.nav-item:hover .nav-ic { background: var(--tile); }
.nav-item.active { color: var(--text); }
.nav-item.active .nav-ic { background: var(--navy); color: #fff; box-shadow: 0 6px 14px rgba(41, 49, 60, .22); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--pink-50); color: var(--pink-600); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 2px; }

.canvas { background: var(--canvas); border-radius: var(--r-xl); margin: 12px 12px 12px 0; min-width: 0; padding: 18px 26px 40px; min-height: calc(100vh - 24px); min-height: calc(100dvh - 24px); }
/* The top bar stays at the top while the page scrolls: it has the page's own background, so nothing shows through. */
.topbar { display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 30; margin: -18px -26px 22px; padding: 18px 26px 12px; background: var(--canvas); border-radius: var(--r-xl) var(--r-xl) 0 0; transition: box-shadow .2s, border-radius .2s; }
.topbar.is-stuck { border-radius: 0; box-shadow: 0 1px 0 var(--line), 0 12px 22px -20px rgba(28, 37, 49, .45); }
.m-brand, .m-title { display: none; }
.search { position: relative; flex: 1; max-width: 600px; }
.search-box { display: flex; align-items: center; gap: 10px; height: 46px; background: var(--card); border-radius: 14px; padding: 0 14px 0 18px; box-shadow: var(--shadow); border: 1px solid transparent; }
.search-box:focus-within { border-color: var(--primary-100); box-shadow: 0 0 0 4px var(--primary-50); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; min-width: 0; font-size: 14px; }
.search-box input::placeholder { color: var(--muted); }
.search-box .ic { color: var(--text-2); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.search-results { position: absolute; left: 0; right: 0; top: 54px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; max-height: min(70vh, 520px); overflow: auto; border: 1px solid var(--line); }
.sr-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 10px 4px; }
.sr-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 0; background: none; text-align: left; }
.sr-item:hover, .sr-item.active { background: var(--tile); }
.sr-item strong { display: block; font-size: 13.5px; }
.sr-item small { color: var(--muted); font-size: 12px; }
.sr-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: none; }
.sr-ic .ic { width: 18px; height: 18px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 0; box-shadow: var(--shadow); color: var(--text-2); position: relative; }
.round-btn:hover { color: var(--text); }
.round-btn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); }
.me-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; }
.me-btn .avatar { width: 44px; height: 44px; font-size: 16px; box-shadow: var(--shadow); }
.me-text { text-align: left; line-height: 1.2; }
.me-text strong { display: block; font-size: 13px; }
.me-text small { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }

.tabbar { display: none; }

/* ----------------------------------------------------------------- pages */
.page { animation: pageIn .18s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; font-size: 13px; margin-bottom: 10px; border: 0; background: none; padding: 0; }
.back-link .ic { width: 16px; height: 16px; }

/* ----------------------------------------------------------------- cards */
.card { background: var(--card); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.page > .card + .card, .page > .card + section.card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card.flush .card-head { padding: 18px 20px 0; }
.card-title { font-size: 18px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile { background: var(--tile); border-radius: var(--r); padding: 14px; }
.stack { display: grid; gap: 18px; }
.cols { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }

.stat { background: var(--card); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; }
.stat-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-value, .stat-label { display: block; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.bg-blue { background: var(--primary-50); color: var(--primary); } .bg-pink { background: var(--pink-50); color: var(--pink-600); }
.bg-green { background: var(--green-50); color: var(--green); } .bg-amber { background: var(--amber-50); color: var(--amber); }
.bg-red { background: var(--red-50); color: var(--red); } .bg-purple { background: var(--purple-50); color: var(--purple); }

/* -------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); }
.btn-pink { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn-danger { background: var(--red-50); border-color: transparent; color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--tile); border-color: transparent; }
.btn-soft { background: var(--primary-50); border-color: transparent; color: var(--primary); }
.btn-soft:hover { border-color: var(--primary-100); }
.btn-wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 12.5px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-dark):not(.btn-pink):not(.btn-wa).is-busy::after { border-color: var(--text) var(--text) transparent transparent; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); flex: none; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary-100); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: var(--tile); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red-50); }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.time-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ----------------------------------------------------------------- forms */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.c1 { grid-template-columns: minmax(0, 1fr); }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); font-style: normal; }
.field-hint { color: var(--muted); font-size: 11.5px; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--card); outline: 0; transition: border-color .15s, box-shadow .15s; font-size: 14px;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.field input[readonly] { background: var(--tile); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238491a2' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px !important; }
.form-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.form-section > h3 { font-size: 14px; margin-bottom: 12px; }
.form-error { display: flex; gap: 10px; align-items: flex-start; background: var(--red-50); color: var(--red); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; font-size: 13px; }
.form-error .ic { width: 18px; height: 18px; margin-top: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.seg { display: inline-flex; background: var(--tile); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-item { position: relative; }
.seg .seg-item input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; }
.seg-item span { display: block; padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg-item input:checked + span { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg-item input:focus-visible + span { outline: 2px solid var(--primary); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters select { width: auto; min-height: 38px; }
.filters .grow { flex: 1; min-width: 180px; }
.filters .input-icon .input { width: 100%; min-width: 0; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 14px; background: var(--tile); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: var(--tile); }
.table .num { text-align: right; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-main strong { display: block; font-weight: 600; }
.cell-main small, .table td small { display: block; color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px 0; gap: 12px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- tags */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag .ic { width: 13px; height: 13px; }
.tone-blue { background: var(--primary-50); color: var(--primary); }
.tone-pink { background: var(--pink-50); color: var(--pink-600); }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-purple { background: var(--purple-50); color: var(--purple); }
.tone-grey { background: var(--grey-50); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip .ic { width: 15px; height: 15px; }
.chip.on { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary); }
.sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; margin: 0 7px; vertical-align: middle; }

/* --------------------------------------------------------------- avatars */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 13px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; }
.avatar.ring { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--primary-100); }

/* ----------------------------------------------------- empty / loading */
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--primary-50); color: var(--primary); }
.empty-ic .ic { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }
.empty-action { margin-top: 14px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.error-state .empty-ic { background: var(--red-50); color: var(--red); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); font-weight: 500; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--tile) 0%, var(--tile-2) 50%, var(--tile) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pager { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------- dropdown */
.dropdown { position: absolute; z-index: 120; min-width: 210px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown hr { margin: 6px 0; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 10px; text-align: left; font-weight: 500; font-size: 13.5px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--tile); outline: 0; }
.dropdown-item .ic { width: 18px; height: 18px; color: var(--text-2); }
.dropdown-item.danger, .dropdown-item.danger .ic { color: var(--red); }

/* ---------------------------------------------------------------- modal */
#modal-root { position: relative; z-index: 90; }
.modal-layer { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 90; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 28, 38, .42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .16s; }
.modal { position: relative; width: min(640px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--card); border-radius: 24px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px) scale(.985); transition: opacity .16s, transform .16s; }
.modal-layer.open .modal-backdrop { opacity: 1; }
.modal-layer.open .modal { opacity: 1; transform: none; }
.modal-layer.closing .modal, .modal-layer.closing .modal-backdrop { opacity: 0; }
.modal.size-sm { width: min(440px, 100%); }
.modal.size-lg { width: min(860px, 100%); }
.modal.size-xl { width: min(1120px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px 24px; }
.modal-head h2 { font-size: 18px; font-weight: 600; }
.modal-body { padding: 4px 24px 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .spacer { margin-right: auto; }
.confirm-text { color: var(--text-2); line-height: 1.6; }

/* ---------------------------------------------------------------- toast */
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 130; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; background: var(--navy); color: #fff; border-radius: 14px; padding: 11px 10px 11px 14px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease-out; font-weight: 500; font-size: 13.5px; }
.toast .ic { width: 19px; height: 19px; }
.toast-success > .ic { color: #6fe0ae; }
.toast-error { background: #b3343a; }
.toast-info > .ic { color: #9cc8fb; }
.toast-text { flex: 1; }
.toast-action { border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; }
.toast-close { border: 0; background: none; color: rgba(255, 255, 255, .7); padding: 2px; display: grid; }
.toast-close .ic { width: 16px; height: 16px; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------- patient picker */
.picker { position: relative; }
.picker-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; min-height: 44px; background: var(--card); }
.picker-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.picker-box .ic { color: var(--muted); width: 18px; height: 18px; }
.picker-box input { flex: 1; border: 0; outline: 0; background: transparent; min-width: 0; height: 42px; }
.picker-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; max-height: 340px; overflow: auto; }
.picker-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 0; background: none; text-align: left; }
.picker-item > span:not(.avatar):not(.tag) { flex: 1; min-width: 0; }
.picker-item strong { display: block; font-size: 13.5px; }
.picker-item small { color: var(--muted); font-size: 12px; }
.picker-item.active, .picker-item:hover { background: var(--tile); }
.picker-new { border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; margin-top: 4px; color: var(--primary); }
.picker-new .ic { width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--primary-50); }
.picker-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.picked { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--tile); flex-wrap: wrap; }
.picked-text { flex: 1; min-width: 150px; }
.picked-text strong { display: block; }
.picked-text small { color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------- dashboard */
.greet { font-size: 26px; font-weight: 500; letter-spacing: -.015em; margin: 0; }
.greet .hl { font-weight: 700; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.dash-main { display: grid; gap: 18px; min-width: 0; }
.dash-side { display: grid; gap: 18px; }

/* Dashboard: header, edit bar and the card grid (cards take a third, two thirds or the full width). */
.dash-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 18px; flex-wrap: wrap; margin: 2px 0 18px; }
.dash-sub { color: var(--muted); font-size: 13.5px; font-weight: 500; margin-top: 5px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-actions .btn .ic { width: 17px; height: 17px; }
.dash-actions [aria-pressed="true"] { border-color: var(--primary-100); }
.dash-editbar { position: sticky; top: 84px; z-index: 25; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 12px 14px 12px 16px; margin-bottom: 16px; border-radius: var(--r); background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); }
.dash-editbar[hidden] { display: none; }
.deb-text { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 240px; font-size: 13px; line-height: 1.45; }
.deb-text > .ic { width: 22px; height: 22px; flex: none; opacity: .9; }
.deb-text .ic.inline { width: 14px; height: 14px; vertical-align: -2px; }
.deb-actions { display: flex; gap: 8px; }
.deb-short { display: none; }
.dash-editbar .btn:not(.btn-primary) { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.deb-tray { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 2px; }
.deb-tray[hidden] { display: none; }
.deb-tray .muted { color: rgba(255, 255, 255, .7); }
.deb-tray .chip { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; height: 30px; }
.deb-tray .chip:hover { background: rgba(255, 255, 255, .2); }

.dgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; grid-auto-flow: row dense; align-items: stretch; }
.dw { grid-column: span 1; display: flex; flex-direction: column; container-type: inline-size; position: relative; transition: box-shadow .2s, outline-color .2s; }
.dw.s2 { grid-column: span 2; }
.dw.s3 { grid-column: 1 / -1; }
.dw-in { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.dw-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dw-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.dw-ic .ic { width: 18px; height: 18px; }
.dw-title .card-title { font-size: 16px; }
.dw-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dw-right .seg-item span { padding: 5px 11px; }

/* Arranging: a toolbar on every card, the content dimmed and not clickable. */
.dw-edit { display: none; align-items: center; gap: 4px; margin: -8px -8px 14px; padding: 6px 6px 6px 4px; border-radius: 12px; background: var(--primary-50); }
.dgrid.editing .dw-edit { display: flex; user-select: none; -webkit-user-select: none; }
.dgrid.editing .dw { outline: 2px dashed var(--primary-100); outline-offset: 3px; }
.dgrid.editing .dw-in { opacity: .55; pointer-events: none; user-select: none; max-height: 340px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.dgrid.editing .dw.s3 .dw-in { max-height: 220px; }
.dw-handle { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--primary); display: grid; place-items: center; cursor: grab; touch-action: none; flex: none; }
.dw-handle:hover { background: var(--card); }
.dw-handle .ic { width: 20px; height: 20px; }
.dw-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-sizes { display: inline-flex; background: var(--card); border-radius: 9px; padding: 2px; gap: 2px; }
.dw-sizes button { min-width: 28px; height: 26px; border: 0; border-radius: 7px; background: none; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.dw-sizes button.on { background: var(--primary); color: #fff; }
.dw.dragging { position: fixed; z-index: 60; margin: 0; pointer-events: none; box-shadow: var(--shadow-lg); transform: rotate(.6deg) scale(1.01); outline-color: var(--primary) !important; opacity: .96; }
.dw.dragging .dw-handle { cursor: grabbing; }
.dw-ph { border: 2px dashed var(--primary); border-radius: var(--r-lg); background: var(--primary-50); grid-column: span 1; min-height: 120px; }
.dw-ph.s2 { grid-column: span 2; }
.dw-ph.s3 { grid-column: 1 / -1; }

/* Welcome strip: the date, greeting, the day in one line, the next patient and the main buttons (2.10.4) */
.dw-welcome { padding: 18px 22px; }
.wl { display: flex; align-items: center; justify-content: space-between; gap: 14px 22px; flex-wrap: wrap; }
.wl-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 380px; }
.wl-date { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--primary); }
.wl .greet { font-size: 24px; line-height: 1.25; }
.wl-sub { color: var(--text-2); font-size: 14px; font-weight: 500; }
.wl-wait { color: var(--amber); font-weight: 700; }
.wl-next { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin-top: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12.5px; color: var(--text-2); text-align: left; }
.wl-next:hover { border-color: var(--primary-100); color: var(--text); }
.wl-next > span:not(.avatar) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wl-next b { color: var(--text); }
.wl-next .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.wl-next > .ic { width: 15px; height: 15px; flex: none; color: var(--muted); }
.wl .dash-actions { margin: 0; }
@container (max-width: 640px) {
  .wl .greet { font-size: 21px; }
  .wl-sub { font-size: 13px; }
  .wl .dash-actions { width: 100%; }
  .wl .dash-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Today at a glance */
.dw-kpis { padding: 6px; }
.dgrid.editing .dw-kpis .dw-edit { margin: 0 0 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 16px; color: inherit; text-decoration: none; position: relative; min-width: 0; }
.kpi + .kpi::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.kpi:hover, .kpi:focus-visible { background: var(--tile); text-decoration: none; }
.kpi:hover::before, .kpi:hover + .kpi::before { opacity: 0; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.kpi-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.kpi-ic .ic { width: 16px; height: 16px; }
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-bar { display: block; height: 5px; border-radius: 99px; background: var(--tile-2); overflow: hidden; margin-top: 6px; }
.kpi-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
@container (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi::before { display: none; } .kpi-val { font-size: 22px; } }

/* Patients (queue) */
.dw-queue .plist { flex: 1; max-height: 470px; }
.dw-queue .plist-item { padding: 9px 10px; border-radius: 14px; gap: 10px; }
.dw-queue .plist { grid-template-columns: minmax(0, 1fr); }
.pl-time { display: grid; justify-items: center; min-width: 44px; padding-right: 10px; border-right: 1px solid var(--line); font-size: 13.5px; font-weight: 700; line-height: 1.15; color: var(--text); }
.pl-time small { font-size: 10px !important; font-weight: 600 !important; color: var(--muted); }
.plist-item.active .pl-time { color: var(--primary); }
.plist-item .who small { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist-item .tag { flex: none; }

/* Consultation */
.cs-grid { display: grid; gap: 16px; }
.cs-patient { display: grid; gap: 12px; align-content: start; }
.cs-patient .consult-head small { display: flex; align-items: center; gap: 5px; }
.cs-patient .consult-head small .ic { width: 13px; height: 13px; }
.cs-patient .treat-icons { padding: 4px 0 0; border: 0; margin: 0; }
.cs-details { align-content: start; padding: 14px 16px; border-radius: 16px; background: var(--tile); }
.dw-consult .consult-actions { margin-top: auto; padding-top: 16px; }
@container (min-width: 600px) { .cs-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }

/* Schedule */
.sch-grid { display: grid; gap: 16px; }
@container (min-width: 600px) { .sch-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.up-item .up-date { width: 40px; height: 40px; border-radius: 12px; background: var(--card); color: var(--primary); display: grid; place-items: center; align-content: center; flex: none; line-height: 1; box-shadow: var(--shadow); }
.up-item .up-date b { font-size: 15px; }
.up-item .up-date small { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.up-item .up-date .ic { width: 18px; height: 18px; color: var(--pink-600); }
.up-item { padding: 9px 10px; background: var(--tile); }
.up-item.pink { background: var(--pink-50); }

/* To follow up */
.todo-n { min-width: 30px; height: 26px; padding: 0 8px; border-radius: 99px; display: inline-grid; place-items: center; font-size: 13px !important; }
.all-clear { flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; padding: 18px 8px; color: var(--muted); }
.all-clear .ic { width: 34px; height: 34px; color: var(--green); margin-bottom: 4px; }
.all-clear strong { color: var(--text); font-size: 14px; }
.all-clear small { font-size: 12.5px; }

/* Collections: the bars use the card's height */
.dw-collections .rev-bars { flex: 1; min-height: 170px; height: auto; align-items: stretch; }
.dw-collections .rev-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: auto; }
.rev-track { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; min-height: 60px; }
.rev-track i { flex: none; height: calc(var(--p) * (100% - 22px)); }
.cs-recent { display: grid; gap: 6px; }
.cs-recent h3, .sch-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cs-tx { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 0; border-top: 1px solid var(--line); }
.cs-tx:first-of-type { border-top: 0; }
.cs-tx .grow { flex: 1; min-width: 0; }
.cs-tx strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-tx small { color: var(--muted); font-size: 11.5px; }
.method-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.mchip { display: grid; padding: 8px 12px; border-radius: 12px; background: var(--tile); min-width: 92px; }
.mchip small { font-size: 11px; color: var(--muted); font-weight: 600; }
.mchip b { font-size: 14px; }

/* Doctors today */
.doc-rows { display: grid; gap: 14px; }
.doc-row { display: flex; gap: 12px; align-items: flex-start; }
.doc-row .doc-dot { width: 12px; height: 12px; margin: 4px 0 0; }
.doc-row .grow { flex: 1; min-width: 0; }
.doc-row strong { display: block; font-size: 13.5px; }
.doc-row small { display: block; color: var(--muted); font-size: 12px; }

/* Recent activity */
.act-list { display: grid; gap: 2px; }
.act-item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 4px; border-radius: 12px; }
.act-item + .act-item { border-top: 1px solid var(--line); border-radius: 0; }
.act-item .tl-ic { width: 32px; height: 32px; border-radius: 10px; flex: none; }
.act-item .tl-ic .ic { width: 16px; height: 16px; }
.act-item .grow { flex: 1; min-width: 0; }
.act-item strong { display: block; font-size: 13px; }
.act-item small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.act-item time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* Clinic notes */
.dw-notes .notes { max-height: 360px; overflow-y: auto; }

@media (max-width: 1220px) {
  .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dw.s2, .dw-ph.s2 { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .dash-top { align-items: stretch; margin-bottom: 14px; }
  .greet { font-size: 22px; }
  .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1; justify-content: center; }
  .dgrid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dw, .dw.s2, .dw.s3, .dw-ph, .dw-ph.s2, .dw-ph.s3 { grid-column: auto; }
  .dash-editbar { position: fixed; top: auto; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); margin: 0; }
  .deb-text { min-width: 0; flex-basis: 100%; font-size: 12.5px; }
  .deb-long { display: none; }
  .deb-short { display: inline; }
  .deb-actions { width: 100%; }
  .deb-actions .btn { flex: 1; justify-content: center; }
  .dw-edit [data-move] .ic { transform: rotate(90deg); }
  .dw-sizes { display: none; }
  .dgrid.editing { padding-bottom: 150px; }
  .dgrid.editing .dw-in { max-height: 150px; }
}
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.plist { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding: 2px; margin: -2px; }
.plist-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; width: 100%; }
.plist-item:hover { border-color: var(--primary-100); }
.plist-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.plist-item .who { flex: 1; min-width: 0; }
.plist-item strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist-item small { display: block; font-size: 12px; font-weight: 600; }
.plist-item.is-done { opacity: .6; }
.consult-head { display: flex; align-items: center; gap: 12px; }
.consult-head .who { flex: 1; min-width: 0; }
.consult-head strong { display: block; font-size: 15px; }
.consult-head small { color: var(--muted); font-size: 12.5px; }
.treat-icons { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px dashed var(--line-2); margin-bottom: 12px; }
.treat-icon { display: grid; justify-items: center; gap: 4px; min-width: 64px; font-size: 11.5px; font-weight: 600; color: var(--text-2); text-align: center; }
.treat-icon .ic { width: 26px; height: 26px; color: var(--navy); }
[data-theme="dark"] .treat-icon .ic { color: var(--text); }
.treat-icon b { font-size: 11px; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.consult-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mini-cal-head span { color: var(--muted); font-size: 13px; font-weight: 500; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 2px; text-align: center; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.mini-cal .dow { font-size: 10.5px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.mini-cal button { position: relative; height: 32px; border-radius: 9px; border: 1px solid transparent; background: none; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.mini-cal button:hover { background: var(--tile); }
.mini-cal button.has { color: var(--text); font-weight: 600; }
.mini-cal button.has::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary); }
.mini-cal button.busy::after { width: 12px; margin-left: -6px; border-radius: 3px; }
.mini-cal button.today { background: var(--primary); color: #fff; font-weight: 700; }
.mini-cal button.today::after { background: #fff; }
.mini-cal button.sel { background: var(--navy); color: #fff; border-color: var(--navy); }
.mini-cal button.closed { color: var(--line-2); }
.upcoming { display: grid; gap: 10px; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--primary-50); border: 0; text-align: left; width: 100%; }
.up-item .up-ic { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.up-item .up-ic .ic { width: 18px; height: 18px; }
.up-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.up-item small { color: var(--muted); font-size: 11.5px; }
.up-item.pink { background: var(--pink-50); } .up-item.pink .up-ic { background: var(--pink); }
.notes { display: grid; gap: 8px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--tile); border-left: 4px solid var(--primary); }
.note.c-pink { border-left-color: var(--pink); } .note.c-green { border-left-color: var(--green); } .note.c-amber { border-left-color: var(--amber); }
.note p { flex: 1; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.note.done p { text-decoration: line-through; color: var(--muted); }
.note input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; }
.note-add { display: flex; gap: 8px; margin-bottom: 10px; }
.note-add .input { min-height: 38px; }
.rev-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.rev-bar { flex: 1; display: grid; justify-items: center; gap: 6px; height: 100%; align-content: end; }
.rev-bar i { display: block; width: 100%; max-width: 34px; border-radius: 9px 9px 4px 4px; background: var(--primary-100); min-height: 6px; }
.rev-bar.cur i { background: var(--primary); }
.rev-bar small { font-size: 11px; color: var(--muted); font-weight: 600; }
.rev-bar b { font-size: 10.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.method-list { display: grid; gap: 8px; }
.method-row { display: flex; justify-content: space-between; font-size: 13px; }
.method-row span { color: var(--text-2); }

/* -------------------------------------------------------------- calendar */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar .date-label { font-size: 17px; font-weight: 600; margin: 0 6px; min-width: 150px; }
.cal-toolbar .grow { flex: 1; }
.cal-wrap { overflow: auto; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow); max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); }
.cal { display: grid; position: relative; min-width: 100%; }
.cal-corner, .cal-colhead { position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: center; }
.cal-corner { left: 0; z-index: 4; }
.cal-colhead strong { display: block; font-size: 13px; }
.cal-colhead small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.cal-colhead.today strong { color: var(--primary); }
.cal-colhead.today small { color: #fff; background: var(--primary); border-radius: 999px; padding: 1px 7px; }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.cal-time { position: absolute; right: 8px; font-size: 11px; color: var(--muted); font-weight: 600; transform: translateY(-50%); white-space: nowrap; }
.cal-col { position: relative; border-right: 1px solid var(--line); cursor: copy; }
.cal-col:last-child { border-right: 0; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.cal-line.half { border-top-style: dashed; opacity: .6; }
.cal-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--tile) 0 6px, transparent 6px 12px); pointer-events: none; }
.cal-col.closed { background: repeating-linear-gradient(135deg, var(--tile) 0 6px, transparent 6px 12px); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.appt { position: absolute; z-index: 1; border-radius: 10px; padding: 5px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; border: 0; text-align: left; cursor: pointer; background: var(--primary-50); color: var(--text); border-left: 3px solid var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.appt:hover { z-index: 2; box-shadow: var(--shadow-lg); }
.appt strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt small { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.appt.st-checked-in { background: var(--amber-50); border-left-color: var(--amber); }
.appt.st-completed { background: var(--green-50); border-left-color: var(--green); }
.appt.st-cancelled { background: var(--grey-50); border-left-color: var(--line-2); color: var(--muted); text-decoration: line-through; }
.appt.st-no-show { background: var(--red-50); border-left-color: var(--red); }
.appt .wa-done { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #1fa855; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); font-weight: 500; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.conflict-box { background: var(--amber-50); color: var(--text); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.conflict-box strong { color: var(--amber); }
.slot-hint { font-size: 12px; color: var(--amber); font-weight: 600; }

/* --------------------------------------------------------------- profile */
.profile-head { display: grid; grid-template-columns: auto minmax(min(280px, 100%), 1fr) auto; gap: 18px; align-items: center; }
.profile-name { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.profile-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; margin-top: 6px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-meta .ic { width: 16px; height: 16px; color: var(--muted); }
.profile-flags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 18px 0; padding: 4px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { border: 0; background: none; padding: 9px 14px; border-radius: 12px; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab-btn:hover { color: var(--text); background: var(--tile); }
.tab-btn.active { background: var(--navy); color: #fff; }
.tab-btn .count { font-size: 11px; background: var(--tile-2); color: var(--text-2); border-radius: 999px; padding: 0 7px; }
.tab-btn.active .count { background: rgba(255, 255, 255, .18); color: #fff; }
.alert-banner { display: flex; gap: 10px; align-items: center; background: var(--red-50); color: var(--red); border-radius: 14px; padding: 10px 14px; font-weight: 600; font-size: 13px; }
.alert-banner .ic { width: 18px; height: 18px; }
.timeline { display: grid; gap: 2px; }
.tl-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 4px; border-radius: 12px; border: 0; background: none; text-align: left; width: 100%; }
.tl-item:hover { background: var(--tile); }
.tl-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
.tl-ic .ic { width: 18px; height: 18px; }
.tl-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.tl-item small { color: var(--muted); font-size: 12px; }
.tl-item time { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ----------------------------------------------------------- dental chart */
.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.odonto { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); overflow-x: auto; }
.odonto-inner { min-width: 700px; }
.odonto.child .odonto-inner { min-width: 460px; }
.arch-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 0 6px; }
.arch-row { display: flex; justify-content: center; gap: 2px; }
.arch-half { display: flex; gap: 2px; }
.arch-half.right { padding-right: 8px; border-right: 2px solid var(--line-2); }
.arch-half.left { padding-left: 8px; }
.arch-gap { height: 14px; border-bottom: 2px dashed var(--line-2); margin: 0 10% 14px; }
.tooth-cell { display: grid; justify-items: center; gap: 2px; width: 44px; padding: 5px 0 4px; border: 2px solid transparent; border-radius: 12px; background: none; }
.tooth-cell.lower { grid-template-rows: auto auto auto; }
.tooth-cell.lower .tn { order: 3; }
.tooth-cell.lower .tmarks { order: 1; }
.tooth-cell.lower svg { order: 2; }
.tooth-cell:hover { background: var(--tile); }
.tooth-cell.selected { border-color: var(--primary); background: var(--primary-50); }
.tooth-cell .tn { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.tooth-cell.has .tn { color: var(--text); }
.tmarks { display: flex; gap: 2px; height: 14px; font-size: 9.5px; line-height: 14px; }
.tmarks b { font-weight: 800; }
.tooth-svg .srf { fill: var(--card); stroke: var(--line-2); stroke-width: 1.2; transition: fill .12s; }
.tooth-svg .srf.f-red { fill: var(--red); } .tooth-svg .srf.f-blue { fill: var(--primary); } .tooth-svg .srf.f-green { fill: var(--green); } .tooth-svg .srf.f-amber { fill: var(--amber); } .tooth-svg .srf.f-grey { fill: var(--line-2); }
.tooth-svg .srf.sel { fill: var(--primary-100); stroke: var(--primary); stroke-width: 2; }
.tooth-svg .srf[data-surface] { cursor: pointer; }
.tooth-svg .srf[data-surface]:hover { fill: var(--primary-50); }
.tooth-svg .ring { fill: none; stroke-width: 2.6; }
.tooth-svg .ring.t-blue { stroke: var(--primary); } .tooth-svg .ring.t-red { stroke: var(--red); } .tooth-svg .ring.t-green { stroke: var(--green); }
.tooth-svg .ring.dashed { stroke-dasharray: 3 2.4; }
.tooth-svg .ring.double { stroke-width: 4.4; }
.tooth-svg .stroke { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.tooth-svg .stroke.thick { stroke-width: 3; }
.tooth-svg .stroke.t-red { stroke: var(--red); } .tooth-svg .stroke.t-blue { stroke: var(--primary); } .tooth-svg .stroke.t-grey { stroke: var(--muted); }
.tooth-svg .dot.t-amber { fill: var(--amber); }
.tooth-svg.absent .srf { opacity: .35; }
.tooth-svg .srf-letter { font: 700 9px var(--font); fill: var(--muted); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.tooth-svg .srf-letter.center { fill: var(--text-2); }
.tooth-panel { position: sticky; top: 84px; }
.surface-picker { display: grid; justify-items: center; padding: 6px 0 4px; }
.surface-picker svg { width: 168px; height: 168px; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cond-btn { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 600; text-align: left; color: var(--text-2); }
.cond-btn i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.cond-btn i.tone-red { background: var(--red); } .cond-btn i.tone-blue { background: var(--primary); } .cond-btn i.tone-green { background: var(--green); } .cond-btn i.tone-amber { background: var(--amber); } .cond-btn i.tone-grey { background: var(--line-2); }
.cond-btn.active { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); color: var(--text); background: var(--tile); }
.history { display: grid; gap: 8px; }
.hist-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--tile); font-size: 12.5px; }
.hist-item strong { font-size: 13px; }
.hist-item small { display: block; color: var(--muted); }
.chart-summary { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- editors */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.preview-col { position: sticky; top: 84px; display: grid; gap: 12px; }
.line-rows { display: grid; gap: 10px; }
.med-row, .item-row { display: grid; gap: 8px; align-items: end; padding: 12px; border-radius: 14px; background: var(--tile); position: relative; }
.med-row { grid-template-columns: minmax(150px, 2fr) minmax(80px, 1fr) minmax(90px, 1fr) minmax(100px, 1.1fr) minmax(80px, 1fr) 30px; }
.item-row { grid-template-columns: minmax(180px, 3fr) 80px 70px 110px 110px 30px; }
.med-row .field-label, .item-row .field-label { font-size: 11.5px; }
.med-row input, .med-row select, .item-row input { min-height: 38px; padding: 7px 10px; font-size: 13.5px; }
.med-row select { padding-right: 24px !important; background-position: right 7px center; }
.row-amount { min-height: 38px; display: flex; align-items: center; justify-content: flex-end; font-weight: 700; padding-right: 4px; }
.row-remove { align-self: end; margin-bottom: 4px; }
.linked-tx { position: absolute; top: 8px; right: 46px; }
.totals { margin-left: auto; width: min(360px, 100%); display: grid; gap: 8px; }
.total-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text-2); font-size: 13.5px; }
.total-line input { width: 120px; min-height: 36px; text-align: right; }
.total-line.grand { border-top: 1px solid var(--line); padding-top: 10px; color: var(--text); font-size: 17px; font-weight: 700; }
.total-line.due { color: var(--red); font-weight: 700; }
.unbilled { border: 1px dashed var(--primary); background: var(--primary-50); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.unbilled-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.unbilled label { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.unbilled label span { flex: 1; }
.pay-now { background: var(--green-50); border-radius: 14px; padding: 14px; }
.doc-body textarea { min-height: 300px; font-size: 14px; line-height: 1.6; }

/* --------------------------------------------------------------- images */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.g-item { background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; }
.g-thumb { aspect-ratio: 4 / 3; background: var(--tile-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-thumb .ic { width: 34px; height: 34px; }
.g-meta { padding: 10px 12px; }
.g-meta strong { display: block; font-size: 13px; }
.g-meta small { color: var(--muted); font-size: 11.5px; }
.lightbox-img { display: grid; place-items: center; background: #0d1218; border-radius: 16px; min-height: 300px; overflow: hidden; }
.lightbox-img img { max-height: 68vh; object-fit: contain; transform-origin: center center; will-change: transform; user-select: none; -webkit-user-select: none; }
.lightbox-img { position: relative; }
.zoom-frame { touch-action: none; cursor: zoom-in; }
.zoom-frame.is-zoomed { cursor: grab; }
.zoom-frame.is-zoomed:active { cursor: grabbing; }
.zoom-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.zoom-tools .icon-btn { background: rgba(13, 18, 24, .72); color: #fff; border-color: rgba(255, 255, 255, .18); }
.zoom-hint { position: absolute; left: 12px; bottom: 14px; font-size: 11.5px; color: rgba(255, 255, 255, .7); pointer-events: none; transition: opacity .2s; }
.zoom-frame.is-zoomed .zoom-hint { opacity: 0; }
@media (pointer: fine) { .zoom-hint { display: none; } }
.lightbox-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.dropzone { display: block; border: 2px dashed var(--line-2); border-radius: 16px; padding: 22px; text-align: center; color: var(--muted); background: var(--tile); cursor: pointer; }
.dropzone:hover { border-color: var(--primary); }
.dropzone.over { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.dropzone strong { color: var(--text); display: block; margin-bottom: 2px; }
.file-list { display: grid; gap: 6px; margin-top: 10px; font-size: 12.5px; }

/* --------------------------------------------------------------- reports */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 10px 0 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; height: 100%; min-width: 0; }
.bar-pair { display: flex; gap: 3px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; min-height: 0; }
.bar-pair i { display: block; width: 42%; max-width: 22px; border-radius: 7px 7px 3px 3px; min-height: 4px; }
.bar-pair i.a { background: var(--primary); } .bar-pair i.b { background: var(--pink); }
.bar-col small { font-size: 11px; color: var(--muted); font-weight: 600; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; align-items: center; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 6px; background: var(--tile-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 6px; background: var(--primary); }
.hbars { display: grid; gap: 12px; }

/* --------------------------------------------------------------- login */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr); background: var(--frame); }
.login-art { margin: 14px 0 14px 14px; border-radius: var(--r-xl); background: radial-gradient(circle at 70% 30%, var(--primary-100), var(--canvas) 60%); padding: 44px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark-svg { width: 48px; height: 48px; }
.login-brand b { font: 600 20px/1.1 var(--brand-font); color: var(--primary); }
.login-brand span { display: block; font: 500 13px var(--brand-font); color: var(--muted); }
.login-art h1 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 600; letter-spacing: -.03em; max-width: 520px; line-height: 1.15; }
.login-art .tooth-illustration { max-width: 340px; align-self: center; margin: 20px 0; }
.login-info { display: flex; gap: 22px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.login-info div { display: grid; gap: 2px; }
.login-info b { font-size: 12px; color: var(--muted); font-weight: 600; }
.login-main { display: grid; place-items: center; padding: 30px 24px; }
.login-card { width: min(380px, 100%); }
@media (min-width: 1001px) { .login-card > .login-brand { display: none !important; } }
.login-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.login-card .lead { color: var(--muted); margin: 6px 0 24px; }
.login-card form { display: grid; gap: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.login-foot { margin-top: 26px; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------- banners */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.banner .ic { width: 18px; height: 18px; }
.banner.info { background: var(--primary-50); color: var(--primary-600); }
.banner.warn { background: var(--amber-50); color: var(--amber); }
.banner.danger { background: var(--red-50); color: var(--red); }
.banner.ok { background: var(--green-50); color: var(--green); }
.banner .btn { margin-left: auto; }
.install-steps { display: grid; gap: 12px; counter-reset: step; }
.install-steps li { list-style: none; display: flex; gap: 12px; align-items: flex-start; }
.install-steps li::before { counter-increment: step; content: counter(step); width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.install-steps { padding: 0; margin: 0; }

/* ---------------------------------------------------------------- misc */
.list-rows { display: grid; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--tile); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { display: block; font-size: 13.5px; }
.list-row small { color: var(--muted); font-size: 12px; }
.money-due { color: var(--red); font-weight: 700; }
.money-ok { color: var(--green); font-weight: 700; }
.fav-chips { margin: -4px 0 12px; }
.section-gap { margin-top: 18px; }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------- responsive */
/* ---------- dental chart (anatomical odontogram) */
:root { --tooth-fill: #fffdf7; --tooth-root: #f2eadf; --tooth-line: #b5a994; --gum: #f9e1e7; --cap: #dbe7f8; --imp: #d9efe6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tooth-fill: #e9e3d8; --tooth-root: #c8bfae; --tooth-line: #8a806e; --gum: #43293a; --cap: #a9c6ec; --imp: #9ad4bb; } }
:root[data-theme="dark"] { --tooth-fill: #e9e3d8; --tooth-root: #c8bfae; --tooth-line: #8a806e; --gum: #43293a; --cap: #a9c6ec; --imp: #9ad4bb; }
.dc-patient { margin-bottom: 18px; padding: 14px 16px; }
.dc-patient-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dc-patient-row .grow { flex: 1; min-width: 160px; }
.dc-patient-row strong { display: block; font-size: 16px; }
.dc-patient-row small { display: block; color: var(--muted); font-size: 12.5px; }
.dchart { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 18px; align-items: start; }
.dchart-main { grid-column: 1; min-width: 0; }
.dchart .tooth-panel { grid-column: 2; grid-row: 1 / span 2; }
.dchart-table { grid-column: 1; min-width: 0; }
.dchart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dchart-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dchart-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.dc-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 9px 11px; border-radius: 14px; font-size: 11.5px; font-weight: 600; min-width: 0; }
.dc-stat b { font-size: 18px; line-height: 1.1; }
.dc-stat span:last-child { grid-column: 2; color: var(--text-2); line-height: 1.25; }
.dc-stat-ic { display: grid; place-items: center; grid-row: 1 / span 2; width: 30px; height: 30px; border-radius: 10px; background: var(--card); }
.dc-stat-ic .ic { width: 16px; height: 16px; }
.dc-stat.zero { opacity: .5; }
.odonto2 { overflow-x: auto; padding-bottom: 6px; margin: 0 -4px; scrollbar-width: thin; }
.odonto2-inner { min-width: 640px; padding: 0 4px; }
.odonto2.child .odonto2-inner { min-width: 480px; }
.jaw-label { display: grid; grid-template-columns: 1fr auto 1fr; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 2px 6px; }
.jaw-label strong { color: var(--text-2); text-transform: uppercase; letter-spacing: .09em; font-size: 10.5px; }
.jaw-label span:last-child { text-align: right; }
.jaw { display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.jaw::before { content: ''; position: absolute; left: 8px; right: 8px; height: 20px; border-radius: 12px; background: var(--gum); z-index: 0; }
.jaw.upper::before { top: 56px; }
.jaw.lower::before { top: 68px; }
.quad { display: flex; justify-content: flex-end; position: relative; z-index: 1; padding-right: 4px; min-width: 0; }
.quad + .quad { justify-content: flex-start; padding: 0 0 0 4px; border-left: 2px solid var(--line-2); }
.quad em { display: none !important; }
.quad em { position: absolute; top: 2px; left: 2px; font-style: normal; font-size: 10px; font-weight: 800; color: var(--muted); width: 18px; height: 18px; border-radius: 50%; background: var(--tile); display: grid; place-items: center; }
.quad + .quad em { left: auto; right: 2px; }
.jaw.lower .quad em { top: auto; bottom: 2px; }
.bite-line { border-top: 2px dashed var(--line-2); margin: 6px 6%; }
.tcol { display: grid; grid-template-rows: 16px 76px 28px 10px; justify-items: center; align-items: center; gap: 2px; flex: 1 1 0; min-width: 0; max-width: 52px; padding: 4px 0; border: 0; background: none; border-radius: 14px; cursor: pointer; position: relative; color: inherit; transition: background .12s, box-shadow .12s; }
.tcol.lower { grid-template-rows: 10px 28px 76px 16px; }
.tcol.lower .tcol-n { order: 4; } .tcol.lower .tcol-art { order: 3; } .tcol.lower .tcol-map { order: 2; } .tcol.lower .tcol-dots { order: 1; }
.tcol:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.tcol:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tcol.selected { background: color-mix(in srgb, var(--primary) 12%, var(--card)); box-shadow: inset 0 0 0 2px var(--primary); }
.tcol-n { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.tcol.has .tcol-n { color: var(--text); }
.tcol.selected .tcol-n { color: var(--primary); }
.tcol-art { display: grid; place-items: center; height: 76px; }
.tcol-map .tooth-svg { display: block; }
.tcol-dots { display: flex; gap: 3px; }
.tcol-dots i, .dc-group-head i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--red); } .dot-blue { background: var(--primary); } .dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-grey { background: var(--muted); }
.odonto2.child .tcol { max-width: 64px; }
.tooth-art { overflow: visible; display: block; }
.tooth-art .t-root { fill: var(--tooth-root); stroke: var(--tooth-line); stroke-width: 1; }
.tooth-art .t-crown { fill: var(--tooth-fill); stroke: var(--tooth-line); stroke-width: 1.15; }
.tooth-art .t-crown.capped { fill: var(--cap); stroke: var(--primary); stroke-width: 1.7; }
.tooth-art .cap-need { fill: none; stroke: var(--red); stroke-width: 1.6; stroke-dasharray: 3 2; }
.tooth-art .decay { fill: var(--red); }
.tooth-art .fill { fill: var(--primary); }
.tooth-art .canal { fill: none; stroke-width: 2.3; stroke-linecap: round; }
.tooth-art .canal.done { stroke: var(--primary); }
.tooth-art .canal.need { stroke: var(--red); stroke-dasharray: 3 2.6; }
.tooth-art .imp-screw { fill: var(--imp); stroke: var(--green); stroke-width: 1.3; }
.tooth-art .imp-thread { stroke: var(--green); stroke-width: 1.1; }
.tooth-art .fx { fill: none; stroke: var(--red); stroke-width: 2.1; stroke-linejoin: round; stroke-linecap: round; }
.tooth-art .bridge-bar { stroke: var(--primary); stroke-width: 3.4; stroke-linecap: round; opacity: .85; }
.tooth-art .ext-x { stroke: var(--red); stroke-width: 2.8; stroke-linecap: round; }
.tooth-art .watch-dot { fill: var(--amber); stroke: var(--card); stroke-width: 1.4; }
.tooth-art .ghost path { fill: none; stroke: var(--line-2); stroke-width: 1.2; stroke-dasharray: 2.6 2.2; }
.dchart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); font-weight: 500; align-items: center; }
.dchart-legend i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -3px; border-radius: 4px; }
.lg-decay { background: var(--red); border-radius: 50% !important; }
.lg-fill { background: var(--primary); border-radius: 50% !important; }
.lg-canal { background: linear-gradient(90deg, transparent 5px, var(--primary) 5px, var(--primary) 9px, transparent 9px); }
.lg-cap { background: var(--cap); box-shadow: inset 0 0 0 1.5px var(--primary); }
.lg-implant { background: repeating-linear-gradient(0deg, var(--green) 0 2px, var(--imp) 2px 4px); }
.lg-bridge { background: linear-gradient(transparent 5px, var(--primary) 5px, var(--primary) 9px, transparent 9px); }
.lg-ext { background: linear-gradient(45deg, transparent 6px, var(--red) 6px, var(--red) 8.5px, transparent 8.5px), linear-gradient(-45deg, transparent 6px, var(--red) 6px, var(--red) 8.5px, transparent 8.5px); }
.lg-ghost { box-shadow: inset 0 0 0 1.5px var(--line-2); border-radius: 6px !important; }
.lg-watch { background: var(--amber); border-radius: 50% !important; }
.lg-note { margin-left: auto; color: var(--muted); }
.dc-now { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dc-visual { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: center; background: var(--tile); border-radius: 18px; padding: 10px 12px; margin-bottom: 12px; }
.dc-art { display: grid; place-items: center; padding: 0 4px; }
.dc-visual .surface-picker { padding: 0; }
.dc-visual .surface-picker svg { width: 150px; height: 150px; }
.dc-visual .surface-picker small { text-align: center; }
.dc-conds { display: grid; gap: 10px; }
.dc-cond-group .field-label { display: block; margin-bottom: 6px; }
.cond-btn.healthy { width: 100%; justify-content: center; color: var(--green); }
.cond-btn.healthy .ic { width: 15px; height: 15px; }
.dc-group + .dc-group { margin-top: 14px; }
.dc-group-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.dc-group-head i { width: 8px; height: 8px; }
.dc-group-head b { margin-left: auto; color: var(--muted); }
.dc-find { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: var(--tile); border-radius: 12px; padding: 8px 10px; text-align: left; cursor: pointer; color: inherit; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.dc-find:hover { background: var(--primary-50); }
.dc-find .grow { flex: 1; min-width: 0; }
.dc-find small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.dc-find > .ic { width: 15px; height: 15px; color: var(--muted); flex: none; }
.tooth-chip { display: inline-grid; place-items: center; min-width: 32px; height: 26px; padding: 0 6px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.dc-empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 24px 12px; color: var(--muted); font-size: 12.5px; }
.dc-empty .ic { width: 30px; height: 30px; color: var(--primary); }
.dc-empty strong { color: var(--text); font-size: 14px; }
.dc-timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.dc-timeline li { position: relative; display: flex; gap: 8px; align-items: flex-start; }
.dc-timeline li::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); box-shadow: 0 0 0 3px var(--card); }
.dc-timeline li.tl-red { --c: var(--red); } .dc-timeline li.tl-blue { --c: var(--primary); } .dc-timeline li.tl-green { --c: var(--green); } .dc-timeline li.tl-amber { --c: var(--amber); }
.dc-timeline .grow { flex: 1; min-width: 0; }
.dc-timeline strong { display: block; font-size: 13px; }
.dc-timeline small { display: block; color: var(--muted); font-size: 12px; }
.dc-timeline .dc-note { color: var(--text-2); }

/* ---------- appointments: layout, month calendar, day summary */
.t-purple { color: var(--purple); }
.danger-text { color: var(--red) !important; }
.show-sm, .show-sm-inline { display: none; }
.appt-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.appt-side { display: grid; gap: 14px; position: sticky; top: 12px; }
.appt-side .card { padding: 14px; }
.appt-main { min-width: 0; }
.appt-cal .mc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mc-head strong { font-size: 13.5px; }
.appt-cal .mc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mc-dow { font-size: 10.5px; font-weight: 700; color: var(--muted); text-align: center; padding: 3px 0; }
.mc-day { position: relative; height: 31px; border: 0; background: none; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; padding: 0 0 6px; }
.mc-day:hover { background: var(--tile); }
.mc-day.out { opacity: .45; }
.mc-day.closed { color: var(--muted); }
.mc-day.today { color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary-100); }
.mc-day.sel { background: var(--navy); color: #fff; box-shadow: none; }
.mc-day i { position: absolute; bottom: 3px; left: 0; right: 0; font-style: normal; font-size: 9px; font-weight: 800; line-height: 1; color: var(--primary); }
.mc-day.sel i { color: #fff; opacity: .85; }
.ds-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ds-head strong { font-size: 14px; }
.ds-head span { font-size: 12px; color: var(--muted); font-weight: 600; }
.ds-rows { display: grid; gap: 1px; }
.ds-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; border: 0; background: none; width: 100%; text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.ds-row:hover { background: var(--tile); }
.ds-row.on { background: var(--primary-50); color: var(--primary-600); }
.ds-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-row small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.ds-row b { font-size: 13px; color: var(--text); }
.ds-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.ds-dot.tone-blue { background: var(--primary); } .ds-dot.tone-amber { background: var(--amber); } .ds-dot.tone-purple { background: var(--purple); }
.ds-dot.tone-green { background: var(--green); } .ds-dot.tone-red { background: var(--red); }
.ds-note { margin: 10px 0 0; font-size: 12px; color: var(--pink-600); display: flex; gap: 6px; align-items: center; font-weight: 600; }
.ds-note .ic { width: 14px; height: 14px; }
.doc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--primary)); flex: none; margin-right: 6px; vertical-align: -1px; }
.ds-row .doc-dot { margin: 0; }
.doc-dot.all { background: conic-gradient(#3a89e4 0 25%, #e0699a 0 50%, #2fa37a 0 75%, #d9932b 0); }

/* ---------- appointments: patient queue */
.queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.q-col { background: color-mix(in srgb, var(--card) 45%, transparent); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 220px; }
.q-col > header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.q-col > header strong { font-size: 13.5px; }
.q-col > header b { margin-left: auto; font-size: 12px; background: var(--card); border-radius: 999px; padding: 2px 9px; box-shadow: var(--shadow); }
.q-list { display: grid; gap: 10px; }
.q-card { background: var(--card); border-radius: 16px; padding: 11px 12px; box-shadow: var(--shadow); border-left: 4px solid var(--doc); cursor: pointer; display: grid; gap: 7px; min-width: 0; }
.q-card:hover { box-shadow: var(--shadow-lg); }
.q-top { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.q-top .grow { flex: 1; }
.q-time { font-weight: 700; background: var(--navy); color: #fff; border-radius: 7px; padding: 2px 7px; font-size: 11.5px; white-space: nowrap; }
.q-token { font-weight: 800; color: var(--amber); background: var(--amber-50); border-radius: 7px; padding: 2px 7px; font-size: 11.5px; }
.q-doc { font-size: 11.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.q-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.q-who > div { min-width: 0; }
.q-who strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-who small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-reason { font-size: 12.5px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.q-reason .q-doc { max-width: none; font-weight: 700; color: var(--text); }
.q-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.q-flags:empty { display: none; }
.q-flags .tag { height: 21px; font-size: 11px; padding: 0 7px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.q-meta .ic { width: 13px; height: 13px; vertical-align: -2px; }
.q-wait { color: var(--text-2); }
.q-wait.warn { color: var(--amber); }
.q-wait.late { color: var(--red); }
.q-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.q-actions .grow { flex: 1; }
.q-empty { display: grid; place-items: center; gap: 6px; padding: 26px 10px; color: var(--muted); font-size: 12.5px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 14px; }
.q-empty .ic { width: 20px; height: 20px; opacity: .7; }
.q-card.st-completed { opacity: .88; }
.q-card.st-cancelled, .q-card.st-no-show { opacity: .7; }
.q-missed-toggle { margin-top: 14px; border: 0; background: none; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; padding: 6px 0; }
.q-missed { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 8px; }

/* ---------- appointments: day and week grid */
.cal-line.quarter { border-top-style: dotted; opacity: .35; }
.cal-colhead strong { display: inline; }
.cal-colhead small { display: block; }
.cal-colhead .doc-dot { margin: 0 6px 0 0; }
.cal-col.is-today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal-off span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; background: var(--card); padding: 2px 8px; border-radius: 999px; }
.cal-off span:empty { display: none; }
.cal-ghost { position: absolute; left: 3px; right: 3px; border-radius: 9px; border: 1.5px dashed var(--primary); background: var(--primary-50); color: var(--primary-600); font-size: 11.5px; font-weight: 700; padding: 2px 8px; pointer-events: none; z-index: 1; line-height: 1.4; }
.appt { border-left: 4px solid var(--doc, var(--primary)); background: var(--primary-50); padding: 4px 7px; display: flex; flex-direction: column; gap: 1px; }
.appt-top { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.appt-time { overflow: hidden; text-overflow: ellipsis; }
.appt.tight { flex-direction: row; align-items: center; gap: 6px; }
.appt.tight .appt-top { flex: none; }
.appt .b-token { color: var(--amber); background: var(--amber-50); border-radius: 5px; padding: 0 4px; }
.appt .b-new { color: var(--pink-600); background: var(--pink-50); border-radius: 5px; padding: 0 4px; }
.appt .b-ok { color: var(--primary); display: inline-flex; }
.appt .b-ok .ic { width: 12px; height: 12px; }
.appt .wa-done { position: static; flex: none; }
.appt-doc { display: flex !important; align-items: center; }
.appt.st-confirmed { background: var(--primary-100); }
.appt.appt-group { background: var(--card); border: 1.5px dashed var(--line-2); border-left: 4px solid var(--navy); }
.appt.appt-group strong { white-space: normal; font-weight: 600; font-size: 11.5px; }
.appt.st-checked-in { background: var(--amber-50); }
.appt.st-in-chair { background: var(--purple-50); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--purple) 45%, transparent); }
.appt.st-completed { background: var(--green-50); color: var(--text-2); }
.appt.st-no-show { background: var(--red-50); }
.appt.st-cancelled { background: var(--grey-50); color: var(--muted); text-decoration: line-through; opacity: .75; }
.legend i.lg { width: 18px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); border-left: 4px solid var(--primary); background: var(--primary-50); }
.legend i.lg.st-confirmed { background: var(--primary-100); } .legend i.lg.st-checked-in { background: var(--amber-50); }
.legend i.lg.st-in-chair { background: var(--purple-50); } .legend i.lg.st-completed { background: var(--green-50); }
.legend i.lg.st-no-show { background: var(--red-50); } .legend i.lg.st-cancelled { background: var(--grey-50); }

/* ---------- appointments: agenda list */
.agenda-day + .agenda-day { margin-top: 14px; }
.agenda-date { display: flex; align-items: baseline; gap: 10px; padding: 6px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.agenda-date strong { font-size: 14px; }
.agenda-date span { font-size: 12px; color: var(--muted); font-weight: 600; }
.agenda-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 6px; border-radius: 12px; cursor: pointer; color: inherit; }
.agenda-row:hover { background: var(--tile); }
.agenda-row .grow { flex: 1; min-width: 0; }
.agenda-row strong { display: block; font-size: 13.5px; }
.agenda-row small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-time { width: 70px; flex: none; font-weight: 700; font-size: 13px; }
.agenda-time small { font-weight: 500; }
.agenda-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--c); flex: none; }
.agenda-row.st-cancelled strong, .agenda-row.st-no-show strong { text-decoration: line-through; color: var(--muted); }

/* ---------- appointments: dialogs */
.appt-form .type-chips .chip em { font-style: normal; font-size: 10.5px; color: var(--muted); margin-left: 4px; font-weight: 700; }
.appt-form .type-chips .chip.on em { color: inherit; opacity: .8; }
.slot-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.slot-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.slot-head strong { font-size: 13.5px; }
.slot-head small { color: var(--muted); font-size: 12px; font-weight: 600; }
.slot-list { display: grid; gap: 8px; }
.slot-group { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; align-items: start; }
.slot-group > span { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-top: 7px; }
.chip.slot { min-width: 74px; justify-content: center; }
.appt-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.appt-flags:empty { display: none; }
.appt-flow { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.appt-flow li { position: relative; padding-top: 14px; font-size: 12px; }
.appt-flow li::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--line); }
.appt-flow li.on::before { background: var(--green); }
.appt-flow li strong { display: block; font-size: 12.5px; }
.appt-flow li small { display: block; color: var(--muted); font-size: 11.5px; }
.rem-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rem-head .field { margin: 0; }
.rem-head .chips { margin-bottom: 4px; }
.rem-progress { margin-left: auto; display: grid; grid-template-columns: auto auto; gap: 2px 6px; align-items: baseline; min-width: 140px; }
.rem-progress strong { font-size: 15px; }
.rem-progress span { font-size: 12px; color: var(--muted); }
.rem-progress i { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--green) var(--p), var(--line) var(--p)); }
.rem-row.done { opacity: .75; }
.rem-row { flex-wrap: wrap; }
.rem-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.rem-foot small { color: var(--muted); font-size: 12px; }

/* ---------- teeth picker in the prescription editor */
.mini-odo { overflow-x: auto; background: var(--tile); border-radius: 16px; padding: 8px 6px; scrollbar-width: thin; }
.mini-odo-inner { min-width: 500px; display: grid; gap: 4px; }
.mini-odo-inner.child { min-width: 360px; }
.mjaw { display: grid; grid-template-columns: 1fr 1fr; }
.mjaw.lower { border-top: 2px dashed var(--line-2); padding-top: 4px; }
.mquad { display: flex; justify-content: flex-end; padding-right: 3px; min-width: 0; }
.mquad + .mquad { justify-content: flex-start; padding: 0 0 0 3px; border-left: 2px solid var(--line-2); }
.mt { display: grid; justify-items: center; gap: 1px; flex: 1 1 0; min-width: 0; max-width: 40px; padding: 3px 0; border: 0; background: none; border-radius: 10px; cursor: pointer; color: inherit; }
.mt.lower .mt-n { order: 2; }
.mt:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mt.on { background: var(--primary); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent); }
.mt.on .mt-n { color: #fff; }
.mt-n { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.mt.has .mt-n { color: var(--text); }
.mt .tooth-art { height: 50px; width: auto; }
.rx-picked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.tooth-pick { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 4px; border-radius: 10px; background: var(--primary-50); color: var(--primary-600); font-size: 12px; font-weight: 600; }
.tooth-pick b { background: var(--primary); color: #fff; border-radius: 7px; padding: 1px 6px; font-size: 11.5px; }
.tooth-pick button { border: 0; background: none; padding: 0 2px; color: inherit; cursor: pointer; display: grid; place-items: center; }
.tooth-pick .ic { width: 13px; height: 13px; }
.work-chips { margin-top: 8px; }
.work-chips .chip .ic { width: 12px; height: 12px; }

/* ---------- prescription advice list */
.ic.rot90 { transform: rotate(90deg); }
.adv-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.adv-item { display: flex; align-items: center; gap: 6px; }
.adv-item .input { flex: 1; min-width: 0; min-height: 38px; }
.adv-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.adv-text .input { width: 100%; }
.adv-tr { font-size: 12.5px; color: var(--primary-600); padding-left: 4px; }
.adv-tr.none { color: var(--muted); font-style: italic; }
.rx-lang { display: grid; gap: 6px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--tile); }
.rx-lang small { font-size: 12px; }
.adv-n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.adv-empty { color: var(--muted); font-size: 12.5px; padding: 10px 12px; border: 1.5px dashed var(--line-2); border-radius: 12px; }
.adv-add { display: flex; gap: 8px; }
.adv-add .input { flex: 1; min-width: 0; }
.adv-chips .chip .chip-tick { display: none; width: 13px; height: 13px; }
.adv-chips .chip.on .chip-tick { display: inline-block; }

/* ---------- prescription history popup */
.last-rx { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--pink-50); flex-wrap: wrap; }
.last-rx .grow { flex: 1; min-width: 180px; }
.last-rx strong { display: block; font-size: 13px; }
.last-rx small { display: block; font-size: 12px; color: var(--text-2); }
.last-rx-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card); color: var(--pink-600); flex: none; }
.last-rx-ic .ic { width: 18px; height: 18px; }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--primary-50); color: var(--primary); font-size: 11px; font-weight: 700; margin-left: 2px; }
.rxh-modal .modal-body { padding: 0; }
.rxh { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: min(70vh, 760px); }
.rxh > .empty, .rxh > .loading { grid-column: 1 / -1; padding: 40px 20px; }
.rxh-list { border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; max-height: calc(100dvh - 160px); display: flex; flex-direction: column; gap: 4px; }
.rxh-list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.rxh-list-head strong { font-size: 13.5px; }
.rxh-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 0; background: none; border-radius: 14px; padding: 10px; cursor: pointer; color: inherit; width: 100%; }
.rxh-item:hover { background: var(--tile); }
.rxh-item.active { background: var(--primary-50); }
.rxh-item .grow { flex: 1; min-width: 0; }
.rxh-item strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rxh-item small { display: block; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rxh-item .rxh-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.rxh-date { flex: none; width: 46px; text-align: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 5px 0; line-height: 1.15; }
.rxh-date b { display: block; font-size: 12px; }
.rxh-date small { display: block; font-size: 10.5px; opacity: .75; color: #fff; -webkit-line-clamp: unset; }
.rxh-view { padding: 12px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; background: var(--tile); }
.rxh-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rxh-title { flex: 1; min-width: 0; }
.rxh-title strong { display: block; font-size: 14px; }
.rxh-title small { display: block; font-size: 12px; color: var(--muted); }
.rxh-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rxh-back { display: none; }
.rxh-preview { max-width: 620px; width: 100%; margin: 0 auto; }

/* ---------- doctors */
.doc-layout { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.doc-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.doc-card.is-off { opacity: .6; }
.doc-card-head { display: flex; gap: 12px; align-items: flex-start; }
.doc-card-head .grow { flex: 1; min-width: 0; }
.doc-card h3 { margin: 2px 0 3px; font-size: 15.5px; }
.doc-card-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.kv.compact { grid-template-columns: 18px minmax(0, 1fr); gap: 7px 10px; }
.kv.compact dt .ic { width: 15px; height: 15px; }
.doc-card-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.doc-card-foot a.tag { text-decoration: none; }
.access-pick { display: grid; gap: 8px; }
.access-opt { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; }
.access-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.access-opt input { flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--primary); }
.access-opt > span { flex: 1; min-width: 0; }
.access-opt strong { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.access-opt strong .ic { width: 15px; height: 15px; }
.access-opt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid var(--line); display: grid; place-items: center; cursor: pointer; font-size: 9.5px; font-weight: 700; color: var(--muted); }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ---------- admin panel: see "admin panel (2.10.3)" at the end */
.tags { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- permissions */
.perm-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.perm-head strong { display: block; font-size: 14px; }
.perm-head small { display: block; color: var(--muted); font-size: 12px; max-width: 360px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.perm-group { border: 0; margin: 0; padding: 0; display: grid; gap: 7px; align-content: start; }
.perm-group legend { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; padding: 0; }
.perm-group .check { font-size: 13px; align-items: flex-start; }
.perm-group .check input { margin-top: 1px; flex: none; }
.perm-group input:disabled + * , .perm-group .check:has(input:disabled) { color: var(--text-2); cursor: default; }
.perm-table th.perm-col, .perm-table td.perm-col { width: 108px; text-align: center; }
.perm-table th.perm-col .ic { width: 16px; height: 16px; display: block; margin: 0 auto 3px; }
.perm-table .perm-group-row th { background: var(--tile); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 8px 12px; }
.perm-on { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--purple-50); color: var(--purple); }
.perm-on .ic { width: 14px; height: 14px; }
.switch { position: relative; display: inline-block; width: 40px; height: 24px; cursor: pointer; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 1360px) {
  .dash { grid-template-columns: minmax(0, 1fr) 300px; }
  .editor { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 1220px) {
  .dchart { grid-template-columns: minmax(0, 1fr); }
  .dchart .tooth-panel { grid-column: 1; grid-row: auto; position: static; }
  .appt-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root { --side-w: 84px; }
  .side { padding: 22px 10px 16px; align-items: center; }
  .side-brand { padding: 2px 0 20px; }
  .side-brand div, .nav-group, .nav-item > span:not(.nav-ic), .nav-badge { display: none; }
  .nav-item { padding: 4px; justify-content: center; width: auto; }
  .nav-ic { width: 44px; height: 44px; }
  .side-foot { width: 100%; justify-items: center; }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-layout { grid-template-columns: minmax(0, 1fr); }
  .tooth-panel { position: static; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; max-width: 520px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .appt-layout { grid-template-columns: minmax(0, 1fr); }
  .appt-side { position: static; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .duo { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr) 180px; }
  .profile-head { grid-template-columns: auto minmax(0, 1fr); }
  .profile-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .med-row { grid-template-columns: repeat(3, minmax(0, 1fr)) 30px; }
  .med-row .field:first-child { grid-column: 1 / -1; }
  .item-row { grid-template-columns: minmax(0, 1fr) 70px 60px 30px; }
  .item-row .field:first-child { grid-column: 1 / -1; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone / installed app layout */
@media (max-width: 760px) {
  .dchart-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dc-stat { padding: 8px; }
  .lg-note { margin-left: 0; }
  .dc-visual { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .odonto2-inner { min-width: 540px; }
  .tcol { grid-template-rows: 14px 60px 22px 8px; border-radius: 10px; }
  .tcol.lower { grid-template-rows: 8px 22px 60px 14px; }
  .tcol-art { height: 60px; }
  .tcol-art .tooth-art { height: 60px; width: auto; }
  .tcol-map .tooth-svg { width: 20px; height: 20px; }
  .tcol-n { font-size: 10.5px; }
  .jaw::before { height: 16px; }
  .jaw.upper::before { top: 46px; }
  .jaw.lower::before { top: 55px; }
  .rxh { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .rxh-list { border-right: 0; max-height: none; }
  .rxh .rxh-view { display: none; }
  .rxh.viewing .rxh-list { display: none; }
  .rxh.viewing .rxh-view { display: flex; }
  .rxh-back { display: inline-flex; }
  .hide-sm { display: none !important; }
  .show-sm { display: inline; }
  .show-sm-inline { display: inline-block; width: auto; min-height: 36px; }
  .appt-side { display: flex; align-items: flex-start; overflow-x: auto; gap: 10px; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .appt-side .appt-cal { display: none; }
  .appt-side .day-sum, .appt-side .doc-filter { flex: none; padding: 10px 12px; }
  .appt-side .ds-head { display: none; }
  .appt-side .ds-rows { display: flex; gap: 4px; }
  .appt-side .ds-row { padding: 6px 10px; background: var(--tile); white-space: nowrap; }
  .appt-side .ds-row .grow { overflow: visible; }
  .appt-side .ds-row small, .appt-side .ds-note { display: none; }
  .queue { grid-template-columns: minmax(0, 1fr); }
  .q-col { min-height: 0; }
  .cal-toolbar .date-label { display: none; }
  .cal-toolbar .grow { display: none; }
  .cal-toolbar .seg { width: 100%; }
  .cal-toolbar .seg .seg-item { flex: 1; text-align: center; }
  .cal-toolbar #jump { flex: 1; }
  .slot-group { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .slot-group > span { padding-top: 0; }
  .appt-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .banner { flex-wrap: wrap; }
  .banner > span { flex: 1 1 200px; }
  .perm-grid { grid-template-columns: minmax(0, 1fr); }
  .perm-table th.perm-col, .perm-table td.perm-col { width: 64px; }
  .perm-head .seg { width: 100%; }
  body { background: var(--canvas); }
  .shell { display: block; }
  .side { display: none; }
  .canvas { margin: 0; border-radius: 0; padding: calc(10px + env(safe-area-inset-top)) 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
  .topbar { top: 0; margin: 0 -14px 16px; padding: calc(8px + env(safe-area-inset-top)) 14px 10px; background: var(--canvas); flex-wrap: wrap; gap: 10px; border-radius: 0; }
  .m-brand { display: block; }
  .m-brand .brand-mark-svg { width: 36px; height: 36px; display: block; }
  .m-title { display: block; flex: 1; font-weight: 700; font-size: 17px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .search-box { height: 42px; }
  .search .kbd { display: none; }
  .top-actions { margin-left: 0; gap: 8px; }
  .me-text { display: none; }
  .round-btn, .me-btn .avatar { width: 38px; height: 38px; }
  .round-btn.hide-sm { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--card); box-shadow: 0 -4px 24px rgba(28, 37, 49, .08); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none !important; }
  .tab .tab-ic { width: 40px; height: 30px; border-radius: 15px; display: grid; place-items: center; }
  .tab .ic { width: 22px; height: 22px; }
  .tab.active { color: var(--text); }
  .tab.active .tab-ic { background: var(--navy); color: #fff; }
  .page-head { margin-bottom: 14px; }
  .page-title { font-size: 22px; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1; }
  .greet { font-size: 21px; margin-bottom: 14px; }
  .card { padding: 16px; border-radius: 18px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .hero-art { position: absolute; right: -20px; top: 6px; width: 150px; opacity: .9; }
  .hero-num { font-size: 50px; margin: 10px 0 14px; }
  .hero-tile { min-width: 0; flex: 1; padding: 12px; }
  .hero-tile b { font-size: 24px; }
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ic { width: 38px; height: 38px; border-radius: 12px; }
  .stat-value { font-size: 18px; }
  .form-grid, .form-grid.c3, .form-grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .modal-layer { padding: 0; align-items: end; }
  .modal { width: 100% !important; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; transform: translateY(30px); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .table th, .table td { padding: 10px; }
  .table .hide-sm { display: none; }
  .profile-head { grid-template-columns: minmax(0, 1fr); text-align: left; }
  .profile-head > .avatar { width: 64px; height: 64px; }
  .profile-actions .btn { flex: 1 1 calc(50% - 8px); }
  .cal-wrap { max-height: calc(100dvh - 260px); }
  #toast-root { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); justify-items: stretch; }
  .toast { max-width: none; min-width: 0; }
  .med-row, .item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .med-row .field:first-child, .item-row .field:first-child { grid-column: 1 / -1; }
  .row-remove { position: absolute; top: 8px; right: 8px; }
  .totals { width: 100%; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .login-main { align-items: start; padding-top: calc(48px + env(safe-area-inset-top)); }
  .page-head .page-title { display: none; }
  .page-head .page-sub:first-child, .page-head > div:first-child:empty { margin-top: 0; }
  .profile-head { justify-items: center; text-align: center; }
  .profile-meta, .profile-flags { justify-content: center; }
  .odonto { padding: 12px 8px; }
  .odonto.child .odonto-inner { min-width: 0; }
  .odonto-inner { min-width: 500px; }
  .tooth-cell { width: 30px; padding: 4px 0 3px; border-radius: 9px; }
  .tooth-cell svg { width: 28px; height: 28px; }
  .tooth-cell .tn { font-size: 10.5px; }
  .arch-half.right { padding-right: 4px; }
  .arch-half.left { padding-left: 4px; }
  .tmarks { font-size: 8.5px; }
}

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

/* ------------------------------------------------ no zooming on phones */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
@media (max-width: 760px) and (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
}

/* ----------------------------------------------------------- lock screen */
.login-keep { font-size: 13px; color: var(--text-2); margin-top: -4px; }
body.is-locked { overflow: hidden; }
.lock-screen { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto;
  background: radial-gradient(1200px 600px at 20% -10%, var(--primary-50), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--purple-50), transparent 60%), var(--canvas); animation: lock-in .18s ease-out; }
@keyframes lock-in { from { opacity: 0; } to { opacity: 1; } }
.lock-card { width: min(340px, 100%); display: grid; justify-items: center; gap: 14px; text-align: center; }
.lock-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-2); font-size: 13.5px; }
.lock-brand svg, .lock-brand img { width: 30px; height: 30px; }
.lock-who { display: grid; justify-items: center; gap: 6px; margin-top: 8px; }
.lock-who strong { font-size: 18px; letter-spacing: -.01em; }
.lock-who small { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; }
.lock-who small .ic { width: 13px; height: 13px; }
.lock-pin, .lock-pw { width: 100%; display: grid; justify-items: center; gap: 12px; }
.lock-pw { justify-items: stretch; }
.lock-pw .pw-wrap input { width: 100%; text-align: center; letter-spacing: .08em; }
.lock-ask { margin: 6px 0 0; color: var(--text-2); font-weight: 600; }
.pin-dots { display: flex; gap: 14px; height: 18px; align-items: center; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); transition: background .12s, border-color .12s, transform .12s; }
.pin-dots i.on { background: var(--primary); border-color: var(--primary); transform: scale(1.08); }
.pin-dots.shake { animation: pin-shake .38s; }
@keyframes pin-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.lock-error { margin: 0; color: var(--red); font-size: 13px; font-weight: 600; min-height: 1em; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 22px; margin-top: 6px; }
.key { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 26px; font-weight: 600; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .08s, background .12s; font-variant-numeric: tabular-nums; }
.key:active { transform: scale(.94); background: var(--primary-50); }
.key-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.key .ic { width: 24px; height: 24px; }
.keypad > span { width: 72px; }
.lock-screen.busy .keypad { opacity: .55; pointer-events: none; }
.lock-links { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.lock-links .link-btn { font-size: 13px; }
@media (max-height: 640px) { .key { width: 60px; height: 60px; font-size: 22px; } .keypad { grid-template-columns: repeat(3, 60px); gap: 10px 20px; } .lock-who .avatar { display: none; } }

/* ------------------------------------------------- doctors' working days */
.sched-mode { margin: 2px 0 8px; }
.sched { display: grid; gap: 6px; }
.sched-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px 12px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--tile); }
.sched-row:not(.on) .sched-times { opacity: .4; }
.sched-day { font-weight: 700; align-items: center; }
.sched-day span small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; line-height: 1.2; }
.sched-times { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.sched-range { display: inline-flex; align-items: center; gap: 6px; }
.sched-range[hidden] { display: none; }
.field .sched-range .input { width: 116px; min-height: 36px; padding: 5px 8px; }
.sched-range > span { color: var(--muted); font-size: 12px; }
.sched-chip { font-weight: 600; color: var(--text); }
.off-day { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-50); }
.off-day p { margin: 0; font-size: 13px; color: var(--text-2); }
.off-day strong { color: var(--amber); }
.off-day .chip .ic { width: 14px; height: 14px; }
.ds-row.not-in .grow { color: var(--muted); }
.ds-row.not-in .doc-dot { opacity: .45; }
.mc-day.doc-in:not(.sel) { background: var(--primary-50); color: var(--primary); }
.mc-note { display: flex; align-items: center; gap: 7px; margin: 10px 2px 0; font-size: 12px; color: var(--muted); }
.cal-off.full span { position: sticky; top: 42%; display: block; width: max-content; max-width: 86%; margin: 0 auto; transform: none; left: auto; white-space: normal; text-align: center; text-transform: none; letter-spacing: 0; font-size: 11.5px; line-height: 1.35; }
@media (max-width: 760px) {
  .sched-row { grid-template-columns: 1fr; }
  .sched-range { width: 100%; }
  .field .sched-range .input { flex: 1; width: auto; min-width: 0; }
}

/* Next visit on the prescription */
.rv-chip em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 11.5px; }
.rv-chip.on em { color: inherit; }
.rv-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.rv-note.warn { color: var(--amber); }
.rv-note .link-btn { margin-left: 4px; }

/* ----------------------------------------------------- 2.3.0 shared bits */
.view-tabs { margin: -6px 0 16px; }
.chips.tight { gap: 6px; margin-top: 6px; }
.chips.tight .chip { height: 28px; padding: 0 10px; font-size: 12px; }
.pbar { height: 8px; border-radius: 6px; background: var(--tile-2); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 6px; background: var(--green); transition: width .3s; }
.pbar.sm { height: 6px; margin-bottom: 4px; width: 120px; }
.stat-btn { border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; outline-offset: 2px; }
.stat-btn.on { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.lab-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.lab-tabs .chip b { margin-left: 4px; font-weight: 700; color: var(--muted); }
.lab-tabs .chip.on b { color: inherit; }
.icon-btn.done { color: var(--amber); cursor: default; }

/* Treatment plan editor */
.plan-rows { display: grid; gap: 10px; }
.plan-row { display: grid; grid-template-columns: 70px minmax(160px, 2.4fr) minmax(70px, .8fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) 30px; gap: 8px; align-items: end; padding: 12px; border-radius: 14px; background: var(--tile); }
.plan-row.locked { background: var(--tile-2); }
.plan-row .field-label { font-size: 11.5px; }
.plan-row input, .plan-row select { min-height: 38px; padding: 7px 10px; font-size: 13.5px; }
.plan-row input[readonly] { background: var(--card); color: var(--muted); }
.pr-amt { display: flex; flex-direction: column; gap: 6px; padding-bottom: 9px; }
.pr-amt strong { font-size: 14px; }
.pr-rm { margin-bottom: 4px; }
.pr-state { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.plan-quick { margin-top: 12px; }
.plan-sum { display: flex; justify-content: flex-end; align-items: baseline; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.plan-sum span { color: var(--muted); font-weight: 600; }
.plan-sum strong { font-size: 22px; letter-spacing: -.01em; }
/* Estimate options (A, B, C) */
.opt-A { --opt: var(--primary); --opt-50: var(--primary-50); }
.opt-B { --opt: var(--purple); --opt-50: var(--purple-50); }
.opt-C { --opt: var(--amber); --opt-50: var(--amber-50); }
.opt-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--opt); color: #fff; font-size: 11px; font-weight: 800; flex: none; vertical-align: 1px; }
.plan-opts-box { margin-bottom: 12px; }
.plan-opt-toggle { align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line-2); }
.plan-opt-toggle input { margin-top: 2px; }
.plan-opt-toggle strong { display: block; font-size: 13.5px; }
.plan-opt-toggle small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.plan-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; align-items: stretch; }
.plan-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--opt-50); border: 1px solid transparent; }
.plan-opt:has(.icon-btn) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.plan-opt-fields { display: grid; gap: 6px; }
.plan-opt-fields .input { min-height: 36px; padding: 6px 10px; font-size: 13.5px; background: var(--card); }
.plan-opt-fields .input:first-child { font-weight: 600; }
.plan-opt-total { font-size: 15px; white-space: nowrap; }
.plan-opt-add { align-self: center; justify-self: start; }
.plan-row.with-opt { grid-template-columns: 70px 116px minmax(160px, 2.4fr) minmax(70px, .8fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) 30px; }
.plan-row.opt-row { box-shadow: inset 4px 0 0 var(--opt); background: color-mix(in srgb, var(--opt-50) 60%, var(--tile)); }
.plan-sum-opt { display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; }
.plan-sum .plan-sum-opt { color: var(--text); font-weight: 800; }
.plan-sum .opt-badge { color: #fff; }
.plan-optcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.plan-optcard { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--opt-50); border: 1.5px solid transparent; }
.plan-optcard.chosen { border-color: var(--opt); background: var(--card); }
.plan-optcard.not-chosen { opacity: .62; }
.plan-optcard .poc-top { display: flex; gap: 8px; align-items: flex-start; }
.plan-optcard .poc-top .grow { flex: 1; min-width: 0; }
.plan-optcard .poc-top strong { display: block; font-size: 14px; }
.plan-optcard .poc-top small { display: block; color: var(--text-2); font-size: 12px; }
.plan-optcard .poc-total { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.plan-optcard .btn { align-self: flex-start; }

/* Treatment plan view */
.plan-modal .modal-body { padding-top: 6px; }
.plan-view { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 22px; align-items: start; }
.plan-main { display: grid; gap: 16px; min-width: 0; }
.plan-top { display: flex; gap: 12px; align-items: flex-start; }
.plan-top h3 { margin: 0 0 4px; font-size: 18px; }
.plan-top p { margin: 0; }
.plan-progress { display: grid; gap: 8px; }
.plan-figs { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.plan-figs strong { color: var(--text); font-size: 14px; }
.plan-steps { display: grid; gap: 12px; }
.pv-head { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--tile); margin-bottom: 6px; }
.pv-row.is-off { opacity: .5; text-decoration: line-through; }
.pv-row .grow { flex: 1; min-width: 0; }
.pv-row strong { display: block; font-size: 13.5px; }
.pv-row small { display: block; color: var(--muted); font-size: 12px; }
.pv-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; color: #fff; }
.pv-dot.done { background: var(--green); border-color: var(--green); }
.pv-dot.doing { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--primary-50); }
.pv-dot .ic { width: 13px; height: 13px; stroke-width: 3; }
.pv-amt { text-align: right; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.pv-amt small { font-weight: 500; }
.pv-gap { width: 70px; flex: none; }
.plan-notes { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--tile); font-size: 13px; white-space: pre-wrap; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plan-side { position: sticky; top: 0; }
.plan-side .card-sub { margin-bottom: 8px; }

/* Lab work */
.lab-list { display: grid; gap: 8px; }
.lab-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tile); cursor: pointer; }
.lab-row:hover { background: var(--tile-2); }
.lab-row.late { box-shadow: inset 3px 0 0 var(--red); }
.lab-row .grow { flex: 1; min-width: 0; }
.lab-row strong { display: block; font-size: 14px; }
.lab-row small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; margin-top: 2px; }
.lab-row small .ic { width: 13px; height: 13px; }
.lab-row small a { color: inherit; font-weight: 600; }
.lab-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.lab-ic.ready { background: var(--green-50); color: var(--green); }
.lab-ic.late { background: var(--red-50); color: var(--red); }
.lab-due { font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.lab-acts { display: flex; gap: 6px; align-items: center; }

/* Recalls */
.rc-list { display: grid; gap: 8px; }
.rc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tile); }
.rc-row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rc-name { font-weight: 700; color: var(--text); text-decoration: none; font-size: 14px; }
.rc-row small { color: var(--muted); font-size: 12px; }
.rc-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rc-reason { font-size: 12px; padding: 3px 9px; border-radius: 999px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-reason b { font-weight: 700; margin-right: 3px; }
.rc-acts { display: flex; gap: 6px; align-items: center; flex: none; }

/* Dashboard follow-ups */
.todo { display: grid; gap: 6px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; color: inherit; text-decoration: none; }
.todo-row:hover { background: var(--tile); }
.todo-row .stat-ic { width: 36px; height: 36px; border-radius: 11px; }
.todo-row .stat-ic .ic { width: 17px; height: 17px; }
.todo-row strong { display: block; font-size: 13px; }
.todo-row small { display: block; color: var(--muted); font-size: 11.5px; }
.todo-row b { font-size: 15px; }
.todo-row .grow { flex: 1; min-width: 0; }
.todo-row > .ic { width: 16px; height: 16px; color: var(--muted); }

/* UPI */
.upi-box { display: grid; justify-items: center; gap: 10px; text-align: center; }
.upi-qr { width: 240px; max-width: 70vw; aspect-ratio: 1; padding: 6px; background: #fff; border-radius: 18px; border: 1px solid var(--line-2); box-sizing: border-box; }
.upi-qr svg { width: 100%; height: 100%; display: block; }
.upi-qr.sm { width: 132px; padding: 8px; border-radius: 12px; flex: none; }
.upi-amount { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.upi-box p { margin: 0; }
.upi-id strong { user-select: all; }
/* Paid more than the balance: what happens to the extra */
.extra-box { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--amber-50); border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }
.extra-box[hidden] { display: none; }
.extra-head { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); }
.extra-head .ic { width: 17px; height: 17px; color: var(--amber); flex: none; margin-top: 2px; }
.extra-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.extra-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.extra-opt input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.extra-opt b { display: block; font-size: 13.5px; }
.extra-opt small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.adv-note { align-items: center; }
.adv-note .btn { margin-left: auto; }
.adv-card .list-row strong.minus { color: var(--amber); }
.upi-payee { display: grid; gap: 4px; justify-items: center; }
.upi-payee strong { font-size: 15px; }
.upi-kind { display: inline-flex; align-items: flex-start; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--green); text-align: left; max-width: 340px; line-height: 1.4; }
.upi-kind .ic { margin-top: 1px; }
.upi-kind.warn { color: var(--amber); }
.upi-kind .ic { width: 15px; height: 15px; flex: none; }
.upi-amt-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.upi-amount { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.upi-amt-edit { display: flex; gap: 8px; }
.upi-amt-edit .input { width: 150px; }
.upi-scan { display: grid; gap: 2px; }
.upi-scan small { color: var(--muted); font-size: 12px; }
.upi-acc { width: 100%; text-align: left; }
.upi-idrow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--tile); text-align: left; box-sizing: border-box; }
.upi-idrow span { flex: 1; min-width: 0; display: grid; }
.upi-idrow small { font-size: 11px; color: var(--muted); font-weight: 600; }
.upi-idrow strong { font-size: 14px; overflow-wrap: anywhere; user-select: all; }
.upi-steps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.upi-steps li { padding: 8px 6px; border-radius: 12px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; display: grid; justify-items: center; gap: 4px; }
.upi-steps b { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; }
.upi-screen-on { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--green); }
.upi-screen-on .ic { width: 15px; height: 15px; }
.upi-modal .modal-foot { flex-wrap: wrap; }
.upi-modal .modal-foot .grow { flex: 1; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }
.upi-inline { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 12px; border-radius: 14px; background: var(--primary-50); border: 1px solid var(--primary-100); }
.upi-inline .grow { flex: 1; }
.upi-into { flex-basis: 100%; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.upi-into select { flex: 1; min-width: 0; }
.upi-inline .grow { min-width: 0; }
.upi-inline select { margin-top: 6px; max-width: 100%; }
.utr-warn { display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: var(--red-50); color: var(--text); font-size: 13px; }
.utr-warn .ic { color: var(--red); flex: none; }
.utr-warn strong { color: var(--red); display: block; }
.wa-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--green-50); font-weight: 600; font-size: 13.5px; }
.claim-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: 16px; background: var(--amber-50); border: 1px solid rgba(201,138,6,.35); margin-bottom: 14px; }
.claim-banner .grow { flex: 1; min-width: 220px; }
.claim-banner small { display: block; color: var(--text-2); }
.dc-upi { border: 1px solid var(--line); }
.dc-upi.off { border: 2px solid var(--amber); }
.dc-upi-note { padding: 10px 12px; border-radius: 12px; font-weight: 700; font-size: 13px; }
.dc-upi-note.ok { background: var(--green-50); color: var(--green); }
.dc-upi-note.off { background: var(--amber-50); color: var(--amber); }
.bk-adv { padding: 10px 12px; border-radius: 12px; background: var(--amber-50); font-size: 13px; }
.upi-acc-row { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr 1.2fr auto; gap: 8px; align-items: end; }
@media (max-width: 760px) { .upi-acc-row { grid-template-columns: 1fr 1fr; } }
.upi-test { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.upi-test .upi-qr { width: 170px; }
.upi-inline strong { display: block; font-size: 18px; }
.upi-inline small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* Reports: estimates */
.est-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.est-stats > div { padding: 12px 14px; border-radius: 14px; background: var(--tile); display: grid; gap: 2px; }

@media (max-width: 1100px) {
  .plan-view { grid-template-columns: 1fr; }
  .plan-side { position: static; }
}
@media (max-width: 760px) {
  .plan-row { grid-template-columns: 64px minmax(0, 1fr) 70px; }
  .plan-row .pr-proc { grid-column: 2 / 4; }
  .plan-row .pr-visit { grid-row: 1; }
  .plan-row .pr-tooth { grid-column: 1 / 2; }
  .plan-row .pr-fee { grid-column: 2 / 3; }
  .plan-row .pr-disc { grid-column: 3 / 4; }
  .plan-row .pr-amt { grid-column: 1 / 3; flex-direction: row; justify-content: space-between; padding: 0; }
  .plan-row .pr-rm { grid-column: 3; justify-self: end; }
  .plan-row.with-opt { grid-template-columns: 64px minmax(0, 1fr) 70px; }
  .plan-row.with-opt .pr-opt { grid-column: 1 / -1; grid-row: 2; }
  .plan-sum { flex-wrap: wrap; }
  .plan-sum-opt { margin-left: 8px; }
  .plan-opt { grid-template-columns: auto minmax(0, 1fr); }
  .plan-opt .plan-opt-total { grid-column: 2; }
  .pv-row { flex-wrap: wrap; }
  .pv-row .grow { flex: 1 1 60%; }
  .pv-gap { display: none; }
  .lab-row { flex-wrap: wrap; }
  .lab-row .grow { flex: 1 1 calc(100% - 52px); }
  .lab-due { margin-left: 50px; }
  .lab-acts { margin-left: auto; }
  .rc-row { flex-wrap: wrap; }
  .rc-row .grow { flex: 1 1 calc(100% - 52px); }
  .rc-acts { width: 100%; justify-content: flex-end; }
  .est-stats { grid-template-columns: 1fr 1fr; }
}

/* ===================================================== 2.4.0: money and stock */
/* Payment plan editor */
.inst-modal .modal-body { display: grid; gap: 14px; }
.inst-top .kv { grid-template-columns: auto 1fr auto 1fr; }
.inst-gen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); padding: 12px; border-radius: 14px; border: 1px dashed var(--line-2); margin-top: 14px; }
.inst-gen .input { width: auto; min-height: 38px; padding: 6px 10px; }
.inst-gen input[type=number] { width: 70px; }
.inst-rows { display: grid; gap: 6px; margin-top: 12px; }
.inst-head, .inst-row { display: grid; grid-template-columns: 26px 150px 120px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.inst-head { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.inst-row .input { min-height: 38px; padding: 6px 10px; }
.inst-no { font-weight: 700; color: var(--muted); text-align: center; font-size: 13px; }
.inst-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.inst-ok, .inst-off { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.inst-ok { color: var(--green); } .inst-off { color: var(--red); }
.inst-ok .ic { width: 16px; height: 16px; }
/* Payment plan card on the invoice */
.inst-progress { display: grid; gap: 6px; margin-bottom: 12px; }
.inst-progress .bar { height: 8px; border-radius: 6px; background: var(--tile-2); overflow: hidden; }
.inst-progress .bar span { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.inst-progress small { color: var(--muted); font-size: 12.5px; }
.inst-line.done { opacity: .62; }
.inst-badge { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--primary-50); color: var(--primary); flex: none; }
.inst-badge.red { background: var(--red-50); color: var(--red); } .inst-badge.amber { background: var(--amber-50); color: var(--amber); }
.btn-wa-ic { color: #1fa855; }
.inst-due .money-due { white-space: nowrap; }
.inst-due small a { color: inherit; font-weight: 600; }
.inst-acts { display: flex; gap: 6px; align-items: center; flex: none; }

/* Day-end */
.dc-date .input { width: auto; }
.dc-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dc-cash .card-title { display: flex; align-items: center; gap: 8px; }
.dc-lines { display: grid; gap: 2px; }
.dc-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.dc-lines small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.dc-lines .dc-expected { border-bottom: 0; border-top: 2px solid var(--text); margin-top: 4px; font-weight: 700; }
.dc-lines .dc-expected strong { font-size: 20px; }
.dc-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 12px; border-radius: 14px; background: var(--tile); }
.dc-notes label { display: grid; grid-template-columns: 54px 1fr; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; }
.dc-notes input { min-height: 36px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); width: 100%; font-size: 16px; }
.dc-notes b { grid-column: 2; font-size: 11.5px; color: var(--muted); font-weight: 600; min-height: 14px; }
.dc-diff:empty { display: none; }
.dc-diff .tag { font-size: 14px; padding: 6px 12px; }
.dc-methods { display: grid; gap: 2px; margin-bottom: 10px; }
.dc-methods > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.dc-methods > div:last-child { border-bottom: 0; }
.dc-methods small { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* Expenses and payouts */
.exp-quick { margin-top: -6px; }
.exp-quick .chip { height: 28px; font-size: 12px; }
.exp-cats-sum { margin-bottom: 14px; }
.exp-cats-sum .chip b { color: var(--text); }
.radio-cards { display: grid; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.radio-card input { margin-top: 3px; accent-color: var(--primary); }
.radio-card strong { display: block; font-size: 13.5px; }
.radio-card small { color: var(--muted); font-size: 12px; }
.po-month .input { width: auto; }
.po-table td small { display: block; }
.po-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.po-summary > div { padding: 10px 12px; border-radius: 12px; background: var(--tile); display: grid; gap: 2px; }
.po-summary span { font-size: 12px; color: var(--muted); font-weight: 600; }
.po-summary strong { font-size: 15px; }
.po-summary .hl { background: var(--primary-50); } .po-summary .hl strong { color: var(--primary-600); }
.po-summary .due strong { color: var(--red); }
.bar-pair i.spent { background: var(--red); }

/* Stock */
.st-row { flex-wrap: nowrap; }
.st-row.low { box-shadow: inset 3px 0 0 var(--amber); }
.st-row.out { box-shadow: inset 3px 0 0 var(--red); }
.st-row small { display: flex; align-items: center; gap: 5px; }
.st-row small .ic { width: 13px; height: 13px; }
.st-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--amber-50); color: var(--amber); flex: none; }
.st-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 90px; }
.st-qty strong { font-size: 17px; display: inline; }
.st-qty small { display: inline; }
.st-acts { display: flex; gap: 6px; align-items: center; flex: none; }
.st-acts .btn .ic { width: 15px; height: 15px; }
.st-now { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.st-now span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.st-now strong { font-size: 18px; }
.st-now small { color: var(--muted); font-size: 12px; }
.st-qty-ro { min-height: 42px; display: grid; align-content: center; font-weight: 700; }
.st-qty-ro small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.st-move .tag { flex: none; }

@media (max-width: 1000px) {
  .dc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .inst-top .kv { grid-template-columns: auto 1fr; }
  .inst-head { display: none; }
  .inst-row { grid-template-columns: 18px minmax(150px, 1fr) 96px 30px; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .inst-row .input { padding: 6px 8px; }
  .inst-row [data-k=note] { grid-column: 2 / 4; grid-row: 2; }
  .inst-gen { font-size: 13px; }
  .dc-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .dc-notes label { grid-template-columns: 46px minmax(0, 1fr); font-size: 12.5px; }
  .st-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: start; }
  .st-qty { min-width: 0; }
  .st-acts { grid-column: 1 / -1; justify-content: flex-end; }
  .inst-due { flex-wrap: wrap; }
  .inst-due .grow { flex: 1 1 calc(100% - 120px); }
  .inst-acts { width: 100%; justify-content: flex-end; }
  .po-summary { grid-template-columns: 1fr 1fr; }
}

/* ===================================================== 2.5.0 */
/* Before and after */
.cmp-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.cmp-slider { position: relative; width: 100%; height: min(62vh, 560px); background: #111; border-radius: 14px; overflow: hidden; touch-action: none; user-select: none; cursor: ew-resize; }
.cmp-slider img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.cmp-before-clip { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pct)) 0 0); }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--pct); width: 0; }
.cmp-handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.5); }
.cmp-handle span { position: absolute; top: 50%; left: -18px; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.cmp-handle span::before, .cmp-handle span::after { content: ''; position: absolute; top: 12px; border: 6px solid transparent; }
.cmp-handle span::before { left: 3px; border-right-color: #333; }
.cmp-handle span::after { right: 3px; border-left-color: #333; }
.cmp-range { position: absolute; left: 0; right: 0; bottom: 8px; width: 60%; margin: 0 auto; opacity: 0; }
.cmp-range:focus-visible { opacity: 1; }
.cmp-tag { position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12.5px; font-weight: 600; }
.cmp-tag.l { left: 10px; } .cmp-tag.r { right: 10px; }
.cmp-side { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-side figure { margin: 0; display: grid; gap: 6px; }
.cmp-side img { width: 100%; height: min(52vh, 460px); object-fit: contain; background: #111; border-radius: 12px; }
.cmp-side figcaption { font-size: 13px; color: var(--text-2); }
.cmp-strip { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 10px; }
.cmp-strip-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cmp-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.cmp-thumb { flex: none; width: 64px; border: 2px solid transparent; border-radius: 10px; padding: 0; background: var(--tile); overflow: hidden; display: grid; }
.cmp-thumb img { width: 100%; height: 48px; object-fit: cover; }
.cmp-thumb small { font-size: 10.5px; color: var(--muted); padding: 1px 0 2px; }
.cmp-thumb.on { border-color: var(--primary); }
/* Share PDF */
.share-file { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--tile); }
.share-file .grow { flex: 1; min-width: 0; }
.share-file strong { display: block; font-size: 13.5px; overflow-wrap: anywhere; }
.share-file small { color: var(--muted); font-size: 12px; }
.share-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--red-50); color: var(--red); display: grid; place-items: center; flex: none; }
.share-acts { display: grid; gap: 8px; margin-top: 12px; }
.share-tip { margin: 2px 0 0; }
/* Consent forms */
.cns-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.cns-steps span { flex: 1; text-align: center; padding: 7px; border-radius: 10px; background: var(--tile); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.cns-steps span.on { background: var(--primary-50); color: var(--primary-600); }
.cns-tpls .chip { height: auto; min-height: 32px; padding: 5px 12px; text-align: left; }
.cns-text { font-size: 14px; line-height: 1.55; }
.cns-read { max-height: 38vh; overflow-y: auto; padding: 14px 16px; border-radius: 14px; background: var(--tile); margin-bottom: 14px; }
.cns-read h3 { margin: 0 0 2px; font-size: 17px; }
.cns-read-text p { margin: 0 0 6px; font-size: 15px; line-height: 1.6; }
.cns-read-text p.pt { padding-left: 10px; }
.cns-agree { margin: 12px 0; font-size: 14px; align-items: flex-start; }
.cns-agree input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.cns-pad-wrap { position: relative; border: 2px dashed var(--line-2); border-radius: 16px; background: #fff; margin-bottom: 12px; }
.cns-pad { display: block; width: 100%; height: 190px; touch-action: none; border-radius: 14px; cursor: crosshair; }
.cns-pad-hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #9aa6b5; font-size: 15px; pointer-events: none; }
.cns-pad-wrap::after { content: ''; position: absolute; left: 18px; right: 18px; bottom: 44px; border-bottom: 1.5px solid #c9d2dc; pointer-events: none; }
.cns-pad-acts { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.cns-row.void { opacity: .6; }
.cns-row { cursor: pointer; }
.bg-grey { background: var(--grey-50); color: var(--muted); }
@media (max-width: 760px) {
  .consent-modal .cns-pad { height: 170px; }
  .cmp-side { grid-template-columns: 1fr; }
  .cmp-side img { height: 34vh; }
  .cmp-slider { height: 50vh; }
}
/* Online booking requests */
.count-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.bk-reqs { display: grid; gap: 10px; }
.bk-req { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--tile); }
.bk-req.done { opacity: .75; }
.bk-req-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.bk-req-main > strong { font-size: 14.5px; }
.bk-req-main > small { color: var(--muted); font-size: 12px; }
.bk-req-when { font-size: 13px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.bk-req-when .ic { width: 15px; height: 15px; color: var(--primary); }
.bk-req-match { font-size: 12.5px; display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; color: var(--text-2); margin-top: 3px; }
.bk-req-match .ic { width: 14px; height: 14px; }
.bk-req-match label { display: inline-flex; gap: 5px; align-items: center; }
.bk-req-match small { color: var(--muted); }
.bk-req-done { font-size: 12.5px; color: var(--green); display: flex; gap: 5px; align-items: center; }
.bk-req-done .ic { width: 14px; height: 14px; }
.bk-req-acts { display: flex; gap: 6px; align-items: center; flex: none; }
@media (max-width: 760px) {
  .bk-req { flex-wrap: wrap; }
  .bk-req-acts { width: 100%; justify-content: flex-end; }
}
/* Automatic messages */
.au-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.au-tpl { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--tile); align-content: start; }
.au-tpl-head strong { display: block; font-size: 14px; }
.au-tpl-head small { color: var(--muted); font-size: 12px; }
.au-tpl-body, .au-cmd > div { display: flex; gap: 6px; align-items: flex-start; }
.au-tpl-body code, .au-cmd code { flex: 1; min-width: 0; display: block; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, monospace; }
.au-cmd { display: grid; gap: 4px; margin-bottom: 12px; }
.bk-link .inline-actions { flex-wrap: wrap; }

/* Demo data */
.demo-lead { margin: 0 0 12px; font-size: 14px; }
.demo-what { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.demo-what li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.4; }
.demo-what .ic { width: 18px; height: 18px; flex: none; color: var(--primary-600); margin-top: 1px; }
.demo-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.demo-counts div { background: var(--tile); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.demo-counts b { font-size: 20px; line-height: 1.2; }
.demo-counts span { font-size: 12px; color: var(--muted); }
.demo-banner .icon-btn { margin-left: 4px; }
@media (max-width: 560px) {
  .demo-what { grid-template-columns: 1fr; }
  .demo-counts { grid-template-columns: repeat(2, 1fr); }
}

/* Clinic logo */
.brand-logo-img { object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; box-shadow: 0 0 0 1px var(--line); }
.logo-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 200px; height: 96px; border: 1px dashed var(--line-2); border-radius: 14px; background: #fff; padding: 10px; flex: none; overflow: hidden; box-sizing: border-box; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.logo-preview.std { opacity: .85; }
.logo-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.brand-logo-wide { display: block; height: 44px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.side-brand .brand-logo-wide { height: 46px; max-width: 190px; }
.login-brand .brand-logo-wide { height: 58px; max-width: 280px; }
.m-brand .brand-logo-wide { height: 34px; max-width: 130px; }
.lock-brand .brand-logo-wide { height: 50px; max-width: 240px; margin: 0 auto; }
.perm-table th.perm-col small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.perm-table th.perm-col { vertical-align: top; }
.perm-role-menu { margin: 2px auto 0; }
.perm-wrap { overflow-x: auto; }

/* Profit: clickable lines */
.hbar-link { width: calc(100% + 16px); margin: -6px -8px; padding: 6px 8px; border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.hbar-link:hover, .hbar-link:focus-visible { background: var(--tile); }
.hbar-link strong { display: inline-flex; align-items: center; gap: 4px; }
.hbar-link strong .ic { width: 14px; height: 14px; color: var(--muted); }
tr.row-link[data-goto-month] { cursor: pointer; }

/* Doctor payouts: how it works */
.how-card { padding: 14px 18px; margin-bottom: 16px; }
.how-card summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; }
.how-card summary::-webkit-details-marker { display: none; }
.how-card summary .ic { width: 18px; height: 18px; color: var(--primary-600); }
.how-card summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; order: 2; }
.how-card summary > span { order: 3; flex-basis: 100%; padding-left: 26px; }
.how-card:not([open]) summary::after { transform: rotate(-90deg); }
.how-steps { margin: 12px 0 2px; padding-left: 20px; display: grid; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.how-steps ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.how-example { margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--primary-50); color: var(--text); }

/* Appointments: doctors list never wider than its card */
.ds-rows { grid-template-columns: minmax(0, 1fr); }
.ds-row { min-width: 0; }
.ds-row small { white-space: normal; }

/* Reports: period bar, KPI tiles, period table, profit and loss */
.rep-bar { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(140px, .8fr) minmax(140px, .8fr) auto; gap: 12px 14px; align-items: end; padding: 14px 18px; margin-bottom: 18px; }
.rep-bar .field { margin: 0; min-width: 0; }
.rep-bar .input { width: 100%; min-width: 0; }
.rep-bar .seg { flex-wrap: nowrap; }
.rep-tabs { margin-top: 0; width: max-content; max-width: 100%; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-grid.kpi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid .stat { min-width: 0; }
.kpi-grid .stat > span:last-child { min-width: 0; }
.kpi-grid .stat-value { overflow-wrap: anywhere; }
.rep-bars { gap: 6px; height: 210px; }
.rep-bars .bar-pair { gap: 2px; }
.rep-bars .bar-pair i { width: 30%; max-width: 18px; border-radius: 5px 5px 2px 2px; }
.rep-bars .bar-col small { white-space: nowrap; font-size: 10.5px; }
.table tfoot th { background: var(--tile); color: var(--text); font-size: 13px; font-weight: 700; border-top: 2px solid var(--line-2); padding: 11px 14px; }
.table tfoot th.num { text-align: right; }
.money-ok { color: var(--green); }
.muted-num { color: var(--muted); }
.delta { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.pnl-card .card-head { align-items: flex-end; }
.rep-compare { margin: 0; min-width: 210px; }
.pnl-screen td:first-child { padding-left: 30px; }
.pnl-screen .pnl-sec td { padding: 10px 14px; background: var(--tile); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.pnl-screen .pnl-total td { font-weight: 700; border-top: 2px solid var(--line-2); }
.pnl-screen .pnl-total td:first-child, .pnl-screen .pnl-grand td:first-child, .pnl-screen .pnl-pct td:first-child { padding-left: 14px; }
.pnl-screen .pnl-grand td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--text); border-bottom: 4px double var(--text); background: var(--primary-50); }
.pnl-screen .pnl-pct td { color: var(--muted); font-style: italic; border-top: 0; padding-top: 8px; }
.pnl-screen th:not(:first-child), .pnl-screen td:not(:first-child) { width: 1%; min-width: 120px; }
.pnl-kv { grid-template-columns: minmax(0, 1fr) auto; }
.pnl-kv dd { text-align: right; white-space: nowrap; }
.ybar { display: grid; gap: 3px; }
.ybar i { display: block; height: 7px; border-radius: 4px; min-width: 2px; }
@media (max-width: 1100px) {
  .rep-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-bar .rep-period { grid-column: 1 / -1; }
  .rep-bar > .field:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .rep-bar { padding: 12px 14px; gap: 10px; }
  .rep-bar .seg { width: 100%; }
  .rep-bar .seg-item { flex: 1; }
  .rep-bar .seg-item span { justify-content: center; text-align: center; padding-left: 6px; padding-right: 6px; }
  .rep-tabs { width: auto; }
  .kpi-grid, .kpi-grid.kpi-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid.kpi-3 .stat:last-child { grid-column: 1 / -1; }
  .kpi-grid .stat { padding: 12px; gap: 10px; }
  .rep-bars { height: 170px; gap: 3px; }
  .pnl-screen td:first-child { padding-left: 18px; }
  .pnl-screen th:not(:first-child), .pnl-screen td:not(:first-child) { min-width: 0; }
  .pnl-screen th, .pnl-screen td { padding: 9px 8px; font-size: 12.5px; white-space: nowrap; }
  .pnl-screen td:first-child { min-width: 150px; white-space: normal; }
  .pnl-screen .pnl-grand td { font-size: 13.5px; }
  .rep-compare { min-width: 0; width: 100%; }
  .pnl-card .inline-actions { width: 100%; }
}

/* Settings > Printing: letterhead and prescription designs */
.design-pick { display: grid; gap: 10px; }
.dp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 6px; }
.dp-head .field-label { margin: 0; }
.dp-head .field-hint { margin: 0; }
.dp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.dp-opt { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.dp-opt:hover { border-color: var(--line-2); }
.dp-opt input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.dp-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100, rgba(47, 111, 192, .18)); }
.dp-opt:has(input:checked)::after { content: ''; position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 13px no-repeat; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.dp-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.dp-thumb { display: block; border-radius: 8px; border: 1px solid var(--line); background: #fff; min-height: 60px; }
.dp-thumb.sheet-preview { box-shadow: none; }
.dp-text { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 2px; min-width: 0; }
.dp-text strong { font-size: 13.5px; }
.dp-text small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.dp-colours { display: flex; flex-wrap: wrap; gap: 8px; }
.dp-colour { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; }
.dp-colour input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.dp-colour i { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.dp-colour:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100, rgba(47, 111, 192, .18)); }
.dp-colour:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.dp-full { width: 100%; max-width: 640px; margin: 0 auto; }
@media (max-width: 760px) {
  .dp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dp-opt { padding: 6px; gap: 6px; }
  .dp-text small { display: none; }
}

/* Medical history: form, profile card and banners */
.mh-form { display: grid; gap: 16px; }
.mh-form .field { margin: 0; }
.mh-conds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); }
.mh-cond { font-size: 13px; font-weight: 500; align-items: flex-start; line-height: 1.3; padding: 3px 0; }
.mh-cond input { flex: none; min-height: 0; height: 18px; margin: 0; }
.mh-conds .mh-cond { min-height: 0; align-items: center; }
.mh-med-head { margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.mh-med-head span:last-child { width: 30px; }
.mh-cond.is-alert:has(input:checked) { color: var(--red); font-weight: 650; }
.mh-meds { display: grid; gap: 8px; margin-bottom: 8px; }
.mh-med { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .7fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.mh-med .input { min-width: 0; }
.mh-doc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mh-card { container: mh / inline-size; }
.mh-card .card-head { margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.mh-card .card-title { display: flex; align-items: center; gap: 8px; }
.mh-card .card-title .ic { width: 18px; height: 18px; color: var(--red); }
.mh-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, 1fr); gap: 18px; }
.mh-col { min-width: 0; }
.mh-col + .mh-col { border-left: 1px solid var(--line); padding-left: 18px; }
.mh-allergy { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--tile); color: var(--muted); }
.mh-allergy.on { background: var(--red-50); color: var(--red); }
.mh-allergy.none { background: var(--green-50); color: var(--green); }
.mh-allergy small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.mh-allergy strong { display: block; color: var(--text); font-size: 14px; }
.mh-allergy.on strong { color: var(--red); }
.mh-block { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.mh-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.mh-chip-alert { background: var(--amber-50) !important; color: var(--amber) !important; border-color: transparent !important; font-weight: 650; }
.mh-card .chip { height: 30px; cursor: default; }
.mh-card .chip:hover { border-color: var(--line-2); color: var(--text-2); }
.mh-card .chip.mh-chip-alert:hover { color: var(--amber); }
.mh-card .chip .ic { width: 14px; height: 14px; }
.mh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mh-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 7px 8px; background: var(--tile); white-space: nowrap; }
.mh-table th:first-child { border-radius: 8px 0 0 8px; } .mh-table th:last-child { border-radius: 0 8px 8px 0; }
.mh-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
.mh-table tr:last-child td { border-bottom: 0; }
.mh-table td:first-child { color: var(--text); display: flex; align-items: center; gap: 10px; }
.mh-med-name { display: flex; flex-direction: column; min-width: 0; }
.mh-med-name strong { font-size: 13.5px; }
.mh-med-name small { font-size: 12px; color: var(--primary); font-weight: 600; }
.mh-meta { display: none; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mh-pill { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--purple-50); color: var(--purple); }
.mh-pill .ic { width: 14px; height: 14px; }
.mh-doc-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.mh-doc-card .grow { min-width: 0; flex: 1; }
.mh-doc-card strong { display: block; font-size: 14px; }
.mh-doc-card small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.mh-call { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.mh-call .ic { width: 14px; height: 14px; }
.mh-doc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--green-50); color: var(--green); }
.mh-text { margin: 0; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
@container mh (max-width: 820px) {
  .mh-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mh-col-meds { grid-column: 1 / -1; grid-row: 1; border-left: 0 !important; padding-left: 0 !important; }
  .mh-col-meds ~ .mh-col { border-left: 1px solid var(--line); }
  .mh-grid > .mh-col:first-child { border-left: 0; padding-left: 0; grid-row: 2; }
  .mh-grid > .mh-col:last-child { grid-row: 2; }
}
@container mh (max-width: 560px) {
  .mh-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .mh-grid > .mh-col, .mh-grid > .mh-col:first-child, .mh-grid > .mh-col:last-child { grid-row: auto; border-left: 0; padding-left: 0; }
  .mh-col + .mh-col, .mh-col-meds ~ .mh-col { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .mh-grid > .mh-col-meds { order: 2; } .mh-grid > .mh-col:first-child { order: 1; } .mh-grid > .mh-col:last-child { order: 3; }
  .mh-table thead { display: none; }
  .mh-table, .mh-table tbody, .mh-table tr, .mh-table td { display: block; width: 100%; }
  .mh-table tr { padding: 9px 10px; border-radius: 12px; background: var(--tile); margin-bottom: 6px; }
  .mh-table td { border: 0; padding: 0; }
  .mh-table td:first-child { display: flex; }
  .mh-table td:not(:first-child) { display: none; }
  .mh-table .mh-meta { display: block; }
}
.mh-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--primary-50); color: var(--primary); margin-bottom: 12px; font-size: 13px; }
.mh-banner.is-alert { background: var(--amber-50); color: var(--amber); }
.mh-banner > span { flex: 1; min-width: 0; color: var(--text); line-height: 1.45; }
.mh-banner > .ic { flex: none; }
.mh-banner strong { color: var(--amber); }
@media (max-width: 760px) {
  .mh-med { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
  .mh-med-head { display: none; }
  .mh-med [data-k=name] { grid-column: 1 / 3; }
  .mh-med [data-mh=remove] { grid-column: 3; grid-row: 1; }
  .mh-med [data-k=dose] { grid-column: 1; grid-row: 2; }
  .mh-med [data-k=reason] { grid-column: 2 / -1; grid-row: 2; }
  .mh-med [data-k=since] { grid-column: 1; grid-row: 3; }
  .mh-med [data-k=doctor] { grid-column: 2 / -1; grid-row: 3; }
  .mh-doc { grid-template-columns: minmax(0, 1fr); }
  .mh-conds { grid-template-columns: minmax(0, 1fr); }
}

/* Notifications: badge on Appointments, the Notifications dialog */
.nav-item, .tabbar .tab { position: relative; }
.nav-badge { position: absolute; top: 6px; left: 30px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card); pointer-events: none; }
.tabbar .tab .nav-badge { top: 2px; left: calc(50% + 6px); }
.nt-state { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; margin-bottom: 14px; }
.nt-state.tone-green { background: var(--green-50); } .nt-state.tone-amber { background: var(--amber-50); } .nt-state.tone-red { background: var(--red-50); } .nt-state.tone-blue { background: var(--primary-50); }
.nt-state strong { display: block; color: var(--text); font-size: 14.5px; }
.nt-state small { display: block; color: var(--text-2); font-size: 13px; line-height: 1.45; margin-top: 2px; }
.nt-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--card); }
.nt-state.tone-green .nt-ic { color: var(--green); } .nt-state.tone-amber .nt-ic { color: var(--amber); } .nt-state.tone-red .nt-ic { color: var(--red); } .nt-state.tone-blue .nt-ic { color: var(--primary); }
.nt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.nt-actions:empty { display: none; }
.nt-what, .nt-devices { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.nt-row, .nt-dev { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.nt-row > .ic { color: var(--primary); flex: none; }
.nt-row strong, .nt-dev strong { display: block; font-size: 13.5px; }
.nt-row small, .nt-dev small { display: block; color: var(--muted); font-size: 12.5px; }
.nt-dev + .nt-dev { border-top: 1px solid var(--line); }
.nt-dev .grow { flex: 1; min-width: 0; }
.nt-dev .tag { margin-left: 6px; vertical-align: 1px; }
.nt-hint { margin-bottom: 12px; }
.nt-hint > span { flex: 1; }
.bk-alerts { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); }
.bk-alerts .check { align-items: flex-start; }
.bk-alerts .check input { margin-top: 1px; flex: none; }

/* ------------------------------------------------- patient barcode scanner */
.scan-view { position: relative; border-radius: 16px; overflow: hidden; background: #0b0f14; aspect-ratio: 4 / 3; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-guide { position: absolute; inset: 25% 8%; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .38); border: 2px solid rgba(255, 255, 255, .9); }
.scan-guide i { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff4d4d; box-shadow: 0 0 10px #ff4d4d; animation: scanLine 1.8s ease-in-out infinite; }
@keyframes scanLine { 0%, 100% { transform: translateY(-26px); } 50% { transform: translateY(26px); } }
.scan-status { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 12px; background: rgba(11, 15, 20, .72); color: #fff; font-size: 13px; font-weight: 500; }
.scan-status .ic { width: 17px; height: 17px; flex: none; }
.scan-status[data-tone="error"] { background: rgba(179, 52, 58, .9); }
.scan-status[data-tone="ok"] { background: rgba(28, 138, 76, .9); }
.scan-help { margin: 12px 0 4px; line-height: 1.5; }
.scan-type { margin-top: 10px; }
.scan-type input { text-transform: uppercase; letter-spacing: .04em; }
.scan-type input::placeholder { text-transform: none; letter-spacing: 0; }

/* --------------------------------------------------------- patient notes */
.pnote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pnote-card { display: flex; flex-direction: column; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 0; overflow: hidden; transition: border-color .15s, box-shadow .15s; color: inherit; }
.pnote-card:hover { border-color: var(--primary-100); box-shadow: var(--shadow); }
.pnote-thumb { display: block; height: 150px; background: #fff; border-bottom: 1px solid var(--line); overflow: hidden; }
.pnote-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.pnote-text { padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #344054; white-space: pre-wrap; background: #fffdf3; }
.pnote-text em { color: var(--muted); }
.pnote-info { display: grid; gap: 4px; padding: 10px 14px 12px; }
.pnote-info strong { font-size: 14px; display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnote-info small { color: var(--muted); font-size: 12px; }
.pnote-info .pnote-snip { color: var(--text-2); }
.pnote-amt { justify-self: start; }
.pnote-pin { color: var(--amber); display: inline-flex; }
.pnote-pin .ic, .pnote-row strong .ic { width: 15px; height: 15px; color: var(--amber); vertical-align: -2px; }
.pnote-row { border: 0; width: 100%; text-align: left; background: none; }
.pnote-row-thumb { width: 52px; height: 40px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: #fff; flex: none; }
.pnote-row-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }

/* Note editor: as big as the screen allows, so there is room to write */
.modal.note-modal { width: min(1200px, 100%); height: calc(100vh - 40px); height: calc(100dvh - 40px); }
.note-modal .modal-head { padding-bottom: 6px; }
.note-modal .modal-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.note-modal .modal-body, .note-ed, .note-top, .note-bar { min-width: 0; max-width: 100%; }
.note-meta { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.note-modal .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 10px; }
.note-modal .modal-foot { padding-top: 10px; padding-bottom: 12px; align-items: center; }
.note-ed { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.note-ed .form-error { margin: 0; }
.note-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note-who { font-weight: 600; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.note-who small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.note-top input[name=title] { flex: 1 1 240px; min-width: 0; }
.note-amt { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); padding-left: 12px; min-height: 44px; flex: 0 1 190px; }
.note-amt span { font-weight: 700; color: var(--text-2); }
.note-amt input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; height: 42px; padding: 0 10px 0 8px; font-weight: 600; box-shadow: none; }
.note-amt:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.note-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note-mode button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--text-2); min-height: 38px; }
.note-mode button .ic { width: 17px; height: 17px; }
.note-mode button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.note-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mode-text .note-tools { display: none; }
.tool-group { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--tile); }
.tool-group:empty, .tool-group[hidden] { display: none; }
.tool { width: 40px; height: 38px; border: 0; border-radius: 9px; background: none; display: grid; place-items: center; color: var(--text-2); }
.tool .ic { width: 19px; height: 19px; }
.tool:disabled { opacity: .35; }
.tool.on { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.tool.swatch i { width: 20px; height: 20px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.tool.swatch.on i { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px currentColor; }
.tool.size i { display: block; border-radius: 50%; background: currentColor; }
.note-ink { flex: 1; min-height: 240px; position: relative; border-radius: 14px; background: var(--tile); display: flex; align-items: flex-start; justify-content: center; overflow: hidden; }
.mode-text .note-ink { position: absolute; visibility: hidden; pointer-events: none; width: 1px; height: 1px; min-height: 0; }
.ink-page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(28, 37, 49, .16); border-radius: 4px; overflow: hidden; }
.ink-page canvas { position: absolute; inset: 0; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ink-live { cursor: crosshair; }
.ink-cursor { position: absolute; left: 0; top: 0; margin: -14px 0 0 -14px; border: 1.5px solid #555; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, .4); }
.note-text { flex: 1; min-height: 200px; resize: none; font-size: 15.5px; line-height: 1.6; padding: 14px 16px; border-radius: 14px; }
.mode-ink .note-text { display: none; }
.note-hint { font-size: 12px; color: var(--muted); min-height: 16px; }
.note-pin { font-size: 13px; }
.note-pin .ic { width: 16px; height: 16px; color: var(--amber); }
@media (max-width: 900px) {
  .note-modal-open .modal-layer, .modal-layer:has(.note-modal) { padding: 0; }
  .modal.note-modal { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .note-modal .modal-body { padding-left: 12px; padding-right: 12px; }
  .note-modal .modal-foot { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .note-who { display: none; }
  .note-meta { display: none; }
  .note-amt { flex: 1 1 140px; }
}
@media (max-width: 560px) {
  .note-modal .modal-foot .btn { padding-left: 12px; padding-right: 12px; }
  .note-pin { order: -1; width: 100%; }
  .tool { width: 36px; }
}
.upi-kinds { display: grid; gap: 8px; }
.lic-feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.lic-feat { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--tile); color: var(--muted); font-size: 13px; }
.lic-feat.on { background: var(--green-50); color: var(--text); }
.lic-feat .ic { width: 16px; height: 16px; flex: none; }
.lic-feat.on .ic { color: var(--green); }

/* ------------------------------------------------------------ owner view */
.owner { display: grid; gap: 16px; max-width: 1100px; }
.owner .card { margin: 0; }
.ow-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ow-day { display: flex; align-items: center; gap: 6px; }
.ow-date { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; cursor: pointer; }
.ow-date input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.ow-hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px 22px 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #3a89e4 0%, #2a5fb0 38%, #1d2f4f 100%); box-shadow: var(--shadow-lg); }
.ow-hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 36px solid rgba(255,255,255,.06); pointer-events: none; }
.ow-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; opacity: .9; }
.ow-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.16); font-size: 12px; }
.ow-pill .ic { width: 14px; height: 14px; }
.ow-big { font-size: clamp(34px, 9vw, 48px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 14px; }
.ow-split { display: flex; height: 8px; border-radius: 6px; overflow: hidden; gap: 2px; background: rgba(255,255,255,.12); }
.ow-split i { display: block; height: 100%; }
.ow-split i.tone-green, .ow-methods .dot.tone-green { background: #4fd69c; } .ow-split i.tone-purple, .ow-methods .dot.tone-purple { background: #b3a9ff; }
.ow-split i.tone-blue, .ow-methods .dot.tone-blue { background: #9ccbff; } .ow-split i.tone-amber, .ow-methods .dot.tone-amber { background: #ffcf6e; }
.ow-split i.tone-grey, .ow-methods .dot.tone-grey { background: #d6dde6; }
.ow-methods { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; }
.ow-methods span { display: inline-flex; align-items: center; gap: 6px; opacity: .92; }
.ow-methods .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ow-none { margin: 0; opacity: .8; font-size: 13px; }
.ow-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.16); }
.ow-mini strong { display: block; font-size: 18px; letter-spacing: -.01em; }
.ow-mini span { font-size: 12px; opacity: .78; }
.ow-month-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.ow-fig { padding: 12px 14px; border-radius: 14px; background: var(--tile); display: flex; flex-direction: column; gap: 2px; }
.ow-fig > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.ow-fig strong { font-size: 21px; letter-spacing: -.02em; }
.ow-fig small { font-size: 11.5px; color: var(--muted); }
.ow-fig.pos { background: var(--green-50); } .ow-fig.pos strong { color: var(--green); }
.ow-fig.neg { background: var(--red-50); } .ow-fig.neg strong { color: var(--red); }
.ow-chg { align-self: flex-start; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.ow-chg.up { background: var(--green-50); color: var(--green); } .ow-chg.down { background: var(--red-50); color: var(--red); }
.ow-bars { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; }
.ow-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; border: 0; padding: 0; background: none; cursor: pointer; min-width: 0; border-radius: 4px; }
.ow-bar i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--primary-100); transition: background .15s; }
.ow-bar.sun i { background: var(--tile-2); }
.ow-bar:hover i { background: var(--primary); }
.ow-bar.on i { background: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); }
.ow-avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--amber); pointer-events: none; }
.ow-bars-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.ow-alerts { display: grid; gap: 8px; }
.ow-alert { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--tile); color: inherit; text-decoration: none; font-size: 13.5px; font-weight: 600; }
.ow-alert:hover { background: var(--tile-2); }
.ow-alert .grow { flex: 1; min-width: 0; }
.ow-alert > .ic { width: 16px; height: 16px; color: var(--muted); }
.stat-ic.sm { width: 34px; height: 34px; border-radius: 11px; }
.stat-ic.sm .ic { width: 17px; height: 17px; }
.ow-cols { gap: 16px; }
.owner .list-row { color: inherit; text-decoration: none; }
@media (max-width: 640px) {
  .ow-head .page-sub { display: none; }
  .ow-day { width: 100%; }
  .ow-date { flex: 1; justify-content: center; }
  .ow-hero { padding: 18px 16px 14px; border-radius: 22px; }
  .ow-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ow-month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ow-fig strong { font-size: 17px; }
  .ow-bars { gap: 2px; height: 110px; }
}

/* ------------------------------------------------------------ GST report */
.gst-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.gst-bar .field { min-width: 200px; }
.gst-sac { display: flex; gap: 6px; align-items: center; }
.gst-sac .input { width: 120px; }
.gst-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.gst-facts > div { padding: 12px 14px; border-radius: 14px; background: var(--tile); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gst-facts span { font-size: 12px; color: var(--muted); font-weight: 600; }
.gst-facts strong { font-size: 17px; overflow-wrap: anywhere; }
.gst-facts small { font-size: 11.5px; color: var(--muted); }
.gst-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.gst-cols .card { margin: 0; }
@media (max-width: 1180px) { .gst-cols { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ families */
.fam-card .card-title .ic { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; color: var(--primary); }
.fam-list { display: grid; gap: 6px; }
.fam-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 14px; background: var(--tile); color: inherit; text-decoration: none; font-size: 13px; }
.fam-row:hover { background: var(--tile-2); }
.fam-row.me { box-shadow: inset 3px 0 0 var(--primary); background: var(--primary-50); }
.fam-row .grow { flex: 1; min-width: 0; }
.fam-row strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam-row small { display: block; color: var(--muted); font-size: 12px; }
.fam-row > span:last-child { white-space: nowrap; font-weight: 700; font-size: 13px; }
.fam-total { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); font-size: 13px; color: var(--text-2); }
.fam-total strong { margin-left: 4px; color: var(--text); }
.section-gap-sm { margin-top: 12px; }
.fam-join { align-items: center; margin-bottom: 14px; }
.fam-join select { width: auto; min-height: 36px; padding: 5px 10px; margin-left: auto; }
.fam-dup { display: grid; gap: 6px; margin-top: 10px; }
.fam-dup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fam-dup-row .ic { width: 15px; height: 15px; vertical-align: -2px; }
.fam-dup-row select { width: auto; min-height: 34px; padding: 4px 10px; }
.fam-edit-rows { display: grid; gap: 8px; }
.fam-edit-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--tile); }
.fam-edit-row .grow { flex: 1; min-width: 0; font-size: 13.5px; }
.fam-edit-row select { width: auto; min-width: 140px; min-height: 36px; padding: 5px 10px; }

/* ------------------------------------------------------------ insurance claims */
.claim-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.claim-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.claim-figs > div { padding: 11px 13px; border-radius: 14px; background: var(--tile); display: flex; flex-direction: column; gap: 2px; }
.claim-figs span { font-size: 12px; color: var(--muted); font-weight: 600; }
.claim-figs strong { font-size: 19px; letter-spacing: -.01em; }
.claim-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; margin: 0; }
.claim-kv > div { min-width: 0; }
.claim-kv dt { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.claim-kv dd { margin: 1px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.claim-hist { display: grid; gap: 6px; margin-top: 6px; }
.claim-hist > div { padding: 8px 12px; border-left: 3px solid var(--primary-100); background: var(--tile); border-radius: 0 10px 10px 0; font-size: 13px; }
.claim-hist small { display: block; color: var(--muted); font-size: 11.5px; }
.bill-claims { display: grid; gap: 8px; margin-bottom: 16px; }
.bill-claim { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--purple-50); border: 0; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.bill-claim .grow { flex: 1; min-width: 0; }
.bill-claim strong { display: block; font-size: 13.5px; }
.bill-claim small { color: var(--text-2); font-size: 12px; }

/* ------------------------------------------------------------ patient portal link */
.ptl { display: grid; gap: 12px; }
.ptl p { margin: 0; }
.ptl-qr { width: 190px; height: 190px; margin: 0 auto; background: #fff; border-radius: 14px; padding: 4px; }
.ptl-qr svg { width: 100%; height: 100%; display: block; }
.ptl-url { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--tile); }
.ptl-url code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; }

/* ------------------------------------------------------------ Google Drive backup */
.gd-state { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--tile); font-size: 13.5px; margin-bottom: 12px; }
.gd-state .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.gd-state.ok { background: var(--green-50); }
.gd-state.ok .ic { color: var(--green); }
.gd-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.gd-steps b { color: var(--text); }
.gd-uri { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 10px; background: var(--tile); margin-top: 4px; max-width: 100%; }
.gd-uri code { overflow-wrap: anywhere; font-size: 12.5px; }

/* ------------------------------------------------------------ branches */
.branch-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--primary-50); color: var(--primary); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; max-width: 200px; }
.branch-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-btn .ic { width: 16px; height: 16px; flex: none; }
.branch-btn:hover { background: var(--primary-100); }
.branch-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--primary); background: var(--primary-50); padding: 2px 8px; border-radius: 999px; vertical-align: 1px; }
.branch-tag .ic { width: 12px; height: 12px; }
.br-select { min-width: 170px; }
.br-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.br-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow); }
.br-card.off { opacity: .6; }
.br-card h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.br-card p { margin: 0; font-size: 13px; color: var(--text-2); }
.br-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.br-figs > div { padding: 8px 10px; border-radius: 12px; background: var(--tile); }
.br-figs strong { display: block; font-size: 15px; }
.br-figs span { font-size: 11.5px; color: var(--muted); }
@media (max-width: 640px) { .branch-btn { height: 36px; padding: 0 10px; max-width: 120px; } }
.chip-check { padding: 6px 12px; border-radius: 999px; background: var(--tile); min-height: 0; }

/* Suspension by Uptech World (licence) */
.lic-bar { display: flex; gap: 10px; align-items: flex-start; margin: 0 24px 0; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.lic-bar .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.lic-bar.danger { background: var(--red-50); color: var(--red); }
.lic-bar.warn { background: var(--amber-50); color: var(--amber); }
.lic-bar a { color: inherit; font-weight: 700; margin-left: 4px; }
.suspended-page { min-height: 100vh; }
.suspended-page .login-card { width: min(520px, 100%); margin: 6vh auto; }
.suspended-page .login-card > .login-brand { display: flex !important; margin-bottom: 20px; }
.suspended-page details summary { cursor: pointer; font-weight: 600; }
@media (max-width: 760px) { .lic-bar { margin: 0 12px; } }

/* ------------------------------------------------------------- Settings (2.10.3): sections with their own menu */
.set-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-nav { position: sticky; top: 96px; padding: 12px; max-height: calc(100vh - 112px); overflow: auto; }
.set-find { position: relative; margin-bottom: 8px; }
.set-find .ic-wrap { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.set-find .ic-wrap .ic { width: 16px; height: 16px; }
.set-find .input { padding-left: 34px; height: 38px; font-size: 13px; }
.set-nav-group { display: grid; gap: 2px; padding: 6px 0; }
.set-nav-group + .set-nav-group { border-top: 1px solid var(--line); }
.set-nav-group > span { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.set-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 12px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2); text-align: left; cursor: pointer; }
.set-nav-item .ic { width: 18px; height: 18px; flex: none; }
.set-nav-item:hover { background: var(--tile); color: var(--text); }
.set-nav-item.on { background: var(--navy); color: #fff; }
.set-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--purple-50); color: var(--purple); font-size: 11.5px; display: grid; place-items: center; }
.set-nav-item.on .set-count { background: rgba(255, 255, 255, .18); color: #fff; }
.set-main { min-width: 0; }
.set-main > form > .form-error { margin-bottom: 14px; }
.set-section { padding: 24px 26px 8px; }
.set-section + .set-section { margin-top: 0; }
.set-head { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-head .stat-ic { width: 44px; height: 44px; border-radius: 14px; flex: none; }
.set-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.set-head p { color: var(--muted); font-size: 13px; margin-top: 3px; max-width: 70ch; line-height: 1.5; }
.set-group { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 12px 32px; padding: 22px 0; }
.set-group + .set-group { border-top: 1px solid var(--line); }
.set-group-head h3 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-group-head p { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 5px; }
.set-group-body { min-width: 0; }
.set-premium { height: 21px; font-size: 11px; }
.set-checks { display: grid; gap: 12px; }
.set-checks .check .set-premium { margin-left: 6px; vertical-align: middle; }
.set-preview { white-space: pre-wrap; line-height: 1.55; }
.set-section .design-pick { margin: 0; }
.set-premium-list { display: grid; padding: 8px 0 16px; }
.set-premium-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-premium-row:last-child { border-bottom: 0; }
.set-premium-row strong { display: block; font-size: 14px; }
.set-premium-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.set-section > #procs-list, .set-section > #cns-list { padding: 16px 0 18px; }
.set-savebar { position: sticky; bottom: 16px; z-index: 6; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 18px; border-radius: 16px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; }
.set-savebar > span { display: flex; align-items: center; gap: 8px; }
.set-savebar .ic { width: 17px; height: 17px; }
.set-savebar .btn:not(.btn-primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.set-nofind { padding: 8px 10px; }
@media (max-width: 1000px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .set-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; max-height: none; padding: 8px; scrollbar-width: none; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-find, .set-nav-group > span, .set-nofind { display: none; }
  .set-nav-group { display: contents; }
  .set-nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .set-group { grid-template-columns: minmax(0, 1fr); padding: 18px 0; }
}
@media (max-width: 760px) {
  .set-section { padding: 18px 16px 4px; }
  .set-head h2 { font-size: 18px; }
  .set-savebar { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------ admin panel (2.10.3) */
.adm-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.adm-top > .card, .adm-grid > .card, .adm-bottom > .card { margin: 0; }
.adm-health { padding: 22px 24px; }
.adm-health-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.adm-health-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.adm-health-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.adm-health-badge { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none; background: var(--green-50); color: var(--green); }
.adm-health-badge .ic { width: 22px; height: 22px; }
.adm-health-badge.is-warn { background: var(--amber-50); color: var(--amber); }
.adm-health-badge.is-bad { background: var(--red-50); color: var(--red); }
.adm-checks { display: grid; }
.adm-check { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.adm-check:last-child { border-bottom: 0; padding-bottom: 0; }
.adm-check .grow { flex: 1; min-width: 0; }
.adm-check strong { display: block; font-size: 13.5px; font-weight: 650; }
.adm-check small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.adm-check .btn { flex: none; }
.adm-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--green-50); color: var(--green); }
.adm-dot .ic { width: 14px; height: 14px; stroke-width: 2.4; }
.adm-check.is-warn .adm-dot { background: var(--amber-50); color: var(--amber); }
.adm-check.is-bad .adm-dot { background: var(--red-50); color: var(--red); }
.adm-check.is-bad strong { color: var(--red); }
.adm-check.is-wait .adm-dot { background: var(--grey-50); color: var(--muted); }
.adm-glance { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.adm-mini-title { font-size: 15px; font-weight: 700; }
.adm-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex: 1; }
.adm-fig { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 10px; align-content: center; padding: 14px; border-radius: 16px; background: var(--tile); color: inherit; text-decoration: none; transition: background .15s; }
.adm-fig:hover { background: var(--primary-50); text-decoration: none; }
.adm-fig .stat-ic { grid-row: 1 / 4; }
.adm-fig b { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.adm-fig small { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.adm-fig em { font-style: normal; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-version { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.adm-version span { display: inline-flex; align-items: center; gap: 6px; }
.adm-version b { color: var(--text); }
.adm-version .ic { width: 15px; height: 15px; }
.adm-version a { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.adm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.adm-card { padding: 20px 20px 10px; }
.adm-card-head { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 12px; }
.adm-card-head > div { flex: 1; min-width: 0; }
.adm-card-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.adm-card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.adm-card-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--navy); color: #fff; }
.adm-card-ic .ic { width: 18px; height: 18px; }
.adm-rows { display: grid; margin: 0 -10px; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 14px; color: inherit; text-decoration: none; position: relative; transition: background .15s; }
.adm-row + .adm-row::before { content: ''; position: absolute; left: 56px; right: 10px; top: 0; border-top: 1px solid var(--line); }
.adm-row:hover { background: var(--tile); text-decoration: none; }
.adm-row:hover::before, .adm-row:hover + .adm-row::before { border-color: transparent; }
.adm-row .grow { flex: 1; min-width: 0; }
.adm-row strong { display: block; font-size: 13.5px; font-weight: 650; }
.adm-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.adm-row > .ic { color: var(--muted); width: 16px; height: 16px; flex: none; }
.adm-meta { flex: none; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--tile); border-radius: 999px; padding: 3px 9px; white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.adm-row:hover .adm-meta { background: var(--card); }
.adm-meta i { font-style: normal; }
.adm-meta i.on { color: var(--green); } .adm-meta i.bad { color: var(--red); } .adm-meta i.warn { color: var(--amber); }
.adm-bottom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lic-card { padding: 20px 22px 22px; }
.lic-card .adm-card-head { flex-wrap: wrap; }
.lic-card .banner { margin: 0 0 14px; }
.lic-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 18px; }
.lic-facts > div { background: var(--card); padding: 11px 14px; min-width: 0; }
.lic-facts span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.lic-facts b { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.lic-facts code { font: inherit; }
.lic-sub { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; margin: 0 0 10px; }
.lic-sub .ic { width: 16px; height: 16px; color: var(--green); }
.lic-sub.muted { margin-top: 18px; color: var(--text-2); }
.lic-sub.muted .ic { color: var(--muted); }
.set-count.grey { background: var(--grey-50); color: var(--muted); }
.lic-card .lic-feats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.lic-key { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.lic-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.adm-activity { padding: 20px 20px 16px; }
.adm-feed { list-style: none; margin: 0; padding: 0; display: grid; }
.adm-feed li { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.adm-feed li + li { border-top: 1px solid var(--line); }
.adm-feed-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--tile); color: var(--text-2); }
.adm-feed-ic .ic { width: 15px; height: 15px; }
.adm-feed .grow { flex: 1; min-width: 0; }
.adm-feed strong { display: block; font-size: 13px; font-weight: 650; }
.adm-feed small { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-feed em { display: block; font-style: normal; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.adm-more { display: inline-flex; align-items: center; gap: 2px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.adm-more .ic { width: 15px; height: 15px; }
.adm-empty { padding: 8px 0; }
@media (max-width: 1200px) {
  .adm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-bottom { grid-template-columns: minmax(0, 1fr); }
  .lic-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .adm-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .adm-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-health, .adm-glance, .lic-card { padding: 18px 16px; }
  .adm-card, .adm-activity { padding: 16px 16px 8px; }
  .adm-check { flex-wrap: wrap; }
  .adm-check .btn { margin-left: 38px; }
  .adm-meta { display: none; }
  .lic-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-fig { padding: 12px; }
  .adm-fig b { font-size: 18px; }
}

/* ------------------------------------------------------------ dashboard (2.10.4) */
.kpi-chip { align-self: flex-start; max-width: 100%; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-chip.tone-grey { background: var(--grey-50); color: var(--text-2); }
.live-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--green-50); color: var(--green); font-size: 11.5px; font-weight: 700; }
.live-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-tag i { animation: none; } }
button.todo-row { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.mini-cal button { height: 38px; display: grid; place-items: center; align-content: center; line-height: 1.1; }
.mini-cal button small { display: block; font-size: 9.5px; font-weight: 700; color: var(--muted); }
.mini-cal button.busy small { color: var(--amber); }
.mini-cal button.today small { color: inherit; opacity: .85; }
.mini-cal button.has::after { display: none; }
/* No bookings today */
.ed-none { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; }
.ed-none > .ic { width: 40px; height: 40px; padding: 10px; border-radius: 13px; background: var(--primary-50); color: var(--primary); flex: none; }
.ed-none strong { display: block; font-size: 14.5px; }
.ed-none small { display: block; color: var(--muted); font-size: 12.5px; }
.ed-next { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.ed-next-head { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; }
.ed-next-head > span { flex: 1; min-width: 0; }
.ed-next-head small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.ed-next-head b { font-size: 15px; }
.ed-row, .nd-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 4px; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.ed-row:hover, .nd-row:hover { background: var(--tile); }
.ed-row .grow, .nd-row .grow { flex: 1; min-width: 0; }
.ed-row strong, .nd-row strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-row small, .nd-row small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-row .tag, .nd-row .tag { flex: none; }
.ed-time { width: 56px; flex: none; font-weight: 700; font-size: 13px; color: var(--text-2); }
.ed-more { display: block; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.ed-actions { margin-top: 14px; }
/* A quiet day */
.quiet { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.quiet-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tile); }
.quiet-row .grow { flex: 1; min-width: 0; }
.quiet-row strong { display: block; font-size: 13.5px; }
.quiet-row small { display: block; color: var(--muted); font-size: 12.5px; }
.quiet-row .btn { flex: none; }
/* Done but not billed */
.dw-unbilled { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--red-50); }
.ub-total { font-size: 16px; color: var(--red); }
.ub-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.ub-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.ub-row:first-child { border-top: 0; padding-top: 2px; }
.ub-row .grow { flex: 1; min-width: 0; }
.ub-row strong { display: block; font-size: 13.5px; }
.ub-row small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ub-amt { font-size: 13.5px; white-space: nowrap; }
.ub-row .btn { flex: none; }
.ub-more { margin-top: 6px; }
/* Next visits */
.nd-bar { height: 8px; border-radius: 999px; background: var(--amber-50); overflow: hidden; }
.nd-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.nd-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 8px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.nd-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.nd-send { margin-top: 12px; justify-content: center; }
.nd-send .ic { width: 17px; height: 17px; }
.nd-ok { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--green); }
.nd-ok .ic { width: 17px; height: 17px; }
/* Money today */
.mt-total { font-size: 18px; }
.mt-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mt-methods > .muted { grid-column: 1 / -1; }
.mt-lines { display: grid; gap: 8px; margin-top: 12px; }
.mt-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; text-decoration: none; }
.mt-line > span { flex: 1; min-width: 0; }
.mt-line .ic { width: 17px; height: 17px; flex: none; }
.mt-line.ok { background: var(--green-50); color: var(--green); }
.mt-line.warn { background: var(--amber-50); color: var(--amber); }
.mt-line.warn:hover { text-decoration: none; filter: brightness(.98); }
/* Lab cases */
.dl-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.dl-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.dl-row:first-child { border-top: 0; }
.dl-row:hover { background: var(--tile); text-decoration: none; }
.dl-row .grow { flex: 1; min-width: 0; }
.dl-row strong { display: block; font-size: 13.5px; }
.dl-row small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-row .tag { flex: none; }
/* Birthdays */
.bd-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.bd-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.bd-row:first-child { border-top: 0; }
.bd-row .grow { flex: 1; min-width: 0; }
.bd-row strong { display: block; }
.bd-row small { display: block; color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  /* Phone: the day's figures scroll sideways; cards fold to their title (tap it). */
  .dw-kpis { padding: 0; background: transparent; box-shadow: none; }
  .dw-kpis .kpis { display: flex; overflow-x: auto; gap: 10px; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; }
  .dw-kpis .kpis::-webkit-scrollbar { display: none; }
  .dw-kpis .kpi { flex: 0 0 152px; background: var(--card); box-shadow: var(--shadow); scroll-snap-align: start; padding: 12px 14px; }
  .dw-kpis .kpi::before { display: none; }
  .dw-kpis .kpi-val { font-size: 21px; }
  .dw-kpis .kpi-ic { display: none; }
  .dw.foldable .dw-head { cursor: pointer; position: relative; padding-right: 26px; }
  .dw.foldable .dw-head::after { content: ''; position: absolute; right: 4px; top: 12px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-135deg); transition: transform .15s; }
  .dw.foldable.folded .dw-head::after { transform: rotate(45deg); top: 8px; }
  .dw.folded .dw-head { margin-bottom: 0; }
  .dw.folded .dw-in > :not(.dw-head) { display: none !important; }
  .dgrid.editing .dw.folded .dw-in > :not(.dw-head) { display: revert !important; }
  .ub-row { flex-wrap: wrap; }
  .ub-row .grow { flex-basis: calc(100% - 120px); }
}

/* ------------------------------------------------------------ patients list (2.10.4) */
.pt-groups { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pt-group { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.pt-group b { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--grey-50); color: var(--text-2); min-width: 10px; text-align: center; }
.pt-group b:empty { display: none; }
.pt-group:hover { border-color: var(--line-2); }
.pt-group.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.pt-group.on b { background: rgba(255, 255, 255, .18); color: #fff; }
.pt-dup-banner { margin: 0 0 12px; }
.pt-table td { vertical-align: middle; }
.pt-who .cell-main > span { min-width: 0; }
.pt-code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.pt-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.pt-tags:empty { display: none; }
.ptag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ptag .ic { width: 12px; height: 12px; }
.pt-phone > span { margin-right: 6px; }
.pt-wa { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--green-50); color: #1fa855; vertical-align: middle; }
.pt-wa .ic { width: 15px; height: 15px; }
.pt-last strong { font-weight: 600; display: block; }
.pt-last small { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-act .btn { margin-right: 2px; }
.dup-groups { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.dup-group { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.dup-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.dup-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.dup-row .grow { flex: 1; min-width: 0; }
.dup-row strong { display: block; font-size: 13.5px; }
.dup-row small { display: block; color: var(--muted); font-size: 12px; }
.dup-foot { padding-top: 8px; border-top: 1px solid var(--line); }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 30; width: 58px; height: 58px; border: 0; border-radius: 18px; background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgba(58, 137, 228, .4); place-items: center; cursor: pointer; }
.fab .ic { width: 26px; height: 26px; }
@media (max-width: 760px) {
  .fab.show-sm { display: grid; }
  .pt-groups { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 0 14px; }
  .pt-groups::-webkit-scrollbar { display: none; }
  .pt-group { flex: none; }
  .pt-card { padding: 12px; }
  .pt-filters { gap: 8px; }
  .pt-filters .grow { flex: 1 1 100%; }
  .pt-filters select { flex: 1 1 0; min-width: 0; }
  .pt-filters .chip { flex: none; }
  .pt-bal .muted { display: none; }
  /* Phone: each patient is a card. */
  .pt-wrap { border: 0; background: none; overflow: visible; }
  .pt-table, .pt-table tbody { display: block; }
  .pt-table thead { display: none; }
  .pt-table tr.row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
  .pt-table td { display: block; padding: 0; border: 0; }
  .pt-table tr.row-link:hover td { background: none; }
  .pt-who { grid-column: 1; }
  .pt-bal { grid-column: 2; grid-row: 1; align-self: start; }
  .pt-age { grid-column: 1; padding-left: 52px !important; font-size: 12.5px; color: var(--muted); }
  .pt-phone { grid-column: 1; padding-left: 52px !important; font-size: 12.5px; }
  .pt-last { display: none !important; }
  .pt-next { grid-column: 1; padding-left: 52px !important; font-size: 12.5px; }
  .pt-next .muted { display: none; }
  .pt-act { grid-column: 2; grid-row: 2 / span 3; align-self: end; }
  .pt-act .btn { display: none; }
  .pt-code { max-width: 200px; }
}

/* ------------------------------------------------------------ register / edit patient (2.10.4) */
.pf-lead { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }
.pf-quick { margin-bottom: 6px; }
.pf-quick [name=phone] { font-size: 15px; font-weight: 600; }
.pf-dup { border: 1.5px solid #f0d58c; background: #fffaf0; border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; }
.pf-dup-title { color: #7a5404; }
.pf-dup-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 8px 10px; }
.pf-dup-row .grow { flex: 1; min-width: 0; }
.pf-dup-row strong { display: block; font-size: 13.5px; }
.pf-dup-row small { display: block; color: var(--muted); font-size: 12px; }
.pf-dup-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13px; }
.pf-fam { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-fam select { height: 32px; padding: 0 8px; }
.pf-fold { border: 1px solid var(--line); border-radius: 16px; margin-top: 12px; }
.pf-fold > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.pf-fold > summary::-webkit-details-marker { display: none; }
.pf-fold > summary .grow { flex: 1; min-width: 0; }
.pf-fold > summary strong { display: block; font-size: 14px; }
.pf-fold > summary small { display: block; color: var(--muted); font-size: 12px; }
.pf-fold > summary > .ic { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; flex: none; }
.pf-fold[open] > summary > .ic { transform: rotate(180deg); }
.pf-fold-in { padding: 4px 16px 16px; }
.pf-med { border-color: #f3c2c4; }
.pf-ask { flex: none; }
.pf-subfold { margin-top: 4px; }
.pf-subfold > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); padding: 6px 0; }
.pf-subfold[open] > summary { margin-bottom: 10px; }
.pf-subfold > .field, .pf-subfold > div { margin-top: 12px; }
.pf-foot-note { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .pf-ask { display: none; }
  .pf-foot-note { display: none; }
}
.pf-fam .input { width: auto; height: 34px; }

/* ------------------------------------------------------------ patient profile (2.10.4) */
.pp-head { padding: 22px 24px; display: grid; gap: 18px; }
.pp-top { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.pp-photo { border: 0; background: none; padding: 0; position: relative; flex: none; cursor: pointer; }
.pp-id { flex: 1 1 320px; min-width: 0; }
.pp-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pp-code { font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--grey-50); border-radius: 999px; padding: 2px 10px; }
.pp-sub { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.pp-id .profile-flags:empty { display: none; }
.pp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pp-actions .btn .ic:last-child:not(:first-child) { width: 14px; height: 14px; margin-left: -2px; }
.pp-quick { display: none; }
.pp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pp-fact { background: var(--card); padding: 11px 16px; min-width: 0; }
.pp-fact > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.pp-fact b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
.pp-fact b .ic { width: 15px; height: 15px; }
.pp-fact.is-due { background: color-mix(in srgb, var(--red-50) 55%, var(--card)); }
.pp-fact .link-btn { font-size: 12.5px; font-weight: 700; }
.pp-tabs { margin: 16px 0; }
.tab-btn .count.due { background: var(--red-50); color: var(--red); }
.tab-btn.active .count.due { background: rgba(255, 255, 255, .2); color: #fff; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.pp-main, .pp-side { display: grid; gap: 18px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.pp-main > .card, .pp-side > .card, .pp-side > div > .card { margin: 0; }
.pp-plan-bar, .pp-acc-bar { height: 8px; border-radius: 999px; background: var(--tile-2); overflow: hidden; margin-bottom: 14px; }
.pp-plan-bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.pp-acc-bar { background: var(--red-50); margin: 12px 0 0; }
.pp-acc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.pp-steps { display: grid; gap: 8px; }
.pp-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--tile); }
.pp-step .grow { flex: 1; min-width: 0; }
.pp-step strong { display: block; font-size: 13.5px; }
.pp-step small { display: block; color: var(--muted); font-size: 12px; }
.pp-step b { font-size: 13px; white-space: nowrap; }
.pp-step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; border: 2px solid var(--primary); color: var(--primary); background: var(--card); }
.pp-step.done .pp-step-n { background: var(--green); border-color: var(--green); color: #fff; }
.pp-step.done .pp-step-n .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.pp-step.doing { background: var(--primary-50); }
.pp-step:not(.done):not(.doing) { background: none; border: 1.5px dashed var(--primary-100); }
.pp-step:not(.done) small { color: var(--primary); font-weight: 600; }
.pp-plan-foot { margin-top: 10px; }
.pp-plan-foot .link-btn { display: inline-flex; align-items: center; gap: 2px; }
.pp-plan-foot .ic { width: 15px; height: 15px; }
.pp-visits { display: grid; grid-template-columns: minmax(0, 1fr); }
.pp-visit { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.pp-visit:first-child { border-top: 0; padding-top: 2px; }
.pp-vdate { width: 54px; flex: none; text-align: center; }
.pp-vdate b { display: block; font-size: 20px; line-height: 1.1; }
.pp-vdate small { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.pp-visit.future .pp-vdate b { color: var(--primary); }
.pp-vbody { flex: 1; min-width: 0; display: grid; gap: 8px; }
.pp-vtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-vtitle strong { font-size: 14.5px; }
.pp-vtitle small { color: var(--muted); font-size: 12.5px; }
.pp-vchips { display: flex; gap: 6px; flex-wrap: wrap; }
.vchip { border: 0; font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 10px; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vchip:not([data-go]) { cursor: default; }
.vchip.k-appointment { background: var(--purple-50); color: var(--purple); }
.vchip.k-treatment { background: var(--primary-50); color: var(--primary-600); }
.vchip.k-prescription { background: var(--pink-50); color: var(--pink-600); }
.vchip.k-bill, .vchip.k-advance_back, .vchip.k-document { background: var(--amber-50); color: var(--amber); }
.vchip.k-payment, .vchip.k-advance { background: var(--green-50); color: var(--green); }
.vchip.k-image { background: var(--grey-50); color: var(--text-2); }
.pp-acc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pp-acc-tiles > div { background: var(--tile); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.pp-acc-tiles > div.is-due { background: var(--red-50); }
.pp-acc-tiles span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.pp-acc-tiles b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-acc-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.pp-acc-btns .btn { justify-content: center; }
@media (max-width: 1100px) {
  .pp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .pp-head { padding: 16px; gap: 14px; }
  .pp-top { gap: 12px; flex-wrap: nowrap; align-items: center; }
  .pp-top .avatar.xl { width: 56px; height: 56px; font-size: 19px; }
  .pp-id { flex: 1 1 auto; }
  .pp-name-row .profile-name { font-size: 19px; }
  .pp-sub { font-size: 12.5px; }
  .pp-actions { display: none; }
  .pp-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
  .pp-quick > a, .pp-quick > button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border: 0; border-radius: 14px; background: var(--tile); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; text-decoration: none; }
  .pp-quick .ic { width: 19px; height: 19px; }
  .pp-quick .wa { background: var(--green-50); color: #1fa855; }
  .pp-quick .pri { background: var(--primary); color: #fff; }
  .pp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pp-fact { padding: 9px 12px; }
  .pp-fact b { font-size: 13px; }
  .pp-visit { gap: 10px; }
  .pp-vdate { width: 40px; }
  .pp-vdate b { font-size: 17px; }
}
.pp-vlink { border: 0; background: none; padding: 0; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.pp-vlink:hover { color: var(--primary); }

/* ------------------------------------------------------------ referrals (2.10.5) */
.rf-terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 14px; border-radius: 14px; background: var(--tile); }
.rf-terms > .field:first-child { grid-column: 1 / -1; }
.rf-explain { margin: 0; }
.rp { display: grid; gap: 12px; }
.rp-terms { display: grid; gap: 8px; }
.rp-terms > .field-hint { margin: 0; }
.po-due { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--amber-50); font-weight: 600; }
.po-due b { font-size: 18px; }
.rd-head { display: flex; gap: 12px 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.rd-head .grow { flex: 1 1 260px; min-width: 0; }
.rd-head p { margin: 4px 0 0; }
.rd-terms { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.rd-terms .ic { width: 16px; height: 16px; color: var(--purple); }
.rd-figs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 18px; }
.rd-figs > div { background: var(--card); padding: 10px 14px; min-width: 0; }
.rd-figs span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.rd-figs b { display: block; font-size: 15px; }
.rd-figs .due { background: var(--red-50); }
.rd-figs .due b { color: var(--red); }
.rd-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.ref-periods { display: flex; gap: 8px; flex-wrap: wrap; }
.ref-table tr.is-off td { opacity: .6; }
.ref-mob { display: none !important; }
@media (max-width: 760px) {
  .rf-terms { grid-template-columns: minmax(0, 1fr); }
  .rd-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ref-periods { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ref-table .ref-x { display: none; }
  .ref-mob { display: block !important; color: var(--text-2) !important; }
}

/* ------------------------------------------------------------ billing list (2.10.6) */
.bl-periods { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bl-dates { display: inline-flex; align-items: center; gap: 8px; }
.bl-dates .input { width: auto; min-height: 38px; }
.bl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.bl-kpi { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.bl-kpi .grow { flex: 1; min-width: 0; }
.bl-kpi-label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.bl-kpi-val { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 2px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.bl-kpi small { display: block; font-size: 12px; color: var(--muted); }
.bl-kpi small .link-btn { font-size: 12px; }
.bl-bar, .bl-mini { display: block; height: 6px; border-radius: 99px; background: var(--grey-50); overflow: hidden; margin-top: 8px; }
.bl-bar i, .bl-mini i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.bl-mini { height: 4px; width: 64px; margin: 5px 0 0 auto; }
.bl-card { padding-top: 6px; }
.bl-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -4px 14px; overflow-x: auto; scrollbar-width: none; }
.bl-tabs::-webkit-scrollbar { display: none; }
.bl-tab { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 12px 12px 11px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; }
.bl-tab b { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--grey-50); color: var(--text-2); font-variant-numeric: tabular-nums; }
.bl-tab b:empty { display: none; }
.bl-tab:hover { color: var(--text); }
.bl-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.bl-tab.on b { background: var(--primary-50); color: var(--primary); }
.bl-tab b.hot { background: var(--red-50); color: var(--red); }
.bl-sel { display: inline-flex; align-items: center; gap: 0; min-height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding-left: 12px; }
.bl-sel > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.bl-sel select { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); min-height: 36px; padding: 0 10px 0 6px; cursor: pointer; max-width: 190px; }
.bl-sel:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.bl-sel select:focus { outline: none; }
.bl-table td { vertical-align: middle; }
.bl-table tr.has-due td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.bl-code { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-treat span { display: block; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.bl-tags .tag .ic { width: 12px; height: 12px; }
.bl-table .actions { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.bl-cards { display: none; }
.bl-cardrow { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.bl-cardrow:first-child { border-top: 0; }
.bl-cardrow .grow { flex: 1; min-width: 0; }
.bl-cardrow strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-cardrow small { display: block; color: var(--muted); font-size: 12px; }
.bl-cardrow .bl-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-right { text-align: right; flex: none; }
.bl-right b { display: block; font-variant-numeric: tabular-nums; }
.bl-right small { font-weight: 700; }
@media (max-width: 1180px) {
  .bl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .bl-periods { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 0 14px; }
  .bl-periods::-webkit-scrollbar { display: none; }
  .bl-periods .pt-group { flex: none; height: 34px; padding: 0 12px; }
  .bl-dates { flex: none; }
  .bl-dates .input { min-height: 34px; padding: 0 8px; }
  .bl-kpis { gap: 10px; margin-bottom: 12px; }
  .bl-kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .bl-kpi .stat-ic { width: 32px; height: 32px; border-radius: 10px; }
  .bl-kpi .stat-ic .ic { width: 16px; height: 16px; }
  .bl-kpi-val { font-size: 18px; }
  .bl-card { padding: 4px 12px 12px; }
  .bl-tabs { margin: 0 -12px 12px; padding: 0 6px; }
  .bl-tab { padding: 11px 9px 10px; font-size: 13px; }
  .bl-filters { gap: 8px; }
  .bl-filters .grow { flex: 1 1 100%; }
  .bl-filters > * { flex: 1 1 0; min-width: 0; }
  .bl-sel select { max-width: none; width: 100%; }
  .bl-cards { display: block; }
  .bl-tablewrap { display: none; }
}

/* ------------------------------------------------------------ invoice view head (2.10.6) */
.bv-head { margin-bottom: 18px; padding: 0; overflow: hidden; }
.bv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px 16px; flex-wrap: wrap; }
.bv-id { min-width: 0; }
.bv-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bv-title .page-title { margin: 0; font-variant-numeric: tabular-nums; }
.bv-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.bv-meta span { display: inline-flex; align-items: center; gap: 6px; }
.bv-meta .ic { width: 15px; height: 15px; color: var(--muted); }
.bv-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bv-actions .btn .ic + .ic, .bv-actions [data-act="more"] .ic { width: 15px; height: 15px; margin-left: 2px; }
.bv-strip { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr); gap: 0; border-top: 1px solid var(--line); background: var(--bg-2, var(--grey-50)); }
.bv-strip > * { padding: 14px 20px; min-width: 0; }
.bv-strip > * + * { border-left: 1px solid var(--line); }
.bv-patient { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.bv-patient > span { min-width: 0; }
.bv-patient strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bv-patient small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bv-patient:hover strong { color: var(--primary); }
.bv-fig small, .bv-progress small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.bv-fig b { display: block; font-size: 18px; font-weight: 800; margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bv-fig.due b { color: var(--red); }
.bv-progress { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.bv-progress .bl-bar { margin: 0; }
@media (max-width: 1180px) {
  .bv-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bv-patient, .bv-progress { grid-column: 1 / -1; }
  .bv-strip > .bv-fig:nth-child(2) { border-left: 0; }
  .bv-strip > .bv-fig, .bv-progress { border-top: 1px solid var(--line); }
  .bv-progress { border-left: 0 !important; }
}
@media (max-width: 760px) {
  .bv-top { padding: 14px; }
  .bv-actions { width: 100%; }
  .bv-actions .btn { flex: 1 1 0; justify-content: center; padding-left: 8px; padding-right: 8px; }
  .bv-actions .btn-primary { flex: 1 1 100%; }
  .bv-strip > * { padding: 12px 14px; }
  .bv-fig b { font-size: 15.5px; }
}

/* ------------------------------------------------------------ invoice editor (2.10.6) */
.be-form { padding-bottom: 0; }
.be-step { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.be-step h3 { margin: 0; font-size: 15px; font-weight: 700; }
.be-step .btn { margin-left: auto; }
.be-step small { flex-basis: 100%; margin-left: 36px; margin-top: -6px; }
.be-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); font-weight: 800; font-size: 13px; flex: none; }
.be-form > .form-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.be-form > .form-section:has(> .totals) { border-top: 0; padding-top: 0; margin-top: 12px; }
.be-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin: 18px -20px 0; padding: 12px 20px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 -8px 18px -12px rgba(16, 24, 40, .18); }
.be-sum { margin-right: auto; display: flex; flex-direction: column; line-height: 1.15; }
.be-sum small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.be-sum b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .be-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); margin: 14px -16px 0; padding: 10px 16px; border-radius: 0 0 18px 18px; }
  .be-bar .btn { flex: 1 1 0; justify-content: center; padding-left: 8px; padding-right: 8px; }
  .be-sum { flex-basis: 100%; flex-direction: row; align-items: baseline; justify-content: space-between; }
  .be-bar > a.btn { display: none; }
}
.bl-table .cell-main strong { white-space: nowrap; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.bl-treat span { max-width: 200px; }
.bv-strip .bl-bar { background: var(--line); }

/* 2.10.7: patient photo first on the register form, and the camera window */
.pf-photo { display: flex; align-items: center; gap: 14px; padding: 10px 12px; margin-bottom: 12px; border: 1px dashed var(--line, #d6dde6); border-radius: 14px; background: var(--surface-2, #f7f9fb); }
.pf-photo-pic { flex: 0 0 auto; display: inline-flex; }
.pf-photo-txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-photo-txt .inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cam-box { position: relative; width: 100%; aspect-ratio: 1; max-width: 360px; margin: 0 auto; border-radius: 50%; overflow: hidden; background: #0f1b2b; }
.cam-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-hint { text-align: center; margin: 10px 0 0; }

/* 2.10.8: colours by treatment, VVIP, treatment deadline */
.tx-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tx, #5b7083); margin-right: 6px; flex: none; }
.appt.tx-c:not(.st-completed):not(.st-cancelled):not(.st-no-show) { border-left-color: var(--tx); background: color-mix(in srgb, var(--tx) 16%, var(--card, #fff)); }
.appt.tx-c.st-completed, .appt.tx-c.st-cancelled, .appt.tx-c.st-no-show { box-shadow: inset 0 -3px 0 var(--tx); }
.q-card.tx-c { border-left-color: var(--tx); background: color-mix(in srgb, var(--tx) 7%, var(--card, #fff)); }
.plist-item.tx-c { border-left: 4px solid var(--tx); background: color-mix(in srgb, var(--tx) 6%, var(--card, #fff)); }
.vvip-star { color: #b7791f; font-weight: 800; }
.vvip-star.big { font-size: 30px; line-height: 1; }
.vvip-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--purple-50, #f3f0ff); margin-bottom: 10px; }
.vvip-card small { display: block; color: var(--text-2); }
.vvip-sum { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.vv-excl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; max-height: 260px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.txc-list { display: grid; gap: 10px; }
.txc-row { display: grid; grid-template-columns: 210px 1fr; gap: 6px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card, #fff); }
.txc-main { display: flex; align-items: center; gap: 8px; }
.txc-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--tx); flex: none; }
.txc-pal { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.txc-sw { width: 24px; height: 24px; border-radius: 50%; background: var(--tx); border: 2px solid transparent; cursor: pointer; padding: 0; }
.txc-sw.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--card, #fff); }
.txc-custom { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.txc-custom input { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.txc-words { grid-column: 1 / -1; }
.txc-preview { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.txc-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--tx, #5b7083) 16%, var(--card, #fff)); border-left: 4px solid var(--tx, #5b7083); }
@media (max-width: 760px) { .txc-row { grid-template-columns: 1fr; } }
.dl-banner { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.dl-banner .grow { flex: 1; min-width: 0; }
.dl-banner small { color: inherit; opacity: .85; }

/* 2.10.9: payment plan, chart live editing */
.pay-make{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;align-items:end}
.pay-rows{margin-top:12px;display:grid;gap:8px}
.pay-row{display:grid;grid-template-columns:2fr 1.2fr 1fr auto;gap:8px;align-items:end}
.pay-foot{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;margin-top:4px}
.pay-warn{color:var(--danger,#c0392b);font-weight:600;font-size:.9em}
.pay-view{margin:14px 0;padding:12px 14px;border:1px dashed var(--line,#d8dee9);border-radius:12px}
.pay-view-row{display:flex;gap:12px;align-items:center;padding:5px 0}
.est-pay-total td{border-top:2px solid #999}
@media (max-width:640px){.pay-row{grid-template-columns:1fr 1fr}.pay-row .icon-btn{justify-self:end}}
.dc-live{display:flex;align-items:center;gap:8px;margin:8px 0;font-size:.9em}
.dc-edit-note{background:var(--soft,#eef4ff);border-radius:10px;padding:8px 10px;margin:8px 0;display:flex;gap:8px;align-items:center;font-size:.9em}
.dc-plan-bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;margin-top:12px;padding:12px 14px;border-radius:12px;background:var(--soft,#eef4ff)}

/* 2.10.10: dental chairs */
.ch-live{display:inline-flex;align-items:center;gap:6px;color:var(--success,#1c8a4c);font-weight:600;font-size:.9em}
.ch-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.ch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:14px}
.ch-card{background:var(--card,#fff);border:1px solid var(--line,#e3e8ef);border-radius:16px;padding:14px 16px;display:flex;flex-direction:column;gap:4px;min-height:150px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.ch-card.busy{border-color:#c9b6f2;background:linear-gradient(180deg,#f7f3ff,var(--card,#fff) 60%)}
.ch-card.long{border-color:#f0b4b4}
.ch-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.ch-name{font-weight:700;font-size:1.05em}
.ch-pt{font-weight:700;font-size:1.1em;margin-top:6px;color:inherit;text-decoration:none}
.ch-empty{margin-top:auto;font-size:.88em;color:var(--muted,#667085)}
.ch-acts{display:flex;gap:8px;margin-top:auto;padding-top:8px;flex-wrap:wrap}
.ch-wrow{display:flex;align-items:center;gap:10px;padding:9px 0;border-top:1px solid var(--line,#eef1f5)}
.ch-wrow small{display:block;color:var(--muted,#667085)}
.ch-ini{width:34px;height:34px;border-radius:50%;background:var(--soft,#eef4ff);display:grid;place-items:center;font-weight:700;font-size:.8em;flex:none}
.ch-loose{margin-top:10px}
.ch-pick{display:grid;gap:8px}
.ch-opt{display:flex;align-items:center;gap:10px;text-align:left;border:1.5px solid var(--line,#e3e8ef);border-radius:12px;padding:10px 12px;background:var(--card,#fff);cursor:pointer;color:inherit;font:inherit}
.ch-opt small{display:block;color:var(--muted,#667085)}
.ch-opt.on{border-color:var(--primary,#2563eb);box-shadow:0 0 0 3px rgba(37,99,235,.15)}
.ch-opt:disabled{opacity:.55;cursor:not-allowed}
.ch-opt-ic{width:34px;height:34px;border-radius:10px;background:var(--soft,#eef4ff);display:grid;place-items:center;flex:none}
.ch-set{display:grid;gap:8px;margin-bottom:10px}
.ch-srow{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line,#e3e8ef);border-radius:12px}
.ch-srow small{display:block;color:var(--muted,#667085)}
.ch-srow.off{opacity:.6}
@media (max-width:900px){.ch-layout{grid-template-columns:1fr}}

/* 2.10.10: lab link (clinic side) and lab account */
.ll-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.icon-btn.ll-has{color:var(--danger,#c0392b);position:relative}
.icon-btn.ll-has::after{content:"";position:absolute;top:4px;right:4px;width:8px;height:8px;border-radius:50%;background:var(--danger,#d33a3a)}
.ll-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}
.ll-head small{display:block;color:var(--muted,#667085)}
.ll-share{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:4px}
.ll-note,.ll-ask,.ll-ready{display:flex;flex-wrap:wrap;gap:10px;align-items:center;border-radius:12px;padding:10px 12px;margin:10px 0}
.ll-note{background:var(--soft,#eef4ff)}
.ll-ask{background:#fff4e0}
.ll-ready{background:#e8f7ee}
.ll-cols{display:grid;grid-template-columns:240px minmax(0,1fr);gap:18px;margin-top:12px}
.ll-sub{font-weight:700;margin-bottom:8px}
.ll-stages{list-style:none;margin:0;padding:0;display:grid;gap:4px}
.ll-stages li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:10px;color:var(--muted,#667085);font-size:.92em}
.ll-stages li.done{color:inherit}
.ll-stages li.now{background:var(--soft,#eef4ff);font-weight:700;color:inherit}
.ll-stages small{color:var(--muted,#667085);font-weight:400}
.ll-dot{width:10px;height:10px;border-radius:50%;background:var(--line,#d0d5dd);flex:none}
.ll-stages li.done .ll-dot,.ll-stages li.now .ll-dot{background:#1c8a4c}
.ll-talk{display:grid;gap:8px;max-height:320px;overflow-y:auto;padding:4px;margin-bottom:8px}
.ll-msg{display:grid;justify-items:end}
.ll-msg.lab{justify-items:start}
.ll-bub{max-width:85%;padding:8px 11px;border-radius:12px;background:var(--soft,#eef4ff);white-space:pre-wrap;display:grid;gap:6px}
.ll-msg.lab .ll-bub{background:#f2f4f7}
.ll-bub img{max-width:200px;max-height:200px;border-radius:8px;display:block}
.ll-msg small{font-size:.75em;color:var(--muted,#667085)}
.ll-send{display:flex;gap:8px;align-items:center}
.la-labs{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.la-stats{margin-bottom:14px}
.la-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:6px 0 10px}
.la-head h3{margin:0}
#lab-other{padding:18px}
@media (max-width:760px){.ll-cols{grid-template-columns:1fr}}

/* 2.10.10: patient notebook (notes, X-ray with pen marks, dental chart) */
.nb-tabs{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px;margin-bottom:12px}
.nb-tab{display:flex;align-items:center;gap:10px;text-align:left;border:1.5px solid var(--line,#e3e8ef);background:var(--card,#fff);border-radius:14px;padding:10px 12px;cursor:pointer;font:inherit;color:inherit}
.nb-tab b{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--soft,#eef4ff);flex:none}
.nb-tab small{display:block;color:var(--muted,#667085)}
.nb-tab.on{border-color:var(--primary,#2563eb);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.nb-tab.on b{background:var(--primary,#2563eb);color:#fff}
.nb-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px}
.nbx{display:grid;grid-template-columns:minmax(0,1fr) 230px;gap:14px;align-items:start}
.nbx-main{background:var(--card,#fff);border:1px solid var(--line,#e3e8ef);border-radius:16px;padding:12px}
.nbx-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px}
.nbx-state{margin-left:auto}
.nbx-cap{font-size:.85em;color:var(--muted,#667085);margin-bottom:8px}
.nbx-ink{width:100%;max-height:72vh;display:flex;justify-content:center;background:#111;border-radius:10px;overflow:hidden}
.nbx-ink .ink-page{border-radius:0;box-shadow:none}
.nbx-list{display:grid;gap:8px}
.nbx-lh{font-weight:700}
.nbx-th{display:flex;gap:10px;align-items:center;text-align:left;border:1.5px solid var(--line,#e3e8ef);background:var(--card,#fff);border-radius:12px;padding:6px;cursor:pointer;font:inherit;color:inherit}
.nbx-th img{width:64px;height:48px;object-fit:cover;border-radius:8px;background:#111;flex:none}
.nbx-th small{display:block;color:var(--muted,#667085)}
.nbx-th.on{border-color:var(--primary,#2563eb)}
@media (max-width:900px){.nbx{grid-template-columns:1fr}.nbx-list{grid-template-columns:repeat(auto-fill,minmax(180px,1fr))}}

/* 2.10.11: chart, saved-by-tap note and the pulse when no finding is chosen */
.dc-saved{display:flex;gap:8px;align-items:flex-start;margin:0;padding:8px 10px;border-radius:10px;background:#e8f7ee;color:#14532d;font-size:.88em}
.dc-saved svg{flex:none;width:18px;height:18px;margin-top:1px}
.dc-pulse{animation:dcPulse 1.2s ease-out 1;border-radius:12px}
@keyframes dcPulse{0%{box-shadow:0 0 0 0 rgba(220,38,38,.55)}100%{box-shadow:0 0 0 14px rgba(220,38,38,0)}}

/* 2.10.14: demo licence */
.lic-bar.demo{background:linear-gradient(90deg,#fff4d6,#fde8c4);color:#7a4b00;border:1px solid #f1d49a}
.demo-tag{display:inline-block;margin:-12px 0 14px;padding:4px 12px;border-radius:999px;background:#fde8c4;color:#7a4b00;font-weight:700;font-size:.8em;letter-spacing:.08em;text-transform:uppercase}

/* 2.10.15: daily backup reminder */
.bk-ask{display:flex;gap:14px;align-items:flex-start}
.bk-ask>svg{width:38px;height:38px;flex:none;padding:8px;border-radius:12px;background:var(--soft,#eef4ff);color:var(--primary,#2563eb)}
.bk-ask p{margin:0 0 6px}

/* 2.10.16: product name */
.product-tag{margin:8px 0 0;padding:0 12px;font-size:11px;color:var(--muted,#667085);letter-spacing:.04em}
.product-foot{margin:18px 0 0;text-align:center;font-size:12px;color:var(--muted,#667085)}
.product-foot b{color:var(--primary,#2563eb);letter-spacing:.02em}
@media (max-width:1100px){.product-tag{display:none}}
