/* iSense Dental — one stylesheet (SaaUI conventions: tokens, page anatomy, tables → cards on phones). No inline styles (CSP). */
:root {
  --brand: #0f766e;  --brand-dark: #0b5953;  --tint: #e6f4f2;
  --ink: #1c1f24;    --muted: #667080;       --line: #e3e6ea;
  --bg: #f5f6f8;     --card: #fff;
  --ok: #1d7a46;     --warn: #b26a00;        --bad: #b3261e;
  --plan: #c62828;   --done: #1565c0;        --exist: #2e7d32;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--brand-dark); }
h1 { font-size: 22px; margin: 0; } h1 small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
h2 { font-size: 16px; margin: 18px 0 8px; } h3 { font-size: 14px; margin: 12px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--ok); } .pos { color: var(--ink); } .bad { color: var(--bad); }
[hidden] { display: none !important; }

/* ---- app shell: header fixed, only .scroller scrolls */
.chrome { flex: none; z-index: 30; }
header.top { display: flex; align-items: center; gap: 14px; background: #111; color: #fff; padding: 8px 16px; min-height: 52px; padding-top: max(8px, env(safe-area-inset-top)); }
header.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .org { font-weight: 400; color: #b9c0c9; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.brand svg { color: #5eead4; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 0; }   /* wraps rather than running under the clinic and user */
@media (max-width: 1240px) { header.top .brand .org, .who span { display: none; } }
.nav a, .navdrop > button { padding: 6px 10px; border-radius: 6px; color: #d7dbe0; white-space: nowrap; }
.nav a:hover { background: #26282c; }
.nav a.on { background: var(--brand); color: #fff; }
.navdrop { position: relative; }
.navdrop > button { background: none; border: 0; font: inherit; cursor: pointer; }
.navdrop > button.on { background: var(--brand); color: #fff; }
.navsub { display: none; position: absolute; top: 100%; left: 0; background: #1d1f23; border-radius: 6px; padding: 4px; min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.navdrop:hover .navsub, .navdrop:focus-within .navsub { display: block; }
.navsub a { display: block; }
.who { display: flex; align-items: center; gap: 10px; color: #b9c0c9; font-size: 13px; white-space: nowrap; margin: 0; }
button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.envbar { background: #fde68a; color: #5b4300; text-align: center; font-size: 12px; padding: 2px; }
.app-body { flex: 1; min-height: 0; display: flex; }
.scroller { flex: 1; min-width: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
main.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 20px 80px; }

/* ---- page anatomy */
.page-top { position: sticky; top: 0; z-index: 6; background: var(--bg); margin: -22px -20px 0; padding: 14px 20px 4px; }
.page-top.stuck { box-shadow: 0 4px 10px -6px rgba(0,0,0,.25); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; }
.flash.success { background: #e8f5ec; border-color: #b7dfc3; color: #134d2c; }
.flash.error { background: #fdecea; border-color: #f3b8b2; color: #7d1a14; }
.flash.info { background: #eef4fd; border-color: #c5d8f5; color: #19396a; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.side-form { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }

/* ---- forms and buttons */
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { width: 100%; min-height: 80px; }
.stack { display: grid; gap: 10px; }
.stack label, .row2 label, .row3 label { display: grid; gap: 3px; font-weight: 600; font-size: 13px; }
.stack label > span.muted, .row2 label > span.muted { font-weight: 400; }
.stack input:not([type=checkbox]):not([type=radio]), .stack select { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.row2 input, .row2 select, .row3 input, .row3 select { width: 100%; }
label.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); border-color: #e6b3ae; }
.btn:disabled { opacity: .55; cursor: default; }
.small-btn { padding: 4px 9px; font-size: 12.5px; }
.inline { display: inline; margin: 0; }
.actions-row { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; border-top: 1px solid var(--line); margin-top: 6px; z-index: 5; }
details.more-form > summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; padding: 4px 0; }
details.more-form[open] > summary { margin-bottom: 8px; }

/* ---- tiles, pills */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); display: block; }
.tile b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.warn { border-left-color: var(--warn); } .tile.bad { border-left-color: var(--bad); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef0f3; color: #3b4350; white-space: nowrap; }
.pill.attn { background: #fff3cd; color: #6b4e00; } .pill.bad { background: #fdecea; color: #7d1a14; } .pill.ok { background: #e8f5ec; color: #134d2c; }
.pill.st-arrived, .pill.st-in_chair { background: #fff3cd; color: #6b4e00; } .pill.st-completed { background: #e8f5ec; color: #134d2c; }
.pill.st-confirmed { background: #e6f4f2; color: #0b5953; } .pill.st-no_show, .pill.st-cancelled { background: #fdecea; color: #7d1a14; }
.alert-box { background: #fdecea; border: 1px solid #f3b8b2; color: #7d1a14; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 600; }

/* ---- tables */
.tablewrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { position: sticky; top: 0; background: #f0f2f5; font-size: 12.5px; color: #4a5260; font-weight: 600; z-index: 2; white-space: nowrap; }
.grid tbody tr:nth-child(even) > td { background: #f6f8fb; }
.grid tbody tr:hover > td { background: #e3f1ef; }
.grid tr.total > td, .grid tr.total > th { background: #eef6f5; font-weight: 600; position: sticky; top: 33px; z-index: 1; }
.grid tr.muted-row > td { color: var(--muted); text-decoration: line-through; }
.grid td.empty { text-align: center; color: var(--muted); padding: 22px; }
.grid a.rowlink { font-weight: 600; text-decoration: none; }

/* ---- schedule day grid (rowspan per appointment; colours per provider) */
.sched { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100dvh - 210px); }
table.day { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; table-layout: fixed; }
.day th { position: sticky; top: 0; background: #f0f2f5; z-index: 3; padding: 8px; font-size: 13px; border-bottom: 1px solid var(--line); }
.day th.time, .day td.time { width: 64px; }
.day td { border-bottom: 1px solid #eef0f3; border-left: 1px solid #eef0f3; height: 26px; padding: 0; vertical-align: top; }
.day tr.hour td { border-top: 1px solid #d5dae1; }
.day td.time { position: sticky; left: 0; background: #fafbfc; color: var(--muted); font-size: 11.5px; padding: 2px 6px; z-index: 2; border-left: 0; }
.day td.free a { display: block; height: 100%; min-height: 25px; }
.day td.free a:hover { background: var(--tint); }
.appt { display: block; height: 100%; margin: 1px 3px; padding: 4px 7px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 12.5px; line-height: 1.3; border-left: 4px solid; overflow: hidden; }
.appt b { display: block; }
.appt .meta { color: #4a5260; }
.appt.st-completed { opacity: .65; } .appt.st-no_show { text-decoration: line-through; opacity: .6; }
.c1 { background: #e0f2f1; border-color: #0f766e; } .c2 { background: #e3f2fd; border-color: #1565c0; } .c3 { background: #fce4ec; border-color: #ad1457; }
.c4 { background: #fff3e0; border-color: #e65100; } .c5 { background: #ede7f6; border-color: #5e35b1; } .c6 { background: #f1f8e9; border-color: #558b2f; }
.c7 { background: #fffde7; border-color: #f9a825; } .c8 { background: #eceff1; border-color: #455a64; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border-left: 0 !important; vertical-align: middle; margin-right: 4px; }
.swatch.c1 { background: #0f766e; } .swatch.c2 { background: #1565c0; } .swatch.c3 { background: #ad1457; } .swatch.c4 { background: #e65100; }
.swatch.c5 { background: #5e35b1; } .swatch.c6 { background: #558b2f; } .swatch.c7 { background: #f9a825; } .swatch.c8 { background: #455a64; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .dayc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.week .dayc h3 { margin: 0 0 6px; font-size: 13px; } .week .dayc h3 a { text-decoration: none; }
.week .dayc.today { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.week .appt { margin: 0 0 5px; height: auto; }

/* ---- tooth chart (SVG) */
.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow-x: auto; margin-bottom: 14px; }
svg.teeth { width: 100%; min-width: 640px; height: auto; display: block; }
.teeth .tooth { cursor: pointer; }
.teeth .tooth .s { fill: #fff; stroke: #9aa3ae; stroke-width: 1; }
.teeth .tooth:hover .s { stroke: var(--brand); }
.teeth .tooth.sel .s { stroke: var(--brand); stroke-width: 2.2; }
.teeth .s.planned { fill: #ef9a9a; } .teeth .s.completed { fill: #90caf9; } .teeth .s.existing { fill: #a5d6a7; } .teeth .s.caries { fill: #ffcc80; }
.teeth .num { font-size: 11px; fill: #4a5260; text-anchor: middle; } .teeth .tooth.sel .num { fill: var(--brand); font-weight: 700; }
.teeth .x { stroke: #555; stroke-width: 2.4; } .teeth .ring { fill: none; stroke-width: 2.4; }
.teeth .ring.planned { stroke: var(--plan); } .teeth .ring.completed { stroke: var(--done); } .teeth .ring.existing { stroke: var(--exist); }
.teeth .midline { stroke: #c9ced6; stroke-dasharray: 3 3; }
/* tooth drawings (Web\ToothArt): root ivory, crown white or coloured by whole-tooth work */
.teeth .tooth-body { fill: #f7f0e1; }
.teeth .crown { fill: #fff; }
.teeth .crown.planned { fill: #ef9a9a; } .teeth .crown.completed { fill: #90caf9; } .teeth .crown.existing { fill: #a5d6a7; }
.teeth .tooth-line { fill: none; stroke: #8a94a0; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.teeth .tooth:hover .tooth-line, .teeth .tooth.sel .tooth-line { stroke: var(--brand); stroke-width: 2; }
.teeth .canal { fill: none; stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.teeth .canal.planned { stroke: var(--plan); } .teeth .canal.completed { stroke: var(--done); } .teeth .canal.existing { stroke: var(--exist); }
.teeth .implant { fill: #cfd8dc; stroke: #546e7a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.teeth .implant.planned { fill: #ef9a9a; stroke: var(--plan); } .teeth .implant.completed { fill: #90caf9; stroke: var(--done); }
.teeth .tooth-line.outline { stroke-width: 2.6; } .teeth .tooth-line.outline.planned { stroke: var(--plan); }
.teeth .tooth-line.outline.completed { stroke: var(--done); } .teeth .tooth-line.outline.existing { stroke: var(--exist); }
.teeth .tooth-art.gone { opacity: .35; }
.teeth .tooth-art .x { vector-effect: non-scaling-stroke; }
.teeth .x.planned { stroke: var(--plan); }
.teeth .arch { font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding: 6px 4px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; border: 1px solid #9aa3ae; }
.legend .planned { background: #ef9a9a; } .legend .completed { background: #90caf9; } .legend .existing { background: #a5d6a7; } .legend .caries { background: #ffcc80; }
.surfaces { display: flex; gap: 6px; flex-wrap: wrap; }
.surfaces label { display: inline-flex !important; align-items: center; gap: 4px; border: 1px solid #c9ced6; border-radius: 6px; padding: 4px 8px; font-weight: 600 !important; cursor: pointer; }
.surfaces input { margin: 0; }

/* ---- activity log: before → after */
table.changes { border-collapse: collapse; margin-top: 4px; }
table.changes th, table.changes td { padding: 1px 6px 1px 0; border: 0; background: transparent !important; text-align: left; font-size: 12px; vertical-align: top; position: static; }
table.changes th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.changes td.was { color: #7d1a14; text-decoration: line-through; text-decoration-color: rgba(125, 26, 20, .4); }
table.changes td.now { color: #134d2c; }

/* ---- notes */
.note { border-left: 3px solid var(--brand); padding: 8px 12px; background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 10px; }
.note.addendum { margin-left: 24px; border-left-color: var(--warn); }
.note .by { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.note .body { white-space: pre-wrap; }

/* ---- login */
.login { max-width: 380px; margin: 8vh auto; }
.login h1 { margin-bottom: 4px; }

/* ---- printable pages (statement, claim) */
.paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--line); border-radius: var(--radius); }
.paper header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.paper .due { font-size: 20px; font-weight: 700; }
.paper table.grid th { position: static; }

/* ---- phones: tab bar, More page */
.tabbar { display: none; }
.jobs { display: grid; gap: 8px; }
.job { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); }
.job small { display: block; color: var(--muted); }

@media (max-width: 900px) {
  .cols, .cols3, .side-form { grid-template-columns: 1fr; }
  .week { grid-template-columns: 1fr; }
  .nav a, .navdrop > button { padding: 6px 7px; }
}
@media (max-width: 700px) {
  header.top { gap: 10px; padding: 8px 12px; }
  .nav, .who span { display: none; }
  .brand { flex: 1; }
  main.wrap { padding: 14px 12px 96px; }
  .page-top { margin: -14px -12px 0; padding: 10px 12px 2px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; } .tile b { font-size: 19px; }
  .brand .org { display: none; }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 7; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--muted); text-decoration: none; min-height: 52px; }
  .tabbar a.on { color: var(--brand); font-weight: 600; }
  /* tables as cards: each row a card, each value labelled with its column (app.js sets data-label) */
  table.as-cards thead { display: none; }
  table.as-cards, table.as-cards tbody, table.as-cards tr, table.as-cards td { display: block; width: 100%; }
  table.as-cards tr { border-bottom: 1px solid var(--line); padding: 8px 12px; }
  table.as-cards td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.as-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; }
  table.as-cards td:first-child { font-weight: 600; text-align: left; }
  table.as-cards td:first-child::before { content: none; }
  table.as-cards td:empty { display: none; }
  table.as-cards tbody tr:nth-child(even) > td { background: transparent; }
  table.as-cards tr.total { position: static; }
  .sched { max-height: none; }
}
@media print {
  body { overflow: visible; display: block; background: #fff; }
  .chrome, .tabbar, .actions, .tabs, .filters, .no-print, .flash { display: none !important; }
  .scroller { overflow: visible; }
  main.wrap { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; }
  .page-top { position: static; margin: 0; padding: 0; box-shadow: none; }
  .tablewrap { overflow: visible; border: 0; }
  .grid th { position: static; }
}

/* ---- clinic switcher (top bar) and owner console */
.clinic-switch { margin: 0; }
.clinic-switch select { background: #26282c; color: #fff; border-color: #3a3d42; padding: 5px 8px; max-width: 200px; }
.clinic-one { color: #b9c0c9; font-size: 13px; white-space: nowrap; }
.who a { color: #b9c0c9 !important; text-decoration: underline; }
.once { background: #fff8e1; border: 1px solid #f3d27a; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.once code { font-size: 15px; background: #fff; padding: 2px 6px; border: 1px solid #e3d3a0; border-radius: 4px; user-select: all; }
@media (max-width: 700px) { .clinic-switch select { max-width: 130px; } .clinic-one { display: none; } }

/* ---- chart tools toolbar (Tooth chart · Perio · Treatment plan · Documents · Imaging) */
.chart-tools { display: flex; gap: 8px; margin: -4px 0 14px; overflow-x: auto; }
.chart-tools a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 92px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chart-tools a:hover { color: var(--brand-dark); border-color: #b9d9d5; }
.chart-tools a.on { color: #fff; background: var(--brand); border-color: var(--brand); }
.chart-tools svg { width: 24px; height: 24px; }
@media (max-width: 700px) { .chart-tools a { min-width: 72px; padding: 6px; font-size: 11.5px; } }

/* ---- perio grid */
.perio-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
table.perio { border-collapse: collapse; font-size: 12px; }
.perio th, .perio td { border: 1px solid #e6e9ee; padding: 2px; text-align: center; }
.perio th.rowh { text-align: left; white-space: nowrap; padding: 2px 8px; background: #f6f8fb; color: #4a5260; position: sticky; left: 0; z-index: 1; }
.perio thead th { background: #f0f2f5; font-size: 12px; min-width: 66px; }
.perio thead th.missing, .perio td.missing { background: #eceff1; color: #9aa3ae; }
.perio .sites { display: flex; gap: 1px; justify-content: center; }
.perio input[type=text] { width: 20px; padding: 2px 0; text-align: center; font-size: 12px; border-radius: 3px; }
.perio input.d4 { background: #fff3cd; border-color: #e0b84d; } .perio input.d6 { background: #fdecea; border-color: #e57373; color: #7d1a14; font-weight: 700; }
.perio .bop { display: flex; gap: 1px; justify-content: center; }
.perio .bop input { margin: 0 2px; accent-color: var(--bad); }
.perio .ro { display: inline-block; width: 20px; }
.perio .ro.d4 { background: #fff3cd; } .perio .ro.d6 { background: #fdecea; color: #7d1a14; font-weight: 700; }
.perio .was { display: block; font-size: 9.5px; color: var(--muted); }
.perio .bleed { color: var(--bad); font-weight: 700; }
.perio select { padding: 1px; font-size: 12px; }

/* ---- documents / imaging */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.thumb { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.thumb .pic { height: 130px; background: #111; display: flex; align-items: center; justify-content: center; color: #9aa3ae; font-size: 12px; }
.thumb .pic img { max-width: 100%; max-height: 130px; display: block; }
.thumb .cap { padding: 6px 8px; font-size: 12px; }
.viewer { display: grid; grid-template-columns: 1fr; gap: 12px; }
.viewer.two { grid-template-columns: 1fr 1fr; }
.viewer figure { margin: 0; background: #111; border-radius: var(--radius); padding: 8px; text-align: center; }
.viewer img { max-width: 100%; max-height: calc(100dvh - 260px); }
.viewer figcaption { color: #cfd5dc; font-size: 12.5px; padding-top: 6px; }
@media (max-width: 900px) { .viewer.two { grid-template-columns: 1fr; } }

/* ---- Roles (Setup → Roles): role cards left, rights by category with switches right */
.roles-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.role-list { display: grid; gap: 8px; position: sticky; top: 0; }
.role-card { display: grid; gap: 4px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
.role-card:hover { border-color: #b9d9d5; box-shadow: 0 2px 8px rgba(15, 118, 110, .08); }
.role-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
.role-card.new { border-style: dashed; }
.role-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.role-desc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.role-meta { font-size: 12px; color: var(--muted); }
.meter { display: block; height: 4px; background: #edf0f3; border-radius: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.meter .w0 { width: 0; } .meter .w5 { width: 5%; } .meter .w10 { width: 10%; } .meter .w15 { width: 15%; } .meter .w20 { width: 20%; } .meter .w25 { width: 25%; }
.meter .w30 { width: 30%; } .meter .w35 { width: 35%; } .meter .w40 { width: 40%; } .meter .w45 { width: 45%; } .meter .w50 { width: 50%; } .meter .w55 { width: 55%; }
.meter .w60 { width: 60%; } .meter .w65 { width: 65%; } .meter .w70 { width: 70%; } .meter .w75 { width: 75%; } .meter .w80 { width: 80%; } .meter .w85 { width: 85%; }
.meter .w90 { width: 90%; } .meter .w95 { width: 95%; } .meter .w100 { width: 100%; }
.role-head label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.role-head input[name=name] { font-size: 18px; font-weight: 600; }
.role-facts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.members summary { cursor: pointer; color: var(--brand-dark); font-size: 13px; font-weight: 600; }
.chip { display: inline-block; padding: 2px 10px; margin: 3px 2px 0 0; border-radius: 999px; background: var(--tint); color: var(--brand-dark); font-size: 12.5px; text-decoration: none; }
.chip.off { background: #eef0f3; color: var(--muted); text-decoration: line-through; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 8px; }
.cat header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.cat h3 { margin: 0; font-size: 14.5px; } .cat header p { margin: 2px 0 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch.right { padding: 8px 0; border-bottom: 1px dashed #edf0f3; } .switch.right:last-child { border-bottom: 0; }
.switch.right span { display: grid; gap: 1px; } .switch.right b { font-size: 13.5px; font-weight: 600; } .switch.right small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { flex: none; position: relative; width: 38px; height: 22px; border-radius: 999px; background: #cfd5dc; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + i { opacity: .55; cursor: not-allowed; }
.switch.all { gap: 8px; } .switch.all .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.role-actions { align-items: center; }
.role-actions .spacer { flex: 1; }
.dirty { color: var(--warn); font-size: 12.5px; font-weight: 600; }
.dialog { border: 0; border-radius: 12px; padding: 20px 22px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(17, 17, 17, .45); }
.dialog h2 { margin-top: 0; }
@media (max-width: 900px) { .roles-layout { grid-template-columns: 1fr; } .role-list { position: static; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }

/* ---- Practice Setup hub */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.hub-sec { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 8px; }
.hub-sec h2 { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-dark); }
.hub-sec > p { margin: 2px 0 10px; }
.hub-item { display: grid; gap: 1px; padding: 8px 10px; margin: 0 -4px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.hub-item:hover { background: var(--tint); }
.hub-item b { font-size: 13.5px; font-weight: 600; } .hub-item span { font-size: 12px; color: var(--muted); }
.setup-form label { display: grid; gap: 3px; font-weight: 600; font-size: 13px; }
.hours input[type=time] { width: 130px; }
.template th { min-width: 118px; } .tpl-cell { white-space: nowrap; } .tpl-cell input { width: 104px; display: block; margin: 1px 0; padding: 3px 4px; font-size: 12.5px; }
.day td.block { background: repeating-linear-gradient(135deg, #f1f3f6, #f1f3f6 6px, #e7eaee 6px, #e7eaee 12px); color: #6b7380; font-size: 11.5px; padding: 2px 6px; }
.closed-day { background: #fdecea; border: 1px solid #f3b8b2; color: #7d1a14; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; font-weight: 600; }
.teeth .tooth-line.outline.condition { stroke: #e08600; }
@media print { .page-break { page-break-after: always; } .page-break:last-child { page-break-after: auto; } }
.form-tablet { max-width: 720px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; }
.form-tablet h1 { margin-bottom: 2px; }
.fq { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fq-label { font-weight: 600; margin-bottom: 6px; }
.fq input:not([type=radio]):not([type=checkbox]), .fq textarea { width: 100%; font-size: 16px; }
.fq input.sig { font-family: "Snell Roundhand", "Segoe Script", cursive; font-size: 22px; }
.form-answers dt { font-weight: 600; color: var(--ink); } .form-answers dd { margin-bottom: 6px; }
.integrations { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.integ header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.integ h2 { margin: 0; } .integ header p { margin: 2px 0 0; }
@media (max-width: 700px) { .integrations { grid-template-columns: 1fr; } }

/* ---- perio exam setup and guided entry */
.perio-setup section { margin-bottom: 14px; }
.perio-setup h3 { margin-top: 4px; } .perio-setup h3 small { font-weight: 400; margin-left: 6px; }
.seg-choice { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input, .nav-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { display: block; padding: 7px 14px; border-right: 1px solid var(--line); }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--brand); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -3px; }
.nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.nav-card { position: relative; display: grid; gap: 4px; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.nav-card:hover { border-color: #b7c2cc; }
.nav-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--tint); }
.nav-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-letter { font-weight: 700; color: var(--muted); line-height: 1; }
.nav-card:has(input:checked) .nav-letter { color: var(--brand); }
.nav-label { font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav-diagram { width: 100%; height: auto; }
.setup-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.skip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.counter input { width: 64px; margin: 0 6px; text-align: center; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid #cdd3da; border-bottom-width: 2px; border-radius: 4px; background: #fff; font: 11.5px/1.5 var(--font); }
.perio-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; margin-bottom: 10px; }
.perio-bar .chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: center; }
.perio-now { margin: 0 0 8px; padding: 6px 10px; border-radius: var(--radius); background: var(--tint); color: var(--brand-dark); font-weight: 600; font-size: 13px; }
.perio thead th.skipped { background: repeating-linear-gradient(135deg, #f0f2f5 0 4px, #e3e7ec 4px 8px); color: #8a94a0; }
.perio .here { outline: 2px solid var(--brand); outline-offset: 1px; background: #fffbe6; }
.perio .sup input { accent-color: var(--warn); }
.perio .supp { color: var(--warn); font-weight: 700; }
.perio-bar > label { display: grid; gap: 3px; font-weight: 600; font-size: 13px; }

/* ---- perio chart (Web\PerioChart) */
.perio-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
a.seg-opt { color: inherit; text-decoration: none; }
a.seg-opt[aria-current] span { background: var(--brand); color: #fff; }
.pc-key i { display: inline-block; width: 14px; height: 0; margin: 0 3px 3px 8px; vertical-align: middle; border-top: 2px solid; }
.pc-key .k-gm { border-color: #1e6fd9; } .pc-key .k-cal { border-color: var(--bad); } .pc-key .k-was { border-top: 2px dashed #8a94a0; }
.pc-key .k-bl, .pc-key .k-su { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--bad); vertical-align: 0; }
.pc-key .k-su { background: #e0a100; }
.perio-chartwrap { padding: 6px 4px; }
.perio-chart { display: block; width: 100%; min-width: 760px; height: auto; }
.perio-chart text { font: 9px var(--font); text-anchor: middle; fill: #4a5260; }
.perio-chart .pc-mm { stroke: #edf0f3; stroke-width: 1; }
.perio-chart .pc-mmt { text-anchor: end; fill: #a3abb5; font-size: 8px; }
.perio-chart .pc-side { text-anchor: start; font-weight: 700; fill: #8a94a0; font-size: 9px; }
.perio-chart .pc-cej { stroke: #c3cad2; stroke-width: 1; stroke-dasharray: 3 3; }
.perio-chart .pc-tooth path:first-child { fill: #fbfaf6; stroke: #b9c0c8; stroke-width: .6; vector-effect: non-scaling-stroke; }
.perio-chart .pc-tooth .pc-x { display: none; stroke: #b9c0c8; stroke-width: 1.5; fill: none; }
.perio-chart .pc-tooth.gone path:first-child { opacity: .12; }
.perio-chart .pc-tooth.gone .pc-x { display: inline; }
.perio-chart .pc-gm { fill: none; stroke: #1e6fd9; stroke-width: 1.6; stroke-linejoin: round; }
.perio-chart .pc-cal { fill: none; stroke: var(--bad); stroke-width: 1.6; stroke-linejoin: round; }
.perio-chart .pc-was { fill: none; stroke: #8a94a0; stroke-width: 1.2; stroke-dasharray: 3 2; }
.perio-chart .pc-bar { stroke: rgba(29, 122, 70, .35); stroke-width: 5; stroke-linecap: round; }
.perio-chart .pc-bar.d4 { stroke: rgba(224, 161, 0, .55); } .perio-chart .pc-bar.d6 { stroke: rgba(179, 38, 30, .5); }
.perio-chart .pc-d { font-size: 8.5px; font-weight: 600; } .perio-chart .pc-d.d4 { fill: #8a5a00; } .perio-chart .pc-d.d6 { fill: var(--bad); font-weight: 800; }
.perio-chart .pc-bl { fill: var(--bad); } .perio-chart .pc-su { fill: #e0a100; }
.perio-chart .pc-num { font-size: 11px; font-weight: 700; fill: var(--ink); }
.perio-chart .pc-mf { font-size: 7.5px; fill: var(--warn); text-anchor: end; }
@media print { .perio-views .seg-choice { display: none; } [data-pane] { display: block !important; } }
.perio-chart .pc-bar.none { display: none; }

/* ---- perio chart 2D / 3D (perio3d.js) */
.dim-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 8px; }
.seg-btns { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg-btns button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 5px 11px; font: 12.5px var(--font); color: var(--ink); cursor: pointer; }
.seg-btns button:last-child { border-right: 0; }
.seg-btns button:hover { background: #f3f5f8; }
.seg-btns button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg-btns button:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
canvas.perio-3d { display: block; width: 100%; height: 480px; border-radius: var(--radius); background: radial-gradient(ellipse at 50% 40%, #ffffff 0%, #eef2f6 70%, #e3e9ef 100%); cursor: grab; touch-action: none; }
canvas.perio-3d:active { cursor: grabbing; }
canvas.perio-3d:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.feature-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px dashed var(--line); }

/* ---- Today: practice overview (Service\Insights, Web\Charts) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:root { --series-1: #2a78d6; --series-2: #eb6834; --chart-surface: #fff; }
.ov-title { margin-top: 26px; } .ov-title small { font-weight: 400; font-size: 13px; margin-left: 6px; }
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .ov-grid { grid-template-columns: 1fr; } }
.card.w { margin-bottom: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
a.card.w { color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s; }
a.card.w:hover { border-color: #c4ccd5; box-shadow: 0 2px 10px rgba(20, 30, 40, .06); }
.w-head { display: flex; align-items: center; gap: 10px; }
.w-head h3 { margin: 0; font-size: 14.5px; } .w-head h3 a { color: var(--ink); text-decoration: none; } .w-head h3 a:hover { text-decoration: underline; }
.w-note { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.w-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; }
.w-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.t-teal { background: #e3f4f1; color: #0f766e; } .t-violet { background: #ecebfb; color: #4f44b8; } .t-coral { background: #fdecea; color: #b3261e; }
.t-blue { background: #e7f0fb; color: #1f62b3; } .t-amber { background: #fff3d6; color: #8a5a00; } .t-navy { background: #e8ecf3; color: #253858; }
.w-nums { display: flex; gap: 28px; flex-wrap: wrap; }
.w-nums span { display: grid; font-size: 12.5px; color: var(--muted); }
.w-nums b { font-size: 26px; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; }
.w-nums b.bad { color: var(--bad); }
.w-hero { display: flex; align-items: baseline; gap: 10px; } .w-hero b { font-size: 30px; font-variant-numeric: tabular-nums; } .w-hero span { color: var(--muted); font-size: 12.5px; }
.w-filter select { padding: 4px 8px; font-size: 13px; }
.w-empty { display: grid; place-items: center; text-align: center; gap: 4px; padding: 34px 10px; color: var(--muted); } .w-empty b { color: var(--ink); }
.w-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.w-list li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid #f0f2f5; font-size: 13.5px; }
.w-list li .muted { flex: 1; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: #4a5260; }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend i.s1 { background: var(--series-1); } .legend i.s2 { background: var(--series-2); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: #edf0f3; stroke-width: 1; } .chart .grid.base { stroke: #c9d0d8; }
.chart text { font: 11px var(--font); fill: #6b7380; } .chart .yl { text-anchor: end; } .chart .xl { text-anchor: middle; }
.chart .mark.s1 { fill: var(--series-1); } .chart .mark.s2 { fill: var(--series-2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .chart .line.s1 { stroke: var(--series-1); } .chart .line.s2 { stroke: var(--series-2); }
.chart .dot { stroke: var(--chart-surface); stroke-width: 2; } .chart .dot.s1 { fill: var(--series-1); } .chart .dot.s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: default; } .chart .hit:hover, .chart .hit.on { fill: rgba(30, 50, 80, .045); }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; max-width: 280px; padding: 6px 9px; border-radius: 7px; background: #1c1f24; color: #fff; font-size: 12px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.chart-table summary { font-size: 12px; color: var(--muted); cursor: pointer; width: max-content; }
.chart-table table { margin-top: 6px; font-size: 12.5px; }

/* ---- Today: key numbers (grouped, hairline-separated cells) */
.kpis { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 8px; }
.kpi-group { flex: 4 1 380px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; min-width: 0; }
.kpi-group:nth-child(2) { flex: 2 1 240px; }
.kpi-group header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.kpi-group h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi-group header a { font-size: 12.5px; color: var(--brand-dark); text-decoration: none; } .kpi-group header a:hover { text-decoration: underline; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--card); color: var(--ink); text-decoration: none; min-width: 0; transition: background .12s; }
a.kpi:hover { background: #f6f9f9; }
a.kpi:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.kpi-l { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b { font-size: 24px; line-height: 1.15; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b.flag { color: #8a5a00; }
.kpi-n { font-size: 11.5px; color: #8a929d; }
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; background: #e0a100; flex: none; }
.dayflow { display: flex; gap: 2px; height: 8px; margin-top: 12px; border-radius: 999px; overflow: hidden; }
.dayflow span { flex: 1 1 0; min-width: 6px; }
.df-done { background: var(--brand); } .df-chair { background: #2a78d6; } .df-wait { background: #e0a100; } .df-left { background: #dfe4ea; }
.dayflow-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.dayflow-key span { display: inline-flex; align-items: center; gap: 5px; } .dayflow-key i { width: 8px; height: 8px; border-radius: 2px; }
.dayflow .w0 { flex-grow: 0; }
.dayflow .w1 { flex-grow: 1; }
.dayflow .w2 { flex-grow: 2; }
.dayflow .w3 { flex-grow: 3; }
.dayflow .w4 { flex-grow: 4; }
.dayflow .w5 { flex-grow: 5; }
.dayflow .w6 { flex-grow: 6; }
.dayflow .w7 { flex-grow: 7; }
.dayflow .w8 { flex-grow: 8; }
.dayflow .w9 { flex-grow: 9; }
.dayflow .w10 { flex-grow: 10; }
.dayflow .w11 { flex-grow: 11; }
.dayflow .w12 { flex-grow: 12; }
.dayflow .w13 { flex-grow: 13; }
.dayflow .w14 { flex-grow: 14; }
.dayflow .w15 { flex-grow: 15; }
.dayflow .w16 { flex-grow: 16; }
.dayflow .w17 { flex-grow: 17; }
.dayflow .w18 { flex-grow: 18; }
.dayflow .w19 { flex-grow: 19; }
.dayflow .w20 { flex-grow: 20; }

/* ---- perio route diagrams (Perio::diagram): arches, numbered stretches in categorical order */
.nav-diagram .nav-tooth { fill: #f1f3f6; stroke: #cfd6de; stroke-width: .6; }
.nav-diagram .nav-path { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-diagram .nav-badge { fill: #fff; stroke-width: 1.4; }
.nav-diagram .nav-n { font: 700 6.2px var(--font); text-anchor: middle; fill: var(--ink); }
.nav-diagram .ns1 { --c: #2a78d6; } .nav-diagram .ns2 { --c: #eb6834; } .nav-diagram .ns3 { --c: #1baf7a; } .nav-diagram .ns4 { --c: #6250d6; }
.nav-diagram .ns5 { --c: #e87ba4; } .nav-diagram .ns6 { --c: #008300; } .nav-diagram .ns7 { --c: #eda100; } .nav-diagram .ns8 { --c: #e34948; }
.nav-diagram .nav-s .nav-path { stroke: var(--c); } .nav-diagram .nav-s .nav-head { fill: var(--c); } .nav-diagram .nav-s .nav-badge { stroke: var(--c); }
/* live map while entering: the stretch being probed stands out, finished ones fade */
.nav-diagram.live .nav-s { opacity: .35; transition: opacity .2s; }
.nav-diagram.live .nav-s.done { opacity: .6; } .nav-diagram.live .nav-s.done .nav-path { stroke-dasharray: 2 2.5; }
.nav-diagram.live .nav-s.cur { opacity: 1; } .nav-diagram.live .nav-s.cur .nav-path { stroke-width: 3.6; }
.nav-diagram.live .nav-tooth.here { fill: #fff3cd; stroke: #e0a100; stroke-width: 1.4; }

/* ---- perio setup cards and entry guide */
.nav-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.nav-card { padding: 10px 10px 12px; border-radius: 12px; }
.nav-card:has(input:checked) { background: #f7fbfa; }
.nav-top { display: flex; align-items: center; justify-content: space-between; }
.nav-letter { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #eef1f4; font-size: 12px; }
.nav-card:has(input:checked) .nav-letter { background: var(--brand); color: #fff; }
.nav-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #c3cbd4; background: #fff; }
.nav-card:has(input:checked) .nav-check { border: 5px solid var(--brand); }
.nav-label { text-align: center; }
.counter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 400; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.stepper button { border: 0; background: #f6f8fa; width: 32px; font-size: 16px; color: var(--ink); cursor: pointer; }
.stepper button:hover { background: #eceff3; }
.stepper input { width: 52px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; text-align: center; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.perio-guide { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.route-map { flex: none; width: 112px; }
.perio-guide-text { min-width: 0; } .perio-guide-text p { margin: 2px 0; }
.perio-guide .perio-now { margin: 0 0 2px; padding: 0; background: none; font-size: 14.5px; }
@media (max-width: 560px) { .route-map { width: 84px; } }
.nav-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 540px; }
@media (min-width: 1280px) { .nav-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: none; } }
@media (max-width: 560px) { .nav-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- help (Service\Help): header button, side panel, help page */
.help-btn { order: 99; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.1); color: #fff !important; text-decoration: none; font-size: 13px; white-space: nowrap; }
.help-btn > span:first-child { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #111; font-weight: 800; font-size: 13px; }
.help-btn:hover { background: rgba(255,255,255,.18); }
.help-btn:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
@media (max-width: 760px) { .help-btn { padding: 4px; } .help-btn-l { display: none; } }
.help-panel { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(16, 24, 32, .14); outline: none; }
.help-panel > header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.help-panel > header h2 { margin: 0; font-size: 15px; flex: 1; display: flex; align-items: center; gap: 8px; }
.help-panel > header h2 span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; }
.help-close { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.help-close:hover { background: #eef1f4; color: var(--ink); }
.help-panel .help-body { overflow-y: auto; padding: 4px 18px 24px; }
.help-body h3 { font-size: 17px; margin: 14px 0 6px; } .help-body h4 { font-size: 13.5px; margin: 16px 0 4px; color: var(--brand-dark); }
.help-body p, .help-body li { font-size: 14px; line-height: 1.55; } .help-body ul, .help-body ol { padding-left: 20px; margin: 6px 0; }
.help-body li { margin: 3px 0; } .help-body li::marker { color: var(--muted); }
.help-more { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.help-page { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .help-page { grid-template-columns: 1fr; } .help-index ul { max-height: 220px; overflow-y: auto; } }
.help-index input { width: 100%; margin-bottom: 8px; }
.help-index ul { list-style: none; margin: 0; padding: 0; } .help-index li a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.help-index li a:hover { background: #f1f4f6; } .help-index li a[aria-current] { background: var(--tint); color: var(--brand-dark); font-weight: 600; }
.help-article { max-width: 760px; } .help-article h2 { margin-top: 0; }
a.seg-link { padding: 5px 12px; font-size: 13px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); } a.seg-link:last-child { border-right: 0; }
a.seg-link.on { background: var(--brand); color: #fff; }
@media print { .help-btn, .help-panel { display: none !important; } }
.start-page { display: grid; gap: 3px; font-weight: 600; font-size: 13px; max-width: 320px; margin-top: 10px; }
.appt-wrap { position: relative; height: 100%; }
.appt-chart { position: absolute; top: 4px; right: 6px; z-index: 2; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,.85); color: var(--brand-dark); box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.appt-chart svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.appt-chart:hover { background: var(--brand); color: #fff; }
.appt-chart:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.appt-wrap .appt { padding-right: 30px; }

/* ---- schedule month view */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.m-wd { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 4px; }
.m-day { display: flex; flex-direction: column; gap: 1px; min-height: 92px; padding: 7px 9px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.m-day:hover { border-color: #b7c2cc; box-shadow: 0 2px 8px rgba(20, 30, 40, .06); }
.m-day:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.m-day.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--tint); }
.m-day.past { background: #fafbfc; } .m-day.past b { color: #5b6470; }
.m-day.closed { background: repeating-linear-gradient(135deg, #f6f7f9 0 6px, #eff1f4 6px 12px); }
.m-num { font-size: 12.5px; font-weight: 650; color: var(--muted); } .m-day.today .m-num { color: var(--brand-dark); }
.m-day b { font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.m-l, .m-free, .m-closed { font-size: 11.5px; color: var(--muted); } .m-closed { font-style: italic; }
.m-bar { display: block; height: 4px; margin: 5px 0 3px; border-radius: 999px; background: #edf0f3; overflow: hidden; }
.m-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.m-un { font-size: 11.5px; color: #8a5a00; font-weight: 600; }
.m-pad { min-height: 0; }
@media (max-width: 640px) { .month { gap: 3px; } .m-day { min-height: 58px; padding: 4px 5px; } .m-l, .m-un, .m-free, .m-closed { display: none; } .m-day b { font-size: 15px; } }
.m-bar .f0 { width: 0%; }
.m-bar .f1 { width: 10%; }
.m-bar .f2 { width: 20%; }
.m-bar .f3 { width: 30%; }
.m-bar .f4 { width: 40%; }
.m-bar .f5 { width: 50%; }
.m-bar .f6 { width: 60%; }
.m-bar .f7 { width: 70%; }
.m-bar .f8 { width: 80%; }
.m-bar .f9 { width: 90%; }
.m-bar .f10 { width: 100%; }
/* referred out: violet, on the tooth drawing and in the legend */
:root { --refer: #6250d6; }
.teeth .s.referred, .teeth .crown.referred { fill: #c5bdf3; } .teeth .ring.referred, .teeth .canal.referred { stroke: var(--refer); }
.teeth .implant.referred { fill: #c5bdf3; stroke: var(--refer); } .teeth .tooth-line.outline.referred { stroke: var(--refer); }
.legend .referred { background: #c5bdf3; }
details.refer-out { display: inline-block; } details.refer-out summary { list-style: none; } details.refer-out summary::-webkit-details-marker { display: none; }
.refer-form { display: flex; gap: 4px; margin: 4px 0; } .refer-form input { width: 180px; padding: 3px 6px; font-size: 12.5px; }

/* ---- progress notes timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 70px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-day { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 22px; margin-bottom: 12px; position: relative; }
.tl-day::before { content: ""; position: absolute; left: 65px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand); }
.tl-date { text-align: right; padding-top: 4px; } .tl-date b { display: block; font-size: 14px; } .tl-date span { font-size: 11.5px; color: var(--muted); }
.tl-body { margin: 0; padding: 10px 14px; display: grid; gap: 8px; }
.tl-procs { width: 100%; border-collapse: collapse; font-size: 13.5px; } .tl-procs td { padding: 4px 6px 4px 0; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
.tl-procs tr:last-child td { border-bottom: 0; }
.tl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--done); }
.st-existing .tl-dot { background: var(--exist); } .st-referred .tl-dot { background: var(--refer); }
.st-referred .tl-st { background: #ecebfb; color: #4f44b8; } .st-completed .tl-st { background: #e7f0fb; color: #1f62b3; }
.tl-perio { margin: 0; font-size: 13.5px; }
.tl-note { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; } .tl-note.addendum { border-left-color: #e0a100; margin-left: 14px; }
.tl-text { font-size: 14px; line-height: 1.5; margin-top: 2px; }
@media (max-width: 600px) { .timeline::before, .tl-day::before { display: none; } .tl-day { grid-template-columns: 1fr; gap: 4px; } .tl-date { text-align: left; } }
.help-btn.solo { margin-left: auto; }
.capture-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.capture-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.capture-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
/* ---- perio chart on paper */
.perio-paper .perio-sum th { text-align: left; font-weight: 600; background: #f6f8fa; width: 22%; } .perio-paper .perio-sum td { width: 28%; }
.perio-print-chart { margin: 12px 0; } .perio-print-chart .perio-chart { min-width: 0; }
.perio-data { font-size: 11.5px; } .perio-data td, .perio-data th { text-align: center; padding: 3px 4px; white-space: nowrap; }
.perio-paper .sig { margin-top: 26px; }
@media print { .perio-paper .perio-data { font-size: 9.5px; } .perio-print-chart svg { page-break-inside: avoid; } }
.disc-form select { padding: 2px 4px; font-size: 12.5px; max-width: 150px; }
.plan-disc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hub-find { position: relative; display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; max-width: 640px; }
.hub-find svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.hub-find input { flex: 1; padding: 10px 12px 10px 38px; font-size: 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.hub-find input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.hub-find [data-hub-count] { white-space: nowrap; }
.attach-form { margin-top: 10px; align-items: end; }
.inline-label { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; } .inline-label select { max-width: 260px; }
.texting-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-left: 4px solid var(--brand); }
.texting-status.attn { border-left-color: var(--warn); } .texting-status span { flex: 1; color: var(--muted); }
.text-msg { margin-top: 10px; padding: 8px 10px; border-radius: 10px 10px 10px 2px; background: #eef6f5; } .text-msg p { margin: 2px 0 0; }
.text-msg.st-failed { background: #fdecea; }
.perio-chart .pc-cal-ok { fill: none; stroke: rgba(29, 122, 70, .85); stroke-width: 1.6; stroke-linecap: round; }
.pc-key .k-cal-ok { border-color: rgba(29, 122, 70, .85); margin-right: 0; width: 10px; } .pc-key .k-cal-ok + .k-cal { margin-left: 2px; width: 10px; }
/* perio voice entry */
.perio th.rowh .mic { margin-left: 6px; width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--brand-dark); cursor: pointer; vertical-align: middle; display: inline-grid; place-items: center; }
.perio th.rowh .mic svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.perio th.rowh .mic:hover { border-color: var(--brand); }
.perio th.rowh .mic.on { background: #c62828; border-color: #c62828; color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
.perio th.rowh .mic:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, .45); } 50% { box-shadow: 0 0 0 6px rgba(198, 40, 40, 0); } }
@media (prefers-reduced-motion: reduce) { .perio th.rowh .mic.on { animation: none; } }
.voice-status { margin: 4px 0 0; font-size: 13px; color: #8a1f1f; }
.voice-bubble { position: fixed; z-index: 70; max-width: 320px; padding: 8px 11px; border-radius: 9px; background: #1c1f24; color: #fff; font-size: 12.5px; line-height: 1.45; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
/* ---- tooth chart views */
.chart-views { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.chart-views .cv { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 13px; }
.chart-views .cv:hover { border-color: #b7c2cc; }
.chart-views .cv.on { border-color: var(--brand); background: var(--tint); color: var(--brand-dark); font-weight: 600; }
.chart-views .cv i { width: 10px; height: 10px; border-radius: 3px; background: #cfd5dc; }
.chart-views .cv-existing i { background: #a5d6a7; } .chart-views .cv-conditions i { background: #ffcc80; } .chart-views .cv-plan i { background: #ef9a9a; }
.chart-views .cv-progress i { background: #90caf9; } .chart-views .cv-referred i { background: #c5bdf3; } .chart-views .cv-all i { background: linear-gradient(135deg, #ef9a9a 0 33%, #90caf9 33% 66%, #a5d6a7 66%); }
.chart-views .cv-n { min-width: 18px; padding: 0 6px; border-radius: 999px; background: #eef1f4; font-size: 11.5px; text-align: center; color: var(--muted); }
.chart-views .cv.on .cv-n { background: #fff; }
.cv-hint { margin: 0 0 8px; }
/* ---- tooth chart: several teeth, popup */
.tooth-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: #1c1f24; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.tooth-bar .btn:not(.primary) { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.tooth-bar .muted { color: #b9c0c9; }
.chart-dlg { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.chart-dlg::backdrop { background: rgba(20, 24, 30, .45); }
.chart-dlg .dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; }
.chart-dlg .dlg-head h2 { margin: 0; font-size: 16px; flex: 1; }
.chart-dlg form { padding: 14px 18px 18px; }
.chart-dlg .dlg-x { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
/* ---- charting popup: status tabs, favourites / categories / search, tiles */
.chart-dlg { width: min(860px, calc(100vw - 32px)); margin: 6vh auto auto; }   /* top-anchored: no jumping while filtering */
.chart-dlg .dlg-teeth { color: var(--muted); font-weight: 500; }
.chart-dlg form.picker { padding: 0 0 16px; }
.st-tabs { display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.st-tabs .st { position: relative; cursor: pointer; }
.st-tabs .st input { position: absolute; opacity: 0; pointer-events: none; }
.st-tabs .st span { display: block; padding: 10px 16px 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 3px solid transparent; }
.st-tabs .st:hover span { color: var(--ink); }
.st-tabs .st input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -4px; }
.st-tabs .st-planned input:checked + span { color: var(--plan); border-color: var(--plan); }
.st-tabs .st-completed input:checked + span { color: var(--done); border-color: var(--done); }
.st-tabs .st-existing input:checked + span { color: var(--exist); border-color: var(--exist); }
.st-tabs .st-referred input:checked + span { color: var(--refer); border-color: var(--refer); }
.picker .pick-body, .picker .pick-details { padding: 14px 18px 0; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pick-search { flex: 1; min-width: 200px; }
.pick-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pick-cats button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font: 12.5px var(--font); color: var(--ink); cursor: pointer; }
.pick-cats button .ic { width: 18px; height: 18px; }
.pick-cats button[aria-pressed="true"] { background: var(--tint); border-color: var(--brand); color: var(--brand-dark); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; height: min(52vh, 460px); align-content: start; overflow-y: auto; padding: 2px; }
.ptile { position: relative; }
.ptile[hidden] { display: none; }
.ptile-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; height: 100%; min-height: 108px; padding: 12px 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font: 12.5px/1.25 var(--font); color: var(--ink); text-align: center; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.ptile-pick:hover, .ptile-pick:focus-visible { border-color: var(--brand); box-shadow: 0 2px 10px rgba(15,118,110,.15); outline: none; }
.ptile-pick b { font-weight: 600; }
.ptile-meta { color: var(--muted); font-size: 11.5px; }
.ptile-code { font-weight: 600; color: var(--brand-dark); }
.ptile-star { position: absolute; top: 4px; right: 4px; border: 0; background: none; font-size: 15px; line-height: 1; padding: 4px; color: #cfd5dc; cursor: pointer; border-radius: 6px; }
.ptile-star:hover { color: #e0a800; }
.ptile-star[aria-pressed="true"] { color: #f5b301; }
.ic { width: 34px; height: 34px; flex: none; }
.ic .ic-tooth { fill: #fff; stroke: #8a94a3; stroke-width: 1.2; stroke-linejoin: round; }
.ic .ic-tooth.faded { opacity: .45; }
.ic .ic-tooth.thick { stroke: #e08a00; stroke-width: 2; }
.ic .ic-mark { fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic .ic-fill { fill: var(--brand); stroke: none; }
.picker[data-status="planned"] .ic .ic-mark { stroke: var(--plan); } .picker[data-status="planned"] .ic .ic-fill { fill: var(--plan); }
.picker[data-status="completed"] .ic .ic-mark { stroke: var(--done); } .picker[data-status="completed"] .ic .ic-fill { fill: var(--done); }
.picker[data-status="existing"] .ic .ic-mark { stroke: var(--exist); } .picker[data-status="existing"] .ic .ic-fill { fill: var(--exist); }
.picker[data-status="referred"] .ic .ic-mark { stroke: var(--refer); } .picker[data-status="referred"] .ic .ic-fill { fill: var(--refer); }
.pick-empty { margin: 14px 0 4px; }
.pick-details { display: grid; gap: 12px; }
.pick-details[hidden], .pick-body[hidden], .picker [data-st][hidden], .picker [data-need-surfaces][hidden] { display: none; }
.pick-chosen { display: flex; align-items: center; gap: 12px; }
.pick-chosen .ptile-pick { flex-direction: row; min-height: 0; width: auto; padding: 8px 14px; gap: 10px; cursor: default; text-align: left; }
.pick-chosen .ptile-pick:hover { box-shadow: none; border-color: var(--line); }
@media (max-width: 600px) { .pick-grid { grid-template-columns: repeat(2, 1fr); } .st-tabs { padding: 0 8px; overflow-x: auto; } .st-tabs .st span { padding: 10px 10px 9px; } }
.pick-details > label { display: grid; gap: 4px; }
.picker .field-error { color: var(--bad); margin: 6px 0 0; }
/* ---- patient alerts pop-up */
.alert-box.office { background: #fff6e5; border-color: #f3d39b; color: #7a4a00; }
.alerts-btn { color: var(--bad); border-color: #f0b4b0; }
.pt-alerts { width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 6px solid var(--bad); }
.pt-alerts::backdrop { background: rgba(20, 24, 30, .45); }
.pt-alerts .dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pt-alerts .dlg-head h2 { margin: 0; font-size: 16px; flex: 1; color: var(--bad); }
.pt-alerts .dlg-x { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.pa-body { padding: 6px 18px 4px; }
.pa-body h3 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pa-body ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.pa-med li { padding: 8px 12px; border-radius: 8px; background: #fdecea; color: #7f1d17; }
.pa-office p { margin: 0; padding: 8px 12px; border-radius: 8px; background: #fff6e5; color: #7a4a00; }
.pa-actions { padding: 14px 18px 16px; margin: 0; }
/* side boxes on the patient record (alerts kept at the side, open lab cases): one column on the right;
   – docks a box as a tab on the edge, a click on the tab opens it again (public/assets/app.js) */
.side-stack { position: fixed; right: var(--side-bar, 0px); top: 190px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  max-height: calc(100vh - 200px); pointer-events: none; }
.side-box { pointer-events: auto; margin-right: 16px; width: 280px; max-height: 100%; overflow-y: auto; background: var(--card); border: 2px solid var(--bad); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); flex: 0 1 auto; min-height: 60px; }
.side-box[hidden] { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 12px; background: var(--bad); color: #fff; font-size: 13px; }
.side-head .dlg-x { border: 0; background: none; color: #fff; font-size: 20px; line-height: 1; padding: 2px 7px; cursor: pointer; border-radius: 6px; }
.side-head .dlg-x:hover, .side-head .dlg-x:focus-visible { background: rgba(255,255,255,.2); outline: none; }
.side-box.min { flex: none; min-height: 0; margin-right: 0; width: auto; max-height: none; overflow: visible; border-radius: 10px 0 0 10px; border-right: 0; cursor: pointer; }
.side-box.min .side-body, .side-box.min .side-head span { display: none; }
.side-box.min .side-head { padding: 8px 12px; border-radius: 8px 0 0 8px; white-space: nowrap; }   /* horizontal: vertical text sizes differently per browser */
.side-box.min:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pa-side, .lab-side.attn { animation: pa-blink 1.4s ease-in-out infinite; }
.pa-side:not(.min):hover, .side-box:focus-within, .lab-side.attn:not(.min):hover { animation: none; }
.pa-side .pa-body { padding: 2px 10px 10px; font-size: 13px; }
.pa-side .pa-body h3 { margin-top: 8px; }
.pa-side .pa-med li, .pa-side .pa-office p { padding: 6px 9px; }
@keyframes pa-blink { 50% { border-color: #f6b4ae; box-shadow: 0 10px 30px rgba(179,38,30,.35); } }
.lab-side { border-color: var(--refer); }
.lab-side .side-head { background: var(--refer); }
.lab-side.attn { animation-name: lab-blink; }
@keyframes lab-blink { 50% { border-color: #c5bdf3; box-shadow: 0 10px 30px rgba(98,80,214,.35); } }
.lab-list { list-style: none; margin: 0; padding: 4px 10px 10px; font-size: 13px; display: grid; gap: 6px; }
.lab-list li { padding: 7px 9px; border-radius: 8px; background: #f3f1fd; }
.lab-list .lab-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.lab-list .lab-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.lab-list li.lab-go { background: none; padding: 2px 4px 0; font-size: 12.5px; }
@media (max-width: 600px) { .side-stack { top: auto; bottom: 76px; } .side-box:not(.min) { width: min(280px, calc(100vw - 40px)); max-height: 40vh; } }
@media (prefers-reduced-motion: reduce) { .pa-side, .lab-side.attn { animation: none; } }
@media print { .side-stack, .pt-alerts { display: none; } }

.pill.lab-sent { background: #ecebfb; color: #4f44b8; } .pill.lab-received { background: #e6f4ea; color: #1d7a46; }
.pill.lab-seated { background: #eef1f4; color: var(--muted); } .pill.lab-cancelled { background: #eef1f4; color: var(--muted); text-decoration: line-through; }

/* ---- online booking: public page, staff requests */
.book { max-width: 760px; margin: 0 auto; }
.book-head h1 small { display: block; margin: 4px 0 0; }
.book-head p { margin: 6px 0 14px; }
.book .card { margin-bottom: 14px; }
.book-week { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.book-week h2 { margin: 0; }
.book-day h3 { margin: 16px 0 8px; }
.book-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.book-slots .slot { display: inline-block; min-width: 86px; text-align: center; padding: 9px 12px; border: 1px solid var(--brand); border-radius: 8px; color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.book-slots .slot:hover, .book-slots .slot:focus-visible { background: var(--brand); color: #fff; outline: none; }
.book-sum { background: var(--tint); padding: 10px 12px; border-radius: 8px; }
.book-new { border: 0; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; } .book-new legend { font-weight: 600; margin-bottom: 4px; }
.book-done h2 { color: var(--ok); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }   /* trap field for bots */
.or-banner { display: block; text-decoration: none; }
.or-card .or-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.or-card h2 { margin: 0 0 4px; } .or-card p { margin: 2px 0; }
.or-when { font-size: 15px; }
.or-note { background: #f6f7f9; padding: 6px 9px; border-radius: 6px; }
.or-done { opacity: .75; }
.or-acts { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.or-confirm { flex: 1; min-width: 280px; display: grid; gap: 10px; }
.or-confirm fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; } .or-confirm legend { font-weight: 600; margin-bottom: 4px; }
.or-chair { max-width: 320px; }
.pill.or-pending { background: #fff4e0; color: #9a5b00; } .pill.or-confirmed { background: #e6f4ea; color: #1d7a46; } .pill.or-declined { background: #eef1f4; color: var(--muted); }

/* ---- progress notes: filter panel + one sortable list */
.pn { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: start; }
.pn-filters { background: #eef1f5; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: sticky; top: 8px; }
.pn-filters h3 { margin: 0 0 8px; font-size: 16px; }
.pn-filters fieldset { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.pn-filters legend { font-weight: 600; margin-bottom: 4px; }
.pn-filters .check { display: flex; align-items: center; gap: 6px; }
.pn-filters .pn-all { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.pn-tooth select { padding: 2px 6px; margin-left: 4px; min-width: 64px; }
.pn-sw { width: 14px; height: 14px; border-radius: 3px; margin-left: auto; border: 1px solid rgba(0,0,0,.1); }
.pn-existing { --c: #a5d6a7; } .pn-completed { --c: #90caf9; } .pn-planned { --c: #ef9a9a; } .pn-referred { --c: #c5bdf3; }
.pn-condition { --c: #ffcc80; } .pn-note { --c: #e3e6ea; } .pn-perio { --c: #b2dfdb; }
.pn-sw, .pill.pn-st { background: var(--c); }
.pill.pn-st { color: var(--ink); }
.pn-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 10px; }
.pn-sort button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; font: 12.5px var(--font); color: var(--ink); cursor: pointer; }
.pn-sort button[aria-sort] { background: var(--tint); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.pn-sort button[aria-sort="ascending"]::after { content: ' ▲'; } .pn-sort button[aria-sort="descending"]::after { content: ' ▼'; }
.pn-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
.pn-table td { padding: 5px 6px 5px 0; border-bottom: 1px solid #f0f2f5; vertical-align: top; overflow-wrap: anywhere; }
.pn-table tr:last-of-type td { border-bottom: 0; }
.pn-table .c-th { width: 42px; } .pn-table .c-surf { width: 52px; } .pn-table .c-code { width: 62px; } .pn-table .c-st { width: 96px; } .pn-table .c-prov { width: 120px; } .pn-table .c-amt { width: 80px; }
.pn-day[hidden] { display: none; }
.pn-row[hidden] { display: none; }
@media (max-width: 900px) { .pn { grid-template-columns: 1fr; } .pn-filters { position: static; } .pn-filters fieldset { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }

/* ---- on the patient's phone: QR panel (staff), phone pages (patient) */
.qr-panel { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; border: 2px solid var(--brand); }
.qr-code { background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--line); line-height: 0; }
.qr-code.used { opacity: .15; }
.qr-info { flex: 1; min-width: 240px; } .qr-info h2 { margin-top: 0; } .qr-info ol { padding-left: 18px; margin: 6px 0; }
.pill.mlink-open { background: #fff4e0; color: #9a5b00; } .pill.mlink-done { background: #e6f4ea; color: #1d7a46; }
.pill.mlink-expired, .pill.mlink-cancelled, .pill.mlink-locked { background: #eef1f4; color: var(--muted); }
.form-sig img { border-bottom: 1px solid var(--ink); max-width: 100%; height: auto; }
.mob { max-width: 560px; margin: 0 auto; }
.mob h1 { font-size: 20px; margin: 0 0 6px; }
.mob input, .mob textarea, .mob select { font-size: 16px; }
.mob-msg { text-align: center; padding: 28px 18px; } .mob-done h1 { color: var(--ok); }
.mob-send { width: 100%; padding: 12px; font-size: 16px; }
.sig-pad { width: 100%; height: 180px; border: 2px dashed #9aa3b2; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.sig-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.mob-pick { display: block; position: relative; text-align: center; padding: 14px; font-size: 16px; }
.mob-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mob-pick.has { border-color: var(--ok); color: var(--ok); }
.mob-alt { font-size: 14px; padding: 10px; }

/* ---- treatment consent: the plan on the form */
.form-plan { margin: 10px 0 16px; overflow-x: auto; }
.form-plan table { font-size: 13.5px; } .form-plan tfoot th { border-top: 2px solid var(--ink); }
.mob .form-plan table { font-size: 13px; } .mob .form-plan td, .mob .form-plan th { padding: 6px 5px; }

/* ---- forms due */
.forms-due { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; background: #fff4e0; color: #9a5b00; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.forms-due-card { border-left: 4px solid var(--warn); }
.forms-due-card .fd-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.forms-due-card .fd-row > div { flex: 1; min-width: 200px; }

/* ---- emailed links: test-mode preview */
.mail-preview { margin: 8px 0; padding: 10px 12px; border: 1px dashed var(--warn); border-radius: 8px; background: #fffaf0; }
.mail-preview pre { white-space: pre-wrap; font: 13px/1.45 var(--font); margin: 6px 0 10px; background: #fff; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); }
