/* Dental: a navy header over a quiet page; the tooth chart and perio grid; clinical alerts in red and amber; the schedule as a grid; prints cleanly. */
:root {
  color-scheme: light;
  --ink: #17232a; --muted: #52616a; --line: #d9e1e5; --paper: #fff; --bg: #f1f5f6; --soft: #eaf0f2;
  --accent: #4338ca; --accent-ink: #fff; --accent-soft: #e6e7fb; --head: #1e2a5a; --head-2: #27356d; --gold: #f4b740; --mint: #c7d2fe;
  --good: #1e6b34; --good-bg: #e5f6e9; --good-line: #b9e3c4;
  --warn: #7a5200; --warn-bg: #fdf3df; --warn-line: #f0d9a8;
  --bad: #a1261b; --bad-bg: #fbe8e5; --bad-line: #f0bdb4;
  --info: #2b4f8a; --info-bg: #e7eefa; --info-line: #c4d4ef;
  --field: #71818a; --focus: #b35c00; --radius: 12px;
  /* charts: the reference palette's first slot, its grid and ticks */
  --s1: #2a78d6; --surface: #fff; --grid: #e1e0d9; --axis: #c3c2b7; --tick: #6f6d68;
  /* the spine drawing */
  --seg: #e8eef0; --seg-line: #b8c6cc; --seg-find: #fff3d6; --seg-find-line: #b77400; --seg-adj: #0e7490;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e6ecee; --muted: #a9b7bd; --line: #2c373c; --paper: #161d20; --bg: #0f1416; --soft: #1e272b;
    --accent: #a5b4fc; --accent-ink: #11173a; --accent-soft: #232a52; --head: #121a3a; --head-2: #19224a; --gold: #f2c25a;
    --good: #7fd69a; --good-bg: #16301f; --good-line: #2c5a3a;
    --warn: #f2c66d; --warn-bg: #33270e; --warn-line: #5c4718;
    --bad: #f3a196; --bad-bg: #3a1a16; --bad-line: #6b2d25;
    --info: #9cbcf0; --info-bg: #1a2638; --info-line: #2f4566;
    --field: #7d8d94; --focus: #ffb35c;
    --s1: #3987e5; --surface: #161d20; --grid: #2c2c2a; --axis: #383835; --tick: #9a988f;
    --seg: #233035; --seg-line: #3d4d54; --seg-find: #3a2c0c; --seg-find-line: #f2b44a; --seg-adj: #5cc3d9;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
.btn, .brand, .menu a, .nav a, .nav-out, .new-list a, .tabs a, .tile, .appt, .slot { text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.site-header :focus-visible { outline-color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: #fff; color: #1e2a5a; padding: 8px 14px; border-radius: 8px; z-index: 50; font-weight: 600; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Header, search and menu */
.site-header { background: var(--head); color: #fff; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { color: #fff; font-weight: 750; font-size: 1.15rem; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 20px; height: 22px; display: inline-block; background: var(--mint); border-radius: 9px 9px 4px 4px / 9px 9px 12px 12px; clip-path: polygon(0 0, 100% 0, 100% 55%, 82% 100%, 62% 100%, 50% 72%, 38% 100%, 18% 100%, 0 55%); }
.hsearch { flex: 1 1 260px; max-width: 460px; }
.hsearch input { min-height: 36px; padding: 6px 12px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.35); border-radius: 999px; }
.hsearch input::placeholder { color: rgba(255,255,255,.7); }
.hsearch input:focus { background: #fff; color: #17232a; }
.co-name { color: rgba(255,255,255,.9); font-weight: 600; font-size: .92rem; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.nav a, .nav-out { color: rgba(255,255,255,.92); padding: 7px 10px; border-radius: 8px; font-size: .92rem; font-weight: 500; }
.nav a:hover, .nav-out:hover { background: rgba(255,255,255,.14); }
.nav a.cta, .new-btn { background: var(--gold); color: #1d1600; font-weight: 700; border-color: transparent; }
.switcher select { width: auto; min-height: 34px; padding: 4px 8px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.45); font-size: .88rem; max-width: 220px; }
.switcher select option { color: #17232a; background: #fff; }
.new-menu { position: relative; }
.new-menu summary { list-style: none; cursor: pointer; }
.new-menu summary::-webkit-details-marker { display: none; }
.new-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 6px; min-width: 180px; z-index: 30; display: grid; }
.new-list a { color: var(--ink); padding: 8px 10px; border-radius: 7px; font-size: .93rem; }
.new-list a:hover { background: var(--soft); }
.menu { background: var(--head-2); }
.menu-row { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; align-items: center; }
.menu-row::-webkit-scrollbar { display: none; }
.menu a { color: rgba(255,255,255,.86); padding: 10px 12px; font-size: .92rem; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.menu a:hover { color: #fff; background: rgba(255,255,255,.07); }
.menu a.active { color: #fff; border-bottom-color: var(--mint); font-weight: 650; }
.menu-role { margin-left: auto; color: rgba(255,255,255,.6); font-size: .8rem; white-space: nowrap; padding-left: 12px; }

main.wrap { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 1.5rem; margin: 0 0 10px; line-height: 1.2; } h2 { font-size: 1.12rem; margin: 0 0 12px; line-height: 1.3; } h3 { font-size: 1rem; margin: 14px 0 6px; } h4 { font-size: .9rem; margin: 8px 0 2px; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .87rem; } .center { text-align: center; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.bad { color: var(--bad); } .owing { color: var(--bad); font-weight: 650; } .danger-text { color: var(--bad); }
.pre { white-space: pre-line; } .spaced { margin-top: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.card.flush { padding: 0; overflow: hidden; }
.card.danger { border-color: var(--bad-line); }
.card .pad, .pad { padding: 14px 20px; }
.card.flush .section-head { margin-bottom: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h1, .section-head h2 { margin: 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; } .gap { gap: 8px; } .grow { flex: 1 1 200px; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.grid.fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 0 14px; }
.grid.main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 960px) { .grid.main-side { grid-template-columns: 1fr; } }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 4px 0; }
dl.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 4px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; } dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: inherit; }
a.tile:hover { border-color: var(--accent); }
.tile .label { font-size: .84rem; color: var(--muted); margin: 0; }
.tile .value { font-size: 1.55rem; font-weight: 700; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.tile .value.small-v { font-size: 1.05rem; } .tile .value.warn-v { color: var(--warn); }
.tile .sub { font-size: .82rem; color: var(--muted); margin: 2px 0 0; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 9px 16px; border-radius: 9px; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 40px; line-height: 1.2; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.outline { background: transparent; color: var(--accent); }
.btn.small { padding: 5px 11px; font-size: .86rem; min-height: 32px; border-radius: 8px; }
.btn.big { padding: 12px 22px; font-size: 1.05rem; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.outline.danger { background: transparent; color: var(--bad); border-color: var(--bad-line); }
.btn.sign-btn { background: var(--good); border-color: var(--good); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.sign-btn { color: #0b1a10; } }
.linkish { background: none; border: 0; padding: 0 4px; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.field { margin-bottom: 12px; min-width: 0; border: 0; padding: 0; }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; } .field.inline label { margin: 0; }
label, .field legend { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; padding: 0; }
.label-row { display: flex; justify-content: space-between; align-items: end; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.label-row label { margin: 0; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 5px 0; }
label.check input { margin-top: 4px; flex: none; width: auto; min-height: 0; }
.inline-label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; }
.inline-label select { width: auto; min-height: 30px; padding: 3px 6px; }
fieldset.choices { border: 0; padding: 0; margin: 4px 0 14px; } fieldset.choices legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 2px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--field); border-radius: 8px; padding: 8px 10px; min-height: 40px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=color] { padding: 2px; width: 56px; min-height: 36px; }
input.amt { text-align: right; font-variant-numeric: tabular-nums; }
input.short, select.short { max-width: 150px; } input.short-wide { max-width: 320px; }
input.tiny-in { max-width: 80px; } input.code-in { max-width: 110px; } input.fee-in { max-width: 110px; }
textarea { resize: vertical; }
.hint { font-size: .82rem; color: var(--muted); margin: 4px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; }
.filters input, .filters select { min-height: 36px; padding: 6px 9px; }
.cond-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 0 14px; margin-bottom: 10px; }
.cond-grid.scroll { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); margin: 6px 0; }
details.exam, details.repeat { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: 8px 0 12px; }
details.member { border-top: 1px solid var(--line); padding: 8px 0; }
details.member summary { color: var(--ink); font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
fieldset.complaint { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 0; margin: 0 0 12px; }
fieldset.complaint legend { font-weight: 650; font-size: .88rem; padding: 0 6px; }

/* Messages, pills, flags */
.flash, .alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; border: 1px solid; }
.flash.ok, .alert.ok { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.flash.error, .alert.error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.flash.info, .alert.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.pill { display: inline-block; font-size: .76rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill.paid { background: var(--good-bg); color: var(--good); } .pill.overdue { background: var(--bad-bg); color: var(--bad); }
.pill.open { background: var(--info-bg); color: var(--info); } .pill.draft { background: var(--warn-bg); color: var(--warn); }
.pill.void { text-decoration: line-through; }
.alert-dot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: .72rem; font-weight: 800; vertical-align: 1px; background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }
.alert-dot.critical { background: var(--bad); color: #fff; border-color: var(--bad); } .alert-dot.caution { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.flag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .84rem; margin: 2px 4px 2px 0; border: 1px solid; }
.flag.red { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); font-weight: 650; } .flag.amber { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }

/* The patient band */
.pband { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr); gap: 10px 18px; }
@media (max-width: 860px) { .pband { grid-template-columns: 1fr; } }
.pb-id { display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; flex: none; background: var(--accent-soft); }
.avatar.initials { display: inline-flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 750; font-size: 1.2rem; }
.pb-name { font-size: 1.3rem; margin: 0; } .pb-name a { color: var(--ink); text-decoration: none; }
.pb-meta { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.pb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 14px; margin: 0; }
.pb-facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; } .pb-facts dd { margin: 0; font-size: .93rem; }
.pb-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.pb-alerts { grid-column: 1 / -1; display: grid; gap: 6px; }
.palert { margin: 0; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--info-line); background: var(--info-bg); color: var(--info); font-size: .93rem; }
.palert.critical { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); font-weight: 600; border-left: 5px solid var(--bad); }
.palert.caution { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.palert-k { font-weight: 750; text-transform: uppercase; font-size: .74rem; letter-spacing: .05em; margin-right: 6px; }
.pflags { margin: 0; font-size: .93rem; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 13px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 550; font-size: .93rem; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs.small-tabs a { padding: 6px 10px; font-size: .86rem; }
.case-line, .plan-line { padding: 8px 0; border-top: 1px solid var(--line); } .case-line:first-of-type, .plan-line:first-of-type { border-top: 0; }
.case-line p, .plan-line p { margin: 2px 0; }
.meter { height: 9px; border-radius: 0 4px 4px 0; background: var(--soft); overflow: hidden; margin: 4px 0; max-width: 420px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.small-meter { width: 120px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: var(--soft); }
table.compact th, table.compact td { padding: 5px 8px; }
tbody tr:hover td { background: color-mix(in srgb, var(--soft) 55%, transparent); }
tr.total td, tr.subtotal td { font-weight: 700; border-top: 2px solid var(--line); }
tr.grand td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
tr.off td, li.off, .case-line.off { opacity: .55; } tr.off td a { text-decoration: line-through; }
tr.pay-row td { color: var(--good); } tr.pay-row td a { color: var(--good); }
table.today td { vertical-align: middle; } .today-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
table.today tr.st-done td, table.today tr.st-cancelled td, table.today tr.st-noshow td { opacity: .6; }
table.today tr.st-arrived td:first-child { box-shadow: inset 4px 0 0 var(--warn); }

/* Visit note: SOAP, the pain scale, the findings grid */
.soap { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .9rem; margin-right: 6px; vertical-align: 1px; }
.painscale .scale { display: flex; flex-wrap: wrap; gap: 4px; }
.painscale label { margin: 0; font-weight: 600; }
.painscale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.painscale .scale span { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid var(--field); border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; background: var(--paper); }
.painscale input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.painscale input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.painscale .scale label.none span { font-weight: 500; font-size: .86rem; }
.seg-wrap { max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.seg-grid { font-size: .88rem; }
.seg-grid thead th { position: sticky; top: 0; z-index: 2; }
.seg-grid th[scope=row] { text-transform: none; letter-spacing: 0; font-size: .86rem; color: var(--ink); background: var(--paper); white-space: nowrap; width: 1%; }
.seg-grid td, .seg-grid th { padding: 2px 6px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.seg-grid tr.seg-c th[scope=row] { box-shadow: inset 4px 0 0 #7dd3fc; } .seg-grid tr.seg-t th[scope=row] { box-shadow: inset 4px 0 0 #a5b4fc; }
.seg-grid tr.seg-l th[scope=row] { box-shadow: inset 4px 0 0 #fcd34d; } .seg-grid tr.seg-p th[scope=row] { box-shadow: inset 4px 0 0 #f9a8d4; }
.seg-grid tr.marked td, .seg-grid tr.marked th[scope=row] { background: var(--accent-soft); }
.seg-grid input[type=checkbox] { width: 18px; height: 18px; }
.seg-grid input.list-in { min-height: 30px; padding: 3px 6px; max-width: 90px; }
.seg-grid select { min-height: 30px; padding: 3px 6px; min-width: 130px; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); padding: 10px 0; z-index: 5; border-top: 1px solid var(--line); backdrop-filter: blur(4px); }
.side-sticky { position: sticky; top: 12px; }
select.snip { width: auto; min-height: 30px; padding: 2px 6px; font-size: .84rem; }
.note-view .nv-part { margin-bottom: 14px; } .note-view h3 { margin: 6px 0 6px; } .note-view .nv-item p { margin: 0 0 6px; }
.nv-spine { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 14px; align-items: start; }
@media (max-width: 700px) { .nv-spine { grid-template-columns: 1fr; } }
.nv-table { margin: 4px 0 8px; }
.nv-sig { font-style: italic; border-top: 1px solid var(--line); padding-top: 8px; }
.addendum { border-left: 4px solid var(--accent); padding: 4px 12px; margin: 10px 0; background: var(--soft); border-radius: 0 8px 8px 0; }
.voided .note-view { text-decoration: line-through; opacity: .65; }
.score-out { font-weight: 650; font-size: 1.05rem; }
table.sections td:first-child { white-space: nowrap; }
.psfs { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }

/* The spine drawing */
.spine { width: 100%; max-width: 330px; height: auto; display: block; margin: 0 auto; }
.spine .seg { fill: var(--seg); stroke: var(--seg-line); stroke-width: 1; }
.spine .seg.find { fill: var(--seg-find); stroke: var(--seg-find-line); stroke-width: 2; }
.spine .seg.adj { fill: var(--seg-adj); stroke: var(--seg-adj); }
.spine .seg.find.adj { stroke: var(--seg-find-line); stroke-width: 2.5; }
.spine .seg-name { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.spine .seg-note { font-size: 11px; fill: var(--ink); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); justify-content: center; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .key.k-find { background: var(--seg-find); border: 2px solid var(--seg-find-line); } .legend .key.k-adj { background: var(--seg-adj); }

/* Charts (inline SVG; assets/app.js adds the readout) */
.chart-box { position: relative; margin: 6px 0 12px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; } .chart .grid.base { stroke: var(--axis); }
.chart .tick { fill: var(--tick); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series.s1 { stroke: var(--s1); }
.chart .pt.s1, .chart .hover-dot.s1 { fill: var(--s1); }
.chart .pt, .chart .hover-dot { stroke: var(--surface); stroke-width: 2; }
.chart .hover-dot { pointer-events: none; }
.chart .crosshair { stroke: var(--tick); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .hit { fill: transparent; cursor: crosshair; } .chart .hit:focus { outline: none; }
.chart-box .tip { position: absolute; pointer-events: none; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.12); border-radius: 8px; padding: 6px 10px; font-size: .84rem; white-space: nowrap; z-index: 5; display: flex; flex-direction: column; }
.chart-box .tip strong { font-size: .98rem; font-variant-numeric: tabular-nums; }
.chart-box .tip span { color: var(--muted); }
.chart-box figcaption { margin-top: 4px; }

/* Documents */
ul.docs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ul.docs li { display: flex; gap: 12px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 10px; }
ul.docs li:first-child { border-top: 0; padding-top: 0; }
.thumb { flex: none; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; background: var(--soft); display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.doc span { font-weight: 800; color: var(--muted); font-size: .9rem; }
.doc-meta { min-width: 0; overflow-wrap: anywhere; }
.doc-acts { margin-top: 4px; }

/* The schedule */
.sched-head h1 { font-size: 1.3rem; }
.sched { display: grid; grid-template-columns: 58px repeat(var(--cols), minmax(150px, 1fr)); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin-bottom: 14px; padding-top: 38px; position: relative; }
.sched-times { position: relative; border-right: 1px solid var(--line); }
.sched-times span { position: absolute; right: 6px; font-size: .74rem; color: var(--muted); transform: translateY(-50%); white-space: nowrap; }
.sched-times span:first-child { transform: none; }
.sched-col { position: relative; border-right: 1px solid var(--line); min-width: 150px; }
.sched-col:last-child { border-right: 0; }
.sched-colhead { position: absolute; top: -38px; left: 0; right: 0; height: 38px; margin: 0; padding: 8px 8px 0; font-size: .9rem; border-bottom: 3px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--paper); }
.sched-body { position: relative; }
.slot { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
.slot.hour { border-top: 1px solid var(--line); }
.slot.closed { background: repeating-linear-gradient(135deg, var(--soft) 0 6px, transparent 6px 12px); }
.slot:hover { background: var(--accent-soft); }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 3; pointer-events: none; }
.appt { position: absolute; z-index: 2; overflow: hidden; border-radius: 6px; padding: 2px 6px; font-size: .8rem; line-height: 1.25; color: var(--ink); background: color-mix(in srgb, var(--c) 16%, var(--paper)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--paper)); border-left: 4px solid var(--c); }
.appt:hover { z-index: 4; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.appt strong { font-weight: 650; } .appt-t { font-variant-numeric: tabular-nums; color: var(--muted); }
.appt-s { display: block; color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.st-arrived { border-width: 2px; border-left-width: 6px; font-weight: 600; }
.appt.st-done { opacity: .62; } .appt.st-noshow { opacity: .6; background: repeating-linear-gradient(135deg, var(--bad-bg) 0 5px, var(--paper) 5px 10px); }
.appt.st-cancelled { opacity: .45; text-decoration: line-through; }
.appt.block { background: repeating-linear-gradient(135deg, var(--soft) 0 6px, var(--paper) 6px 12px); }
.sched-list { display: none; }
.appt-list li { border-top: 1px solid var(--line); padding: 7px 0; } .appt-list li:first-child { border-top: 0; }
@media (max-width: 700px) { .sched { display: none; } .sched-list { display: block; } }

/* The front page */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 18px 0 26px; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } .hero-card { max-width: 320px; } }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }

/* Idle sign-out warning */
.idle-warn { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; background: var(--paper); border: 2px solid var(--warn-line); box-shadow: 0 12px 34px rgba(0,0,0,.25); border-radius: 12px; padding: 12px 16px; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); flex-wrap: wrap; }
.idle-warn p { margin: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 4px 0; }

/* Printing: no menus; records on the practice's letterhead */
.print-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.letterhead { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 12px; }
.lh-name { font-size: 1.15rem; }
.print-title { font-size: 1.3rem; margin: 6px 0 10px; }
.id-table th { width: 1%; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: .85rem; }
.print-visit { border-top: 2px solid var(--line); margin-top: 18px; padding-top: 8px; break-inside: avoid-page; }
.print-visit h3 { margin-top: 0; }
.print-page main.wrap { max-width: 900px; }
.receipt-line { font-size: 1.05rem; }
table.statement.totals { max-width: 420px; margin-left: auto; margin-top: 14px; }
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  :root { --ink: #000; --muted: #444; --line: #bbb; --paper: #fff; --soft: #f2f2f2; --accent: #000; }
  .site-header, .site-footer, .no-print, .print-bar, .pb-actions, .tabs, .idle-warn, .flash, .btn, form.inline-form { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; margin-bottom: 10px; }
  .sched { display: none; } .sched-list { display: block; }
  a { color: #000; text-decoration: none; }
  .table-wrap { overflow: visible; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .spine .seg.adj { fill: #000; } .spine .seg.find { fill: #fff; stroke: #000; stroke-dasharray: 3 2; }
}

/* The tooth chart */
.odonto-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.odonto { width: 100%; min-width: 560px; height: auto; display: block; }
.odonto-wrap.big .odonto { min-width: 680px; }
aside .odonto, .side-sticky .odonto { min-width: 0; }
.odonto .sf { fill: var(--paper); stroke: var(--seg-line); stroke-width: 1; }
.odonto .sf.fill-co { fill: #3b82f6; } .odonto .sf.fill-am { fill: #6b7280; } .odonto .sf.fill-au { fill: #d4a017; }
.odonto .sf.caries { fill: #fecaca; stroke: #dc2626; stroke-width: 1.5; }
.odonto .sf.fill-co.caries, .odonto .sf.fill-am.caries { fill: #dc2626; }
.odonto .sf.sealant { fill: #bbf7d0; }
.odonto .sf.planned { stroke: #ea580c; stroke-width: 2.5; stroke-dasharray: 3 2; }
.odonto .crown { fill: none; stroke: #7c3aed; stroke-width: 3; }
.odonto .rct { stroke: #be123c; stroke-width: 2.5; }
.odonto .planned-box { fill: none; stroke: #ea580c; stroke-width: 2; stroke-dasharray: 4 3; }
.odonto .missing { stroke: var(--ink); stroke-width: 2.5; }
.odonto .st-missing .sf, .odonto .st-denture .sf { fill: var(--soft); opacity: .5; }
.odonto .st-implant .sf { fill: var(--soft); stroke-dasharray: 2 2; } .odonto .implant { stroke: var(--ink); stroke-width: 2; }
.odonto .st-impacted .sf, .odonto .st-unerupted .sf { opacity: .55; stroke-dasharray: 2 2; }
.odonto .primary .sf { stroke: #a78bfa; }
.odonto .tn { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.odonto .tm { font-size: 9px; fill: var(--ink); }
.odonto .midline { stroke: var(--line); stroke-dasharray: 3 3; }
.odonto a .tooth, [data-tooth-picker] .tooth { cursor: pointer; }
.odonto a:hover .sf, [data-tooth-picker] .tooth:hover .sf { stroke: var(--accent); stroke-width: 2; }
.odonto a:focus-visible { outline: none; } .odonto a:focus-visible .sf { stroke: var(--focus); stroke-width: 3; }
.odonto-key .key { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; }
.odonto-key .k-co { background: #3b82f6; } .odonto-key .k-am { background: #6b7280; } .odonto-key .k-caries { background: #fecaca; border: 2px solid #dc2626; }
.odonto-key .k-crown { border: 3px solid #7c3aed; } .odonto-key .k-planned { border: 2px dashed #ea580c; } .odonto-key .k-missing { color: var(--ink); }
.legend.odonto-key { justify-content: flex-start; }
/* Perio */
.perio-grid { font-size: .8rem; margin-bottom: 10px; }
.perio-grid caption { text-align: left; font-weight: 700; padding: 4px 0; }
.perio-grid th, .perio-grid td { padding: 3px 4px; text-align: center; white-space: nowrap; }
.perio-grid th[scope=row] { text-align: left; text-transform: none; letter-spacing: 0; }
.perio-grid .pg-miss { color: var(--muted); } .perio-grid .pg-small td { font-size: .74rem; color: var(--muted); } .perio-grid .pg-flag { color: var(--warn); font-weight: 700; }
.pd { display: inline-block; min-width: 1em; font-variant-numeric: tabular-nums; }
.pd.d4 { color: var(--warn); font-weight: 750; } .pd.d6 { color: var(--bad); font-weight: 800; text-decoration: underline; }
.bop-dot { color: var(--bad); font-size: .9em; }
.perio-entry th, .perio-entry td { padding: 3px 6px; vertical-align: middle; }
.perio-entry th[scope=row] { text-transform: none; letter-spacing: 0; color: var(--ink); background: var(--paper); }
.perio-entry .arch-break th { text-align: left; background: var(--accent-soft); color: var(--ink); }
.perio-entry input.pd-in { width: 74px; min-height: 32px; padding: 4px 6px; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.perio-entry input.pd-in::placeholder { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.perio-entry input.mini-in { width: 48px; min-height: 32px; padding: 4px 6px; }
.perio-entry select { width: auto; min-height: 32px; padding: 2px 4px; }
.perio-entry input[type=checkbox] { width: 18px; height: 18px; margin: 0 2px; }
.perio-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.perio-wrap thead th { position: sticky; top: 0; z-index: 2; }
/* Procedures, plans, estimates */
input.tooth-in { width: 64px; } input.surf-in { width: 76px; text-transform: uppercase; }
table.compact input.fee-in { width: 96px; } table.compact input.tiny-in { width: 60px; }
.plan-top { align-items: start; margin-bottom: 8px; }
table.procs select, table.plan-items select { min-width: 220px; }
table.plan-items tr.done-row td { background: var(--good-bg); }
fieldset.plain-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.plan-pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.totals-t { margin-top: 12px; }
.sign-lines { margin-top: 26px; }
.sig-row { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-top: 34px; }
.sig-row span { border-top: 1px solid var(--ink); padding-top: 4px; font-size: .85rem; }
@media print { .odonto { min-width: 0; } .odonto .sf.fill-co { fill: #555; } .odonto .sf.caries { fill: #fff; stroke: #000; stroke-width: 2; } .perio-wrap { max-height: none; overflow: visible; } }
