/* The design values live in tokens.css (loaded first by index.html; imported here too for the pages that link only this
   file, such as the recovery sheet, lib/recovery-sheet.mjs). This file holds the chrome, the shared parts and settings. */
@import url("tokens.css");
html { font-family: var(--font); color: var(--ink); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: var(--fs-15); line-height: 1.45; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- App chrome: the top bar (brand, patient search, the name) ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--sp-4);
  min-height: var(--topbar-h); padding: var(--sp-2) 20px; background: var(--accent); color: var(--accent-ink);
}
.topbar .brand { color: var(--accent-ink); font-weight: 600; text-decoration: none; font-size: var(--fs-17); flex: none; }

main { padding: var(--sp-6) 20px 60px; }
.narrow { max-width: 760px; margin: 0 auto; }
/* The title row (.page-head, portal.css): the page's name 22 px, its context in a .sub, at most one primary action. */
h1.page { font-size: var(--fs-22); margin: 0 0 var(--sp-4); font-weight: 600; }
h1.page .sub, h1.page .hint { font-size: var(--fs-15); font-weight: 400; }
.crumbs { font-size: var(--fs-15); color: var(--muted); margin-bottom: var(--sp-2); }
.crumbs a { text-decoration: none; }

/* A card: one spec for .card, .panel and .option-card (portal.css sets .card's and .option-card's padding; a .panel's
   pages pad inside it, so it keeps none of its own). */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-card); }
.search-row { display: flex; gap: var(--sp-2); }
.search-row input { flex: 1; }
/* Form fields: 40 px tall (44 on a touch screen, mobile.css), from the tokens. */
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=url], input[type=password], input[type=date], input[type=search], select, textarea {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: var(--sp-2) 10px; background: var(--card); width: 100%;
}
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=url], input[type=password], input[type=date], input[type=search], select { min-height: var(--control-h); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }

/* Buttons (one rule each): primary, the filled accent, at most one per view; .secondary, an outline; .quiet, text only;
   .danger, red words (filled red only in a confirm window, portal.css .modal.dialog). 40 px tall, .small 32 px; 44 and
   36 on a touch screen (mobile.css). No green button. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-h); padding: 0 var(--sp-4); border: 1px solid var(--accent); border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 600; line-height: 1.25; white-space: nowrap;
  text-decoration: none; vertical-align: middle;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.secondary { background: var(--card); color: var(--accent); border-color: var(--line-strong); }
.btn.secondary:hover:not(:disabled) { filter: none; border-color: var(--accent); background: var(--accent-soft); }
.btn.quiet { background: transparent; color: var(--accent); border-color: transparent; }
.btn.quiet:hover:not(:disabled) { filter: none; background: var(--accent-soft); }
.btn.danger { background: var(--card); color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover:not(:disabled) { filter: none; background: var(--bad-soft); }
.btn:disabled { opacity: .55; cursor: default; }
/* A part that sets its own display still hides when the page says hidden (Save changes on a task you can't edit,
   Show more with nothing more). */
.btn[hidden], .seg a[hidden], .seg button[hidden], .chip[hidden] { display: none; }
.hint { color: var(--muted); font-size: var(--fs-13); }
.error { color: var(--bad-ink); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); padding: 10px var(--sp-3); border-radius: var(--r-sm); }
/* An empty state: one sentence and, where it helps, one button. No emoji. */
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* ---------- The navigation (UI release 1 B2; public/nav.mjs draws it) ----------
   1200 px and up: the rail, 200 px, each page's icon and name under its group's heading, Collapse at its foot
   (body.nav-narrow, remembered on the device, makes it the narrow rail). 900 to 1199 px: the narrow rail, 76 px, each
   icon over its short name. Under 900 px (mobile.css): no rail; the bottom bar, and More's sheet. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { display: block; flex: none; width: 20px; height: 20px; }
.shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--topbar-h)); }
.shell > main { flex: 1 1 auto; min-width: 0; max-width: calc(var(--content-max) + 40px); margin: 0 auto; }
#main-nav { flex: none; width: var(--rail-w); background: var(--card); border-right: 1px solid var(--line); }
/* The rail's inside stays in sight as the page scrolls; Collapse sits at its foot. */
.rail-in { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; min-height: calc(100vh - var(--topbar-h)); max-height: 100vh; overflow-y: auto; padding: var(--sp-3) var(--sp-2); }
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: var(--sp-3); }
.nav-group[hidden] { display: none; }
.nav-head { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
#main-nav a { position: relative; display: flex; align-items: center; gap: 10px; min-height: var(--control-h); padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
#main-nav a[hidden] { display: none; }
#main-nav a:hover { background: var(--bg); }
#main-nav a .ic { color: var(--muted); }
#main-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#main-nav a.active .ic { color: var(--accent); }
.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-short { display: none; }
#main-nav .preview-tag { flex: none; margin: 0; font-size: var(--fs-11); padding: 0 4px; line-height: 1.4; }
#main-nav a.att-dot::after { margin-left: 0; }
.nav-sheet-head, .nav-you { display: none; }
.nav-collapse { display: flex; align-items: center; gap: 10px; margin-top: auto; min-height: 36px; padding: var(--sp-2) var(--sp-3) 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer; }
.nav-collapse:hover { color: var(--ink); }
.nav-collapse .ic { width: 18px; height: 18px; transition: transform .15s; }
#bottom-nav, .nav-scrim { display: none; }
@media (min-width: 1200px) { body:not(.nav-narrow) .topbar .brand { width: calc(var(--rail-w) - 20px); } }
@media (max-width: 1199px) { .nav-collapse { display: none; } }

/* The narrow rail: from 900 to 1199 px, and from 1200 px up once collapsed. (The same rules twice: CSS has no way to say
   "either" across a media query and a class.) */
@media (min-width: 900px) and (max-width: 1199px) {
  #main-nav { width: var(--rail-narrow); }
  .rail-in { padding: var(--sp-2) var(--sp-1); }
  .nav-group + .nav-group { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--line); }
  .nav-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; }
  #main-nav a { flex-direction: column; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; text-align: center; }
  #main-nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #main-nav .nav-short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-11); font-weight: 600; line-height: 1.2; }
  #main-nav .nav-badge { position: absolute; top: 3px; left: calc(50% + 3px); }
  #main-nav a.att-dot::after { position: absolute; top: 5px; left: calc(50% - 15px); margin: 0; }
}
@media (min-width: 1200px) {
  body.nav-narrow #main-nav { width: var(--rail-narrow); }
  body.nav-narrow .rail-in { padding: var(--sp-2) var(--sp-1); }
  body.nav-narrow .nav-group + .nav-group { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--line); }
  body.nav-narrow .nav-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; }
  body.nav-narrow #main-nav a { flex-direction: column; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; text-align: center; }
  body.nav-narrow #main-nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.nav-narrow #main-nav .nav-short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-11); font-weight: 600; line-height: 1.2; }
  body.nav-narrow #main-nav .nav-badge { position: absolute; top: 3px; left: calc(50% + 3px); }
  body.nav-narrow #main-nav a.att-dot::after { position: absolute; top: 5px; left: calc(50% - 15px); margin: 0; }
  body.nav-narrow .nav-collapse { justify-content: center; padding: var(--sp-2) 0 0; }
  body.nav-narrow .nav-collapse .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.nav-narrow .nav-collapse .ic { transform: rotate(180deg); }
}

.list { list-style: none; margin: 12px 0 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; text-decoration: none; color: var(--ink);
}
.list a:hover { background: var(--accent-soft); }
.list .main { font-weight: 600; }
.list .sub { color: var(--muted); font-size: var(--fs-13); }
.list .amt { font-variant-numeric: tabular-nums; text-align: right; }

.plan-pick-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 8px 0 10px; flex-wrap: wrap; }
.plan-pick-head input { max-width: 260px; }
h2.step { font-size: var(--fs-17); margin: 0; font-weight: 600; }
.plan-table { width: 100%; border-collapse: collapse; }
.plan-table th { text-align: left; font-size: var(--fs-13); color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); }
.plan-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.plan-table tbody tr { cursor: pointer; }
.plan-table tbody tr:hover { background: var(--accent-soft); }
.plan-table tbody tr:last-child td { border-bottom: 0; }
.plan-table .r { text-align: right; }
.plan-table .main { font-weight: 600; }
.nowrap { white-space: nowrap; }
.btn.small { min-height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-13); }
@media (pointer: coarse) { .btn { min-height: var(--touch-h); } .btn.small { min-height: var(--touch-h-sm); } }
#plan-select { font-size: var(--fs-13); }

/* ---------- Plan preview layout ---------- */
.preview-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; max-width: 1200px; margin: 0 auto; }
.controls { position: sticky; top: 16px; padding: 16px; }
.controls h2 { font-size: var(--fs-13); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.controls h2:first-of-type { margin-top: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.check input { margin-top: 3px; }
.check .why { display: block; color: var(--faint); font-size: var(--fs-12); }
.controls .btn { width: 100%; margin-top: 16px; padding: 10px; }
.paper-wrap { overflow-x: auto; }
@media (max-width: 900px) {
  .preview-layout { grid-template-columns: 1fr; }
  .controls { position: static; }
}

/* ---------- The printed treatment plan ---------- */
.paper {
  width: 8.5in; min-height: 11in; margin: 0 auto; padding: 0.5in;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  font-size: 10.5pt; line-height: 1.4; color: #2b2f33;
}
/* 0.23: the office's colors (Settings → Practice), set on the paper by public/app.js (office-look.mjs staffLookStyle):
   --office-text for headings, --office-accent for the rules under them. Unset: the greys below, as before. */
.tp-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.4in; }
.tp-brand { text-align: center; max-width: 3.4in; }
.tp-brand img { max-width: 3.2in; max-height: 1.6in; display: block; margin: 0 auto 4px; }
.tp-brand .contact { color: #666; font-size: 9.5pt; }
.tp-brand .placeholder { border: 1px dashed var(--line-strong); color: var(--faint); padding: 28px 24px; font-size: 9pt; }
.tp-benefits { flex: 0 1 3.6in; font-size: 8.5pt; }
.tp-benefits .label { color: #777; margin-bottom: 4px; font-size: 9pt; }
.tp-benefits table { width: 100%; border-collapse: collapse; }
.tp-benefits th { font-weight: 600; padding: 6px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tp-benefits td { padding: 6px 4px; text-align: center; }
.tp-benefits td:first-child, .tp-benefits th:first-child { text-align: left; }

.tp-title { text-align: center; font-size: 19pt; font-weight: 700; margin: 0.3in 0 2px; color: var(--office-text, #33373c); }
.tp-sub { text-align: center; color: #777; margin: 0 0 0.2in; font-size: 9.5pt; }

.tp-procs { width: 100%; border-collapse: collapse; }
.tp-procs thead th { color: #999; font-weight: 600; font-size: 9pt; padding: 7px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); text-align: left; }
.tp-procs td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tp-procs .tooth { width: 0.9in; white-space: nowrap; }
.tp-procs .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; width: 0.95in; }
.tp-procs .code { color: #777; margin-right: 6px; }
.tp-procs tr { break-inside: avoid; }
.tp-group { font-weight: 600; font-size: 10pt; margin: 0.18in 0 4px; color: var(--office-text, #444); break-after: avoid; }
.tp-group-sub td { font-weight: 600; background: #fafafa; }

.tp-totals { width: 100%; border-collapse: collapse; margin-top: 0.25in; break-inside: avoid; }
.tp-totals td { padding: 7px 10px; border-top: 1px solid var(--line); font-weight: 600; }
.tp-totals td:last-child { text-align: right; width: 1.4in; font-variant-numeric: tabular-nums; }
.tp-totals tr.patient td { font-size: 11.5pt; color: #222; border-top: 2px solid var(--line-strong); }

.tp-options { margin-top: 0.3in; break-inside: avoid; }
.tp-options h2 { text-align: center; font-weight: 400; font-size: 14pt; color: var(--office-text, #555); margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--office-accent, var(--line)); }
.tp-option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(1.55in, 1fr)); gap: 0.15in; padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.tp-option { text-align: center; display: flex; flex-direction: column; align-items: center; break-inside: avoid; }
.tp-option .t { font-weight: 700; font-size: 10.5pt; color: var(--office-text, inherit); }
.tp-option .d { color: #555; font-size: 9.5pt; min-height: 2.6em; margin: 2px 0 8px; }
.tp-option .amt { font-weight: 700; font-size: 10.5pt; line-height: 1.3; }
/* To-do list 2026-10-20: Pay in advance's saving in dollars, under its amount. */
.tp-option .save { font-size: 9.5pt; margin-top: 2px; }
.tp-option .qr { width: 0.95in; height: 0.95in; margin-top: 2px; }
.tp-option .qr svg, .tp-option .qr img { width: 100%; height: 100%; display: block; }
.tp-option .box { margin-top: auto; padding-top: 10px; font-size: 9pt; color: #555; display: flex; align-items: center; gap: 5px; }
.tp-option .box::before { content: ""; width: 12px; height: 12px; border: 1.5px solid #777; border-radius: 2px; display: inline-block; }

.tp-note { margin-top: 0.25in; break-inside: avoid; }
.tp-note h3 { font-weight: 400; font-size: 12.5pt; color: var(--office-text, #444); margin: 0 0 6px; }
.tp-note p { margin: 0; white-space: pre-line; font-size: 9.5pt; }

.tp-signature { margin-top: 0.3in; break-inside: avoid; }
.tp-signature .who { margin: 0 0 0.35in; }
.sig-lines { display: grid; grid-template-columns: 1fr 1.6in; gap: 0.35in; }
.sig-lines div { border-top: 1px solid #555; padding-top: 4px; font-size: 8.5pt; color: #555; }

.tp-disclaimer { margin-top: 0.25in; padding-top: 6px; border-top: 1px solid var(--line); font-size: 7.5pt; color: #555; text-align: center; break-inside: avoid; }

@page { size: letter; margin: 0.5in 0.5in 0.55in; @bottom-center { content: "Page " counter(page) " of " counter(pages); font-size: 8pt; color: #888; } }
@media print {
  body { background: #fff; }
  main { padding: 0; }
  .no-print, .controls, .crumbs { display: none !important; }
  .preview-layout { display: block; }
  .paper { width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none; }
  .tp-procs thead { display: table-header-group; }
}

/* ---------- Settings (UI release 2, docs/ui-release-2-brief.md A1-A5) ----------
   A page: the settings menu on the left (from 900 px), then the page (its title, tabs and cards, the save bar under
   them), then the section index on the right (from 1200 px; narrower, a chip row under the title). Under 900 px there
   is no menu: #/settings is the home page and each page has "‹ Settings" above its title. */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--sp-6); max-width: var(--content-max); margin: 0 auto; align-items: start; }
.settings-layout.with-index { grid-template-columns: 200px minmax(0, 1fr) 176px; }
.settings-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); border-left: 3px solid transparent; }
.settings-nav a.active { background: var(--card); border-left-color: var(--accent); font-weight: 600; }
.settings-nav .settings-all { color: var(--muted); font-size: var(--fs-13); }
.settings-nav .set-find { margin-bottom: var(--sp-2); }
.settings-main { min-width: 0; display: grid; gap: var(--sp-3); align-content: start; }
.settings-main > .page-head { margin: 0; }
.settings-back { display: none; font-size: var(--fs-15); text-decoration: none; }
.settings-body { min-width: 0; }
/* Each section a card: the field pages' cards (.option-card), and a module's own sections (.settings-section) unless
   they hold cards of their own or sit inside another. */
.settings-body .settings-section:not(.settings-section .settings-section):not(:has(.option-card)):not(.office-page) {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-card); padding: 4px var(--sp-4) var(--sp-3); margin: 0 0 14px;
}
.settings-body .settings-section:not(.settings-section .settings-section):has(.option-card) { padding: 0; }
.settings-body > .option-card:first-child, .settings-body #fields > .option-card:first-child { margin-top: 0; }
.settings-body :is(h2, h3) .card-summary { margin-left: var(--sp-2); font-size: var(--fs-13); font-weight: 400; color: var(--muted); }
.option-card .card-desc { margin: 2px 0 4px; color: var(--muted); font-size: var(--fs-13); }
.option-card > .more-settings { margin-top: 4px; }
/* The section index: a column on the right, the card in view marked. */
.settings-index { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; padding-left: var(--sp-3); border-left: 1px solid var(--line); font-size: var(--fs-13); }
.settings-index a { padding: 4px 8px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.settings-index a:hover { color: var(--ink); }
.settings-index a.on { color: var(--ink); font-weight: 600; background: var(--card); }
.settings-index[hidden], .settings-chips[hidden] { display: none; }
.settings-chips { display: none; }
/* The save bar (public/savebar.mjs): at the foot of the page while something is changed. A part's own Save goes; its
   own error line stays, shown only while it says something. */
.savebar.page-savebar { z-index: 6; justify-content: flex-start; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: 10px var(--sp-4); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sheet); }
.page-savebar[hidden] { display: none; }
.page-savebar .spacer { flex: 1; }
.page-savebar .sb-err { flex-basis: 100%; order: 5; color: var(--bad-ink); font-size: var(--fs-13); }
.page-savebar .sb-err[hidden] { display: none; }
.page-savebar.saved { box-shadow: var(--shadow-card); }
.has-savebar .savebar:not(.page-savebar) > .btn { display: none; }
.has-savebar .savebar:not(.page-savebar):not(:has(.error:not(:empty))) { display: none; }
.has-savebar .savebar:not(.page-savebar) { position: static; border: 0; background: none; padding: 8px 0; }
/* Find a setting: the box and its list of matches. A match chosen is highlighted for two seconds. */
.set-find { position: relative; }
.set-find input { min-height: 36px; }
.set-find-list { position: absolute; z-index: 30; left: 0; top: 100%; width: max(100%, 320px); max-width: calc(100vw - 32px); max-height: 360px; overflow: auto; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sheet); }
.set-find-list[hidden] { display: none; }
.set-find-list li { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; overflow-wrap: anywhere; }
.set-find-list li.on, .set-find-list li:hover { background: var(--accent-soft); }
.set-find-list li .sub { color: var(--muted); font-size: var(--fs-13); }
.set-find-list .set-find-none { color: var(--muted); cursor: default; }
.find-hit { outline: 2px solid var(--warn); outline-offset: 2px; background: var(--warn-soft); border-radius: var(--r-sm); transition: background .3s; }
/* The home page: Find a setting, then the cards in two groups. */
.settings-home { max-width: 1060px; margin: 0 auto; display: grid; gap: var(--sp-4); }
.settings-home > .page-head { margin: 0; }
.settings-home .set-find { max-width: 520px; }
.set-group h2 { margin: var(--sp-2) 0; font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.set-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--sp-3); }
.set-card { display: grid; gap: 4px; align-content: start; color: var(--ink); text-decoration: none; }
.set-card:hover { border-color: var(--accent); }
.set-card-name { font-size: var(--fs-17); font-weight: 600; }
.set-card-desc { color: var(--muted); font-size: var(--fs-13); }
.set-card-line { min-height: 1.3em; font-size: var(--fs-13); font-weight: 600; color: var(--neutral-ink); }
/* R2: a feature that runs with less, because the practice management system can't do something it wants */
.set-card-limited { font-size: var(--fs-13); color: var(--warn-ink); }
/* R2: a permission group's name in Settings → People ("Chart") */
.access-matrix tr.perm-group th { text-align: left; padding-top: 12px; font-weight: 600; }
.own-perms h3.perm-group { margin: 12px 0 4px; font-size: var(--fs-15, 15px); }
@media (max-width: 1199px) {
  .settings-layout.with-index { grid-template-columns: 180px minmax(0, 1fr); }
  .settings-layout:not(.with-index) { grid-template-columns: 180px minmax(0, 1fr); }
  .settings-index { display: none !important; }
  .settings-chips:not([hidden]) { display: flex; gap: 6px; overflow-x: auto; position: sticky; top: 0; z-index: 5; margin: 0 -4px; padding: 6px 4px; background: var(--bg); scrollbar-width: thin; }
  .settings-chips a { flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--card); color: var(--ink); font-size: var(--fs-13); font-weight: 600; text-decoration: none; white-space: nowrap; }
  .settings-chips a.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }
}
@media (max-width: 899px) {
  .settings-layout, .settings-layout.with-index, .settings-layout:not(.with-index) { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
  .settings-back { display: inline-block; }
}
/* UI patch P1.2/P1.3: nothing inside a settings page widens it. The page's panel and each field's two halves may
   shrink inside their grids, so a wide table scrolls inside its own box (.table-scroll) and long words wrap, instead
   of the whole page running off the right edge. */
.settings-layout > .panel { min-width: 0; }
.field > * { min-width: 0; }
.settings-section { padding: 4px 20px; }
.settings-section h2 { font-size: var(--fs-17); margin: 16px 0 4px; }
.field { display: grid; grid-template-columns: 1fr minmax(220px, 380px); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.field:last-child { border-bottom: 0; }
.field.wide { grid-template-columns: 1fr; }
.field .lbl { font-weight: 600; font-size: var(--fs-15); }
.field .help { color: var(--muted); font-size: var(--fs-13); }
.field .ctl { justify-self: stretch; }
.field .ctl.toggle { justify-self: end; }
.field.disabled { opacity: .5; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd4da; border-radius: 24px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pct { display: flex; align-items: center; gap: 6px; }
.pct input { max-width: 120px; }
.provider { border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; margin: 14px 0; }
.provider-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; }
.provider-head strong { font-size: var(--fs-15); }
.qr-preview { width: 96px; height: 96px; }
.qr-preview svg { width: 100%; height: 100%; }
.header-preview { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.header-preview img { max-height: 90px; max-width: 260px; border: 1px solid var(--line); padding: 6px; background: #fff; }
/* Settings → Practice (0.23): Office colors' pickers and the preview of a button, a heading and an email's header.
   The preview's own colors are the office's, set inline by public/practice-settings.mjs; the frame stays light, as
   patient pages do. */
.look-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.look-pick input[type=color] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); cursor: pointer; }
.look-pick input[type=color]:disabled { opacity: .45; cursor: default; }
.look-pick input[type=text] { width: 7.5em; font-family: ui-monospace, Consolas, monospace; }
.look-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); color: var(--ink); max-width: 420px; width: 100%; }
.look-band { padding: 8px 12px; font-weight: 700; }
.look-body { padding: 12px; }
.look-heading { margin: 0 0 4px; font-size: var(--fs-17); font-weight: 700; }
.look-text { margin: 0 0 10px; font-size: var(--fs-15); }
.look-btn { display: inline-block; padding: 8px 16px; border: 2px solid; border-radius: 8px; font-weight: 600; }
.look-btn.small { padding: 6px 12px; font-size: var(--fs-13); }
.look-email { border-top: 1px dashed var(--line); padding: 10px 12px 12px; }
.look-email .sub { margin: 0 0 4px; font-size: var(--fs-12); }
.look-email-name { margin: 0 0 10px; padding-bottom: 6px; font-weight: 700; }
.contact-now { margin: 0 0 6px; }
.savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
.savebar input { max-width: 140px; }
.status-ok { color: var(--ok); font-size: var(--fs-15); }
@media (max-width: 800px) {
  .field { grid-template-columns: 1fr; }
  .field .ctl.toggle { justify-self: start; }
}

/* A page with parts of its own (the Library, Compliance: UI release 1 B3): the parts as a view switcher across the top,
   the page the full width under it, so no page has menus on two edges. */
.tabbed-page { display: grid; gap: var(--sp-3); max-width: 1060px; margin: 0 auto; }
.tabbed-page > * { min-width: 0; }
.page-tabs .sub { font-size: var(--fs-13); }

/* Stage 5 beta 3: the Library (public/library.mjs). */
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lib-head h2 { margin: 0; }
.lib-search { display: flex; gap: 8px; align-items: center; margin: 12px 0 4px; }
.lib-search input { flex: 1; min-width: 0; }
.lib-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-list { list-style: none; margin: 8px 0 0; padding: 0; }
.lib-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line, #e3e6ea); }
.lib-row:first-child { border-top: 0; }
.lib-pick, .lib-pick-none { flex: none; width: 18px; margin-top: 3px; }
.lib-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lib-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.lib-snip { font-style: italic; }
.lib-group { margin: 16px 0 0; font-size: var(--fs-15); }
.lib-picked[hidden] { display: none; }
.lib-picked { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; margin-top: 12px; background: var(--card, #fff); border: 1px solid var(--line, #e3e6ea); border-radius: 8px; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.lib-viewer iframe { width: 100%; height: 70vh; border: 0; }
.lib-viewer, .lib-viewer-head > div { min-width: 0; overflow-wrap: anywhere; }
.lib-viewer img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
@media (max-width: 640px) {
  .lib-row { flex-wrap: wrap; }
  .lib-acts { width: 100%; justify-content: flex-start; padding-left: 28px; }
}

/* Stage 5 beta 3: setup sheets (public/setups.mjs) and the schedule's Setup tag. */
.setup-tag { text-decoration: none; cursor: pointer; }
.vb-setup { display: inline-block; font-size: var(--fs-11); font-weight: 700; padding: 0 4px; margin-right: 3px; border-radius: 4px; background: #dbe8fb; color: #1f4f8f; vertical-align: 1px; }
.sched-setups { margin: 6px 0; }
/* Treatment presentation Stage 5: the huddle badge (a plan not yet accepted) beside the Setup tag, its amount inside a
   visual block, and the day's total under the header. */
.plan-tag { text-decoration: none; cursor: pointer; white-space: nowrap; }
.vb-plan { display: inline-block; font-size: var(--fs-11); font-weight: 700; padding: 0 4px; margin-right: 3px; border-radius: 4px; background: #fdf0d5; color: #8a5a00; vertical-align: 1px; cursor: pointer; }
.sched-plans { margin: 6px 0; font-weight: 600; }
.su-back { margin: 0 0 8px; }
.su-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
.su-facts dt { font-size: var(--fs-12); color: var(--muted, #667); }
.su-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.su-alerts { border: 2px solid #c0392b; background: #fdecea; color: #7b1d14; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.su-alerts ul { margin: 6px 0 0; padding-left: 20px; }
.su-noalerts { margin: 10px 0; }
.su-sheet h2 { margin-top: 0; }
.su-text .su-tick { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.su-text .su-tick input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.su-text li.deep { margin-left: 18px; }
.su-call { background: #fff6e5; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.su-pic img { max-width: 100%; height: auto; }
.su-ops { display: grid; gap: 12px; }
.su-list { list-style: none; margin: 0; padding: 0; }
.su-list li { padding: 8px 0; border-top: 1px solid var(--line, #e3e6ea); }
.su-list li:first-child { border-top: 0; }
.su-list li.done { opacity: .6; }
.su-alert-line { color: #a8261a; font-weight: 600; font-size: var(--fs-13); margin-top: 2px; }

/* A save refused for one field (lib/field-error.mjs): the sentence under it, the field marked. */
.field-error { margin: 6px 0 0; padding: 6px 10px; font-size: var(--fs-13); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
/* A settings page while it loads: its menu stays, the panel shows grey lines. */
.settings-skeleton .sk-line { height: 14px; margin: 14px 0; border-radius: 6px; background: var(--line, #e3e6ea); opacity: .7; }
.settings-skeleton .sk-line.short { width: 40%; }

/* ---------- Compliance (0.21.0, public/compliance.mjs and public/compliance-*.mjs) ----------
   Status chips: current neutral green, due amber, overdue and failed red, Doesn't apply grey; the People grid (a date
   when current, amber when due, red when overdue or failed); the log form's big Pass / Fail. (The banner under the top
   bar and the red count beside Compliance gave way to the attention dots, portal.css .att-dot, 2026-10-20.) */
.comp-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: var(--fs-13); font-weight: 600; line-height: 1.5;
  white-space: nowrap; border: 1px solid transparent; text-decoration: none; vertical-align: baseline; }
.comp-current { background: #e7f4ec; border-color: #bfe0cb; color: var(--ok); }
.comp-due { background: #fff4d6; border-color: #f2d27a; color: #7a5600; }
.comp-overdue, .comp-failed { background: #fdecea; border-color: #f0b7b0; color: var(--danger); }
.comp-failed { font-weight: 700; }
.comp-na { background: #f1f2f4; border-color: var(--line); color: var(--muted); }
.comp-role { background: var(--accent-soft); border-color: #d3dceb; color: var(--accent); font-weight: 500; }
a.comp-chip:hover { filter: brightness(.96); text-decoration: underline; }
.comp-page .comp-main { display: grid; gap: 16px; min-width: 0; }
/* Spacing (to-do list, 2026-10-20): each part sits in a panel padded like a settings page (.settings-section), its
   heading spaced like one, and the cards, tables and forms inside it spaced apart instead of touching. */
.comp-main > .panel { min-width: 0; padding: 4px 20px 18px; }
.comp-main > .panel > .page-head { margin: 16px 0 6px; flex-wrap: wrap; }
.comp-main .page-head h2 { font-size: var(--fs-17); margin: 0; }
.comp-main > .panel > .sub, .comp-main > .panel > p.sub { margin: 0 0 12px; }
.comp-main > .panel > .card, .comp-main > .panel > section.card { margin: 14px 0 0; }
.comp-main .card > .sub { margin: 0 0 10px; }
.comp-main .card > table.data { margin-top: 4px; }
.comp-main > .panel > table.data, .comp-main > .panel > .comp-grid-wrap { margin: 8px 0 4px; }
.comp-main > .panel > .empty { padding: 24px 0; }
.comp-main .comp-sub-head:first-child { margin-top: 12px; }
/* Requirements (public/compliance-kinds.mjs): the Edit toggle beside Add requirement, a row's actions on one line with
   the trash icon last, a turned-off row greyed, Show deleted under the list. */
.ck-tools { display: flex; flex-wrap: wrap; gap: 8px; }
#ck-editing[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ck-table td.ck-acts { white-space: nowrap; }
.ck-table td.ck-acts .btn { margin: 2px 0 2px 4px; }
.ck-del { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.ck-del svg { display: block; }
.ck-table tr.ck-off td:not(.ck-acts):not(.c) { color: var(--muted); }
.ck-source { margin-top: 2px; }
.ck-deleted-link { margin: 14px 0 0; font-size: var(--fs-15); }
.ck-deleted-link .link { color: var(--accent); }
.comp-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.comp-back { margin: 0 0 8px; font-size: var(--fs-15); }
.comp-sub-head { margin: 18px 0 8px; font-size: var(--fs-17); }
.comp-coming td.card-action { white-space: nowrap; }
.comp-roles, .comp-permits { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 8px; }
.comp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 8px 0; }
.comp-facts dt { font-size: var(--fs-12); color: var(--muted); }
.comp-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.comp-log { list-style: none; margin: 8px 0; padding: 0; }
.comp-log li { padding: 6px 0; border-top: 1px solid var(--line); }
.comp-log li:first-child { border-top: 0; }
.comp-link, .comp-leave { margin: 8px 0; }
/* The People grid: the names stay put while the credentials scroll sideways inside their own box. */
.comp-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.comp-grid-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.comp-grid { width: auto; min-width: 100%; }
table.comp-grid th, table.comp-grid td { white-space: nowrap; text-align: center; }
table.comp-grid thead th { white-space: normal; min-width: 96px; max-width: 140px; vertical-align: bottom; }
table.comp-grid .comp-grid-name { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; min-width: 150px; max-width: 220px;
  white-space: normal; box-shadow: 1px 0 0 var(--line); }
table.comp-grid thead .comp-grid-name { background: #f9fafb; }
table.comp-grid .comp-cell-none .sub { color: var(--faint); }
/* The log form: Pass and Fail big enough to hit on an iPad held in one hand. */
.comp-log-form [data-result] { flex: 1; min-height: 64px; font-size: 1.25em; font-weight: 600; }
.comp-log-form [data-result="pass"][aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.comp-log-form [data-result="fail"][aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.comp-log-form #cl-save { width: 100%; min-height: 56px; font-size: 1.15em; }
.comp-logged { padding: 16px; border-radius: 8px; border: 1px solid var(--line); }
.comp-logged h3 { margin: 0 0 6px; }
.comp-logged-pass { background: #e7f4ec; border-color: #bfe0cb; }
.comp-logged-fail { background: #fdecea; border-color: #f0b7b0; }
.comp-logged-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.comp-settings select, .comp-settings input[type=number] { max-width: 320px; }
.comp-warn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 16px; }
.comp-warn-grid input { width: 100%; max-width: 120px; }
.comp-settings-acts { margin-top: 12px; }
/* Compliance beta 2: the emergency kit (public/compliance-kit.mjs), its monthly check, the drills
   (public/compliance-drills.mjs) and the Library's SOP rows. */
.comp-kit-table td.card-action { white-space: nowrap; }
.comp-kit-table td.card-action .btn { margin: 2px 0 2px 4px; }
.comp-kit-warn-amber { color: #8a5a00; background: #fff6dc; border-radius: 4px; padding: 0 4px; font-weight: 600; }
.comp-kit-warn-red { color: var(--danger); background: #fdecea; border-radius: 4px; padding: 0 4px; font-weight: 700; }
p.comp-kit-restock { padding: 8px 10px; margin: 8px 0; }
.comp-kit-history li { font-size: var(--fs-15); }
.comp-kit-warn-days input[type=number] { width: 72px; display: inline-block; margin: 0 4px; }
.comp-walk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.comp-walk-row:first-child { border-top: 0; }
.comp-walk-qty { grid-column: 1 / -1; }
.comp-walk-qty input { max-width: 120px; }
.comp-walk-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.comp-walk-choices [data-choice] { min-height: 48px; min-width: 76px; font-weight: 600; }
.comp-walk-choices [data-choice="ok"][aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.comp-drill-form { display: grid; gap: 8px; }
.comp-drill-form .tk-grid input { width: 100%; }
.comp-drill-list td.card-action { white-space: nowrap; }
.comp-drill-people { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 8px; }
.comp-drill-people label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.lib-sop-meta { font-size: var(--fs-13); color: var(--muted); }
/* Compliance beta 3: trainings (public/compliance-trainings.mjs), their progress on Coming up, the training due date and
   the Monday summary in Settings, a training on a person's page, I've read this in the Library, the publish dialog's
   re-ask choice. */
.comp-progress { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 4px; }
.comp-progress li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.comp-train-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.comp-train { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.comp-train-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.comp-train-people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.comp-train-people li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.comp-train-people li .btn { margin-left: auto; }
.comp-inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.comp-train-due input[type=number] { width: 72px; }
.comp-train-due .flbl { display: block; margin-bottom: 6px; }
.comp-train-due select { width: auto; }
.cp-train-head { margin: 8px 0 0; }
.lib-row.lib-must-read .lib-read-ask { color: #8a5a00; font-weight: 600; }
.fe-reask { margin-top: 8px; }
/* An error box with nothing in it takes no room (Upload new and other dialogs showed an empty pink box). */
.error:empty { display: none; }
/* Compliance beta 3: the Inspection binder (public/compliance-binder.mjs): the date range, the size line, Build binder. */
.comp-binder { display: grid; gap: 10px; }
.comp-binder-range { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; }
.comp-binder-range label { display: grid; gap: 4px; font-size: var(--fs-13); color: var(--muted); }
.comp-binder-range input[type=date] { min-width: 160px; }
.comp-binder-size { margin: 0; font-weight: 600; }
.comp-binder-size.error { color: var(--danger); }
.comp-binder-acts { display: flex; gap: 8px; }

/* Treatment presentation Stage 2: Print's Include pictures (off by default; without it the paper is as before). The
   pictures shown in the plan's latest presentation, two across, never split over a page. */
.tp-pictures { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.tp-picture { margin:0; break-inside:avoid; }
.tp-picture img { width:100%; max-height:3.2in; object-fit:contain; }
.tp-picture figcaption { font-size: 9pt; color: #555; margin-top: 3px; }

/* Card payments (0.24, release 1). Colors come from the tokens on :root (and their tints through color-mix), so a theme
   that redefines the tokens carries them; nothing here is a fixed light-only background except the white inputs the
   rest of the app uses. Classes:
   - Take payment (public/payments-take.mjs): .pay-dialog (a dialog's body), .pay-wait and .pay-countdown (the 90 s
     wait), .pay-result (.ok approved, .bad declined or not completed), .pay-remainder (a partial approval's rest owed).
   - The patient page's Account card (public/patient.mjs): .pt-account and its .pt-account-figures.
   - Present mode's Pay now (public/present-view.mjs): .pm-pay and its .pm-pay-amount; release 2 .pm-pay-method (how
     the patient pays) and .pm-pay-frame (the new card's Collect frame).
   - The Payments page (public/payments-page.mjs): .pay-list, .pay-state, .pay-od; Settings → Payments
     (public/payments-settings.mjs): .pay-conn and .pay-terminals. */
.pay-dialog { display: grid; gap: 10px; }
.pay-dialog .lbl { display: block; font-weight: 600; font-size: var(--fs-13); margin: 4px 0 -4px; }
.pay-dialog .money-in input { max-width: 12rem; }
.pay-picked { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); }
.pay-wait { display: grid; justify-items: center; gap: 6px; padding: 16px 12px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--card); }
.pay-wait p { margin: 0; }
.pay-countdown { font-size: 2.2em; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent); }
.pay-result { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: 8px; background: var(--card); overflow-wrap: anywhere; }
.pay-result p { margin: 0; }
.pay-result-head { font-size: 1.1em; }
.pay-result.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 7%, var(--card)); }
.pay-result.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--card)); }
.pay-remainder { margin: 4px 0 0; padding: 6px 10px; border-radius: 6px; font-weight: 600; color: var(--ink); background: color-mix(in srgb, var(--att-amber) 22%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 60%, var(--line)); }

.pt-account { display: grid; gap: 10px; }
.pt-account-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 8px 14px; margin: 0; }
.pt-account-figures > div { min-width: 0; }
.pt-account-figures dt, .pt-account-figures .lbl { font-size: var(--fs-12); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pt-account-figures dd, .pt-account-figures .val { margin: 0; font-size: var(--fs-17); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.pm .pm-pay { display: grid; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-width: 0; }
.pm .pm-pay h3 { margin: 0; font-size: 1em; }
.pm .pm-pay .pm-pay-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-13); color: var(--muted); }
.pm .pm-pay .pay-wait, .pm .pm-pay .pay-result { font-size: var(--fs-15); }
.pm .pm-pay .pm-pay-amount { font-size: var(--fs-22); font-weight: 700; font-variant-numeric: tabular-nums; max-width: 12rem; }
/* Release 2: how the patient pays (On the terminal, Card on file, New card), and the new card's Collect frame host,
   which public/present.mjs keeps in place across the drawer's redraws (the frame sets its own height). */
.pm .pm-pay .pm-pay-method { gap: 2px; }
.pm .pm-pay .pm-pay-frame { min-width: 0; min-height: 120px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; overflow: hidden; }
.pm .pm-pay .pm-pay-frame iframe { display: block; width: 100%; border: 0; }
.pm .pm-pay .pm-pay-frame .card-step-policy { margin: 0 0 8px; font-size: var(--fs-13); color: var(--muted); }

/* The Payments page */
.pay-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.pay-head h1.page { margin-bottom: 4px; }
.pay-pull { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pay-page > .hint { margin: 0 0 12px; }
.pay-history { margin: 10px 0 0; }
.pay-more { text-align: center; }
.pay-list td { vertical-align: top; }
.pay-list td.r { white-space: nowrap; }
.pay-actions { text-align: right; min-width: 8rem; }
.pay-actions .btn { margin: 2px 0 2px 4px; }
.pay-state { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--ink); background: var(--bg); }
.pay-state.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.pay-state.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--card)); }
.pay-state.wait { border-color: color-mix(in srgb, var(--att-amber) 70%, var(--line)); background: color-mix(in srgb, var(--att-amber) 20%, var(--card)); }
.pay-state.off { color: var(--muted); }
.pay-od { font-size: var(--fs-13); overflow-wrap: anywhere; }
.pay-od.in { color: var(--ok); }
.pay-od.out { color: var(--danger); font-weight: 600; }
.pay-od.likely { color: var(--ink); }
.pay-od.none { color: var(--muted); }
.pay-od-error { display: block; margin-top: 2px; font-size: var(--fs-12); color: var(--muted); }

/* Settings → Payments */
.pay-conn h3 { font-size: var(--fs-15); margin: 14px 0 6px; }
.pay-conn-state { margin: 6px 0; font-weight: 600; }
.pay-conn-state.ok { color: var(--ok); }
.pay-conn-state.bad { color: var(--danger); }
.pay-conn-state.off { color: var(--muted); }
.pay-conn-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 8px 0; font-size: var(--fs-15); }
.pay-conn-facts dt { color: var(--muted); }
.pay-conn-facts dd { margin: 0; overflow-wrap: anywhere; }
.pay-terminals { max-width: 640px; }
.pay-settings .notice { background: color-mix(in srgb, var(--att-amber) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 55%, var(--line)); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.pay-settings textarea { min-height: 70px; }
.pay-settings #ps-days { max-width: 8rem; }

/* Card payments release 2.
   - The patient page's Cards card (public/payments-cards.mjs): .pt-cards, each card or hold a .pt-card-row with its
     .pt-card-main line and .pt-card-acts buttons; .pt-account-acts holds the Account card's two buttons.
   - Its windows: .pay-agreement (the card agreement's words), .pay-frame (the card step's host: full width, at least
     260 px tall until the frame says its own height), .pay-policy (the hold policy as the office wrote it).
   - .hold-badge: "Card held" on an appointment (the patient page here; Today, the schedule and the patient window may
     use it too), with a small card glyph drawn in currentColor. Its tints come from currentColor, so it reads on light
     and dark surfaces alike; [data-theme="dark"] (none yet in the app) gets a lighter ink.
   - .pay-noshows: the Payments page's No-shows table (public/payments-page.mjs). */
.pt-account .card-head, .pt-cards .card-head { flex-wrap: wrap; gap: 6px 10px; }
.pt-account-acts { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pt-cards { display: grid; gap: 10px; }
.pt-cards .card-head .btn { flex: none; }
.pt-cards .hint, .pt-cards .empty { margin: 0; }
.pt-cards-sub { margin: 4px 0 0; font-size: var(--fs-12); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pt-card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pt-card-row { display: grid; gap: 4px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow-wrap: anywhere; }
.pt-card-row.expired { background: var(--bg); }
.pt-card-row.expired .pt-card-main strong { color: var(--muted); }
.pt-card-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.pt-card-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.pay-agreement { display: grid; gap: 4px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); }
.pay-agreement p { margin: 0; }
.pay-frame { width: 100%; min-width: 0; min-height: 260px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; overflow: hidden; }
.pay-frame iframe { display: block; width: 100%; border: 0; }
.pay-frame .card-step-policy { margin: 0 0 8px; font-size: var(--fs-13); color: var(--muted); }
.pay-policy { display: grid; gap: 4px; padding: 8px 12px; border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: 8px; background: var(--card); }
.pay-policy p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.pay-dialog fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.pay-dialog fieldset.field .check strong { font-variant-numeric: tabular-nums; }
.hold-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle;
  color: var(--accent); background: color-mix(in srgb, currentColor 10%, transparent); border: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.hold-badge::before { content: ''; flex: none; width: 13px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px;
  background: linear-gradient(currentColor, currentColor) 0 2px / 100% 1.5px no-repeat; }
:root[data-theme="dark"] .hold-badge { color: #a9c1e4; }
/* Online scheduling beta 2: the globe badge (booked online) and Follow-ups → Booked online. */
.bk-globe { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; line-height: 1.5; vertical-align: middle;
  color: #1f6f5c; background: color-mix(in srgb, currentColor 10%, transparent); border: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.bk-globe-review { color: var(--danger, #b42318); }
.bk-globe-i { width: 13px; height: 13px; flex: none; }
:root[data-theme="dark"] .bk-globe { color: #8fd3c0; }
.bk-list tr.bk-test td { opacity: .55; }
.bk-flags { margin: 4px 0 0; padding-left: 18px; font-size: var(--fs-13, 13px); }
.bk-flags li.bk-flag-bad { color: var(--danger, #b42318); font-weight: 600; }
.pay-noshows { width: 100%; }
.pay-noshows td { vertical-align: top; }
.pay-noshows td.r { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-noshows .pay-actions .btn { margin: 2px 0 2px 4px; }

@media (max-width: 640px) {
  .pt-account-acts { justify-content: flex-start; }
  .pt-card-row { padding: 8px; }
  .pt-card-acts .btn { flex: 1 1 auto; }
  .pay-frame { padding: 4px; }
  .hold-badge { white-space: normal; }
  .pay-noshows, .pay-noshows tbody, .pay-noshows tr, .pay-noshows td { display: block; width: 100%; }
  .pay-noshows thead { display: none; }
  .pay-noshows tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .pay-noshows td { padding: 2px 0; }
  .pay-noshows td.r { white-space: normal; text-align: left; }
  .pay-noshows .pay-actions { text-align: left; }
  .pay-noshows .pay-actions .btn { margin: 4px 4px 0 0; }
}

@media (max-width: 640px) {
  .pay-head { align-items: flex-start; }
  .pay-pull { width: 100%; }
  .pay-pull .btn { flex: 1 1 auto; }
  .pay-actions { min-width: 0; }
  .pay-list tbody tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pay-countdown { font-size: 1.8em; }
  .pt-account-figures { grid-template-columns: 1fr 1fr; }
  .pm .pm-pay { padding: 10px; }
  .pm .pm-pay .pm-pay-frame { padding: 4px; }
  .pay-terminals { font-size: var(--fs-13); }
}
@media print { .pay-actions, .pay-pull, #pay-filters, .pay-more { display: none !important; } }

/* Card payments release 3: payment plans (public/payments-plans.mjs). Colors from the tokens and currentColor tints,
   as the payments classes above, so they read on light and dark surfaces alike.
   - .plan-mark: 'On a plan' beside a patient on Diastema's lists; .plan-mark.late 'Plan payment late'.
   - .plan-badge: the Today / Schedule badge 'N payment plans past due', a link to the Payment plans tab.
   - .plan-list: the Payment plans tab's table (a card per row at phone width) and the Account card's list; each plan a
     .plan-row that opens the plan window.
   - .plan-charges / .plan-charge: a plan's payments in the plan window, and New payment plan's schedule.
   - .plan-consent: the recurring-charge authorization (collapsible in the plan window).
   - .plan-dates: New payment plan's date pickers, one per payment. */
.plan-mark { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle;
  color: var(--accent); background: color-mix(in srgb, currentColor 10%, transparent); border: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.plan-mark.late { color: var(--danger); }
.plan-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-13); font-weight: 700; text-decoration: none; white-space: nowrap;
  color: var(--danger); background: color-mix(in srgb, currentColor 9%, transparent); border: 1px solid color-mix(in srgb, currentColor 45%, transparent); }
.plan-badge::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.plan-badge:hover, .plan-badge:focus-visible { background: color-mix(in srgb, currentColor 16%, transparent); }
:root[data-theme="dark"] .plan-mark { color: #a9c1e4; }
:root[data-theme="dark"] .plan-mark.late, :root[data-theme="dark"] .plan-badge { color: #f3a3a6; }
table.plan-list { width: 100%; }
table.plan-list td { vertical-align: top; overflow-wrap: anywhere; }
table.plan-list td.r { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.plan-list .plan-row { cursor: pointer; }
table.plan-list .plan-row:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.plan-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
ul.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.plan-list .plan-row { display: grid; gap: 4px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow-wrap: anywhere; cursor: pointer; }
ul.plan-list .plan-row:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.plan-charges { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plan-charge { display: grid; gap: 4px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow-wrap: anywhere; }
.plan-charge strong { font-variant-numeric: tabular-nums; }
.plan-charge > .pay-dialog { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.plan-charge > .pay-dialog p { margin: 0; }
#np-schedule .plan-charge { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 6px 10px; }
.plan-consent { display: grid; gap: 4px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--card); }
.plan-consent p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.plan-consent summary { cursor: pointer; font-weight: 600; }
.plan-consent[open] summary { margin-bottom: 4px; }
.plan-dates { list-style: none; margin: 6px 0 0; padding: 0; display: grid; align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: 8px 12px; }
.plan-dates li { display: grid; align-content: start; gap: 2px; min-width: 0; }
.plan-dates input { width: 100%; min-width: 0; box-sizing: border-box; }
.plan-dates .error:empty { display: none; }
.plan-dates input[aria-invalid="true"] { border-color: var(--danger); }

@media (max-width: 640px) {
  .plan-mark, .plan-badge { white-space: normal; }
  /* The table is a card per row through mobile.css's table.cards (the column names over each cell). */
  table.plan-list tbody td.r { white-space: normal; text-align: left; }
  .plan-charge { padding: 8px; }
  .plan-charge .pt-card-acts .btn { flex: 1 1 auto; }
  .plan-consent { padding: 8px 10px; }
}

/* Card payments release 3: Present mode's payment plan after signing (public/present-payplan.mjs), in the Staff drawer
   in place of Pay now on a 2- or 3-payment card. Colors from the tokens, as the payments classes above. Classes:
   - .pm-plan-setup: the section (Pay now's look); .pm-plan-closed its way back in after Take the down payment only.
   - .pm-plan-words: the plan in its own words; .pm-plan-dates: the dates and amounts (.pm-plan-today the down
     payment, .pm-plan-day / .pm-plan-amt each row's two sides); .pm-plan-picks / .pm-plan-pick: custom mode's date
     pickers, one per payment, with .pm-plan-date-err under the one that isn't allowed.
   - .pm-plan-consent: the recurring-charge authorization; .pm-plan-agree: the patient's I agree tick, sized for a
     finger; .pm-plan-method / .pm-plan-receipt: the card and receipt choices; .pm-plan-frame: the new card's Collect
     frame host (kept in place across redraws, as .pm-pay-frame); .pm-plan-go: Agree and pay; .pm-plan-note: the
     locked drawer's line. Nothing is wider than the drawer, so at 640 px nothing scrolls sideways. */
.pm .pm-plan-setup { display: grid; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-width: 0; overflow-wrap: anywhere; }
.pm .pm-plan-setup h3 { margin: 0; font-size: 1em; }
.pm .pm-plan-setup .pay-result { font-size: var(--fs-15); }
.pm .pm-plan-form { display: grid; gap: 12px; min-width: 0; }
.pm .pm-plan-words { margin: 0; font-size: var(--fs-17); line-height: 1.35; }
.pm .pm-plan-dates { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; min-width: 0; font-variant-numeric: tabular-nums; }
.pm .pm-plan-dates > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.pm .pm-plan-dates .pm-plan-amt { font-weight: 700; }
.pm .pm-plan-dates .pm-plan-today { background: var(--accent-soft); }
.pm .pm-plan-picks > li.pm-plan-pick { display: grid; justify-content: stretch; gap: 6px; }
.pm .pm-plan-pick label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-weight: 600; }
.pm .pm-plan-pick input[type="date"] { font: inherit; font-size: var(--fs-input); min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; width: 100%; min-width: 0; box-sizing: border-box; background: #fff; }
.pm .pm-plan-pick input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.pm .pm-plan-date-err { margin: 0; }
.pm .pm-plan-consent { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--card); font-size: var(--fs-15); line-height: 1.45; }
.pm .pm-plan-consent p { margin: 0; overflow-wrap: anywhere; }
.pm .pm-plan-agree { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 14px; border: 2px solid var(--accent); border-radius: 10px; background: var(--accent-soft); font-size: var(--fs-22); font-weight: 700; cursor: pointer; }
.pm .pm-plan-agree input { flex: none; width: 34px; height: 34px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pm .pm-plan-agree:has(input:checked) { background: color-mix(in srgb, var(--ok) 14%, var(--card)); border-color: var(--ok); }
.pm .pm-plan-method, .pm .pm-plan-receipt { gap: 2px; }
.pm .pm-plan-frame { min-width: 0; min-height: 120px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; overflow: hidden; }
.pm .pm-plan-frame iframe { display: block; width: 100%; border: 0; }
.pm .pm-plan-frame .card-step-policy { margin: 0 0 8px; font-size: var(--fs-13); color: var(--muted); }
.pm .pm-plan-go { font-size: var(--fs-17); }

@media (max-width: 640px) {
  .pm .pm-plan-setup { padding: 10px; }
  .pm .pm-plan-words { font-size: var(--fs-17); }
  .pm .pm-plan-frame { padding: 4px; }
  .pm .pm-plan-setup .pm-drawer-acts .btn { flex: 1 1 auto; }
  .pm .pm-plan-agree { font-size: var(--fs-17); }
}

/* Card payments release 4: statements (public/payments-statements.mjs: Send statement, the Statements and Patients
   with balances tabs, the statement window). Colors from the tokens and currentColor tints, as the payments classes
   above, so they read on light and dark surfaces alike; [data-theme="dark"] gets a lighter ink for the marks.
   - .st-ledger: the family's visits, one .st-group each (.on while ticked; .st-earlier-group the one Earlier line), its
     .st-group-head (.st-pick the tick box and .st-date, .st-left what is left of it), its .st-lines (.st-line: .st-who
     the family member, .st-what, .st-ins, .st-line-date, .st-amt; .st-credit a credit). .st-total: the ticked total.
   - .st-send: the Send statement window (.st-plan the plan notice, .st-plan-ask the question before sending anyway).
   - .st-list: the Statements tab's and the balances' tables (a card per row at phone width through table.cards),
     .st-row / .st-bal-row (.st-off a family that can't be sent one), .st-to / .st-mail, .st-tick, .st-marks / .st-mark
     (.warn No email), .st-link (the last statement, opening it), .st-filters / .st-claims, .st-bal-acts the two Send
     buttons. .st-batch: Send selected / Send all's window (.st-confirm the question, .st-progress the batch).
   - .st-view: the statement window (.st-facts, .st-sub, .st-events, .st-cancel); body.st-print prints the window
     alone and leaves out .st-no-print. .st-account-acts: Send statement on the Account card. */
.st-send, .st-view, .st-batch { min-width: 0; overflow-wrap: anywhere; }
.st-send > .notice, .st-view > .notice { background: color-mix(in srgb, var(--att-amber) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 55%, var(--line)); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.st-plan .plan-mark { margin-right: 6px; }
.st-ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.st-ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.st-group { min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.st-group.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.st-earlier-group { border-style: dashed; }
.st-group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; min-width: 0; }
.st-pick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; cursor: pointer; }
span.st-pick { cursor: default; }
.st-pick input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.st-left { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-credit { color: var(--ok); }
.st-earlier { margin: 2px 0 0 26px; }
.st-lines { list-style: none; margin: 4px 0 0; padding: 0 0 0 26px; display: grid; gap: 2px; min-width: 0; }
.st-line { display: grid; grid-template-columns: minmax(4rem, max-content) minmax(0, 1fr) auto auto; align-items: baseline; gap: 2px 10px; min-width: 0; font-size: var(--fs-13); }
.st-who { font-weight: 600; min-width: 0; }
.st-what { min-width: 0; overflow-wrap: anywhere; }
.st-ins { display: block; font-size: var(--fs-12); }
.st-line-date { white-space: nowrap; font-size: var(--fs-12); }
.st-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 10px 0; font-variant-numeric: tabular-nums; }
.st-total strong { font-size: 1.1em; }
.st-over { flex-basis: 100%; }
.st-plan-ask p { margin: 0 0 4px; }
table.st-list { width: 100%; }
table.st-list td { vertical-align: top; overflow-wrap: anywhere; }
table.st-list td.r { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.st-list .st-row { cursor: pointer; }
table.st-list .st-row:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.st-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-mail { font-size: var(--fs-13); }
table.st-list th.st-tick, table.st-list td.st-tick { width: 2rem; }
.st-tick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.st-bal-row.st-off td { color: var(--muted); }
table.st-balances td.st-marks { min-width: 8rem; }
.st-marks { display: flex; flex-wrap: wrap; gap: 4px; }
td.st-marks { display: table-cell; }
td.st-marks > * { margin: 0 4px 4px 0; }
.st-mark { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle;
  color: var(--muted); background: color-mix(in srgb, currentColor 8%, transparent); border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.st-mark.warn { color: var(--danger); }
:root[data-theme="dark"] .st-mark { color: #c4cad3; }
:root[data-theme="dark"] .st-mark.warn { color: #f3a3a6; }
:root[data-theme="dark"] .st-credit { color: #8fd3a8; }
.st-link { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.st-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 0 8px; }
.st-claims { display: inline-flex; align-items: center; gap: 6px; }
.st-bal-acts { display: flex; flex-wrap: wrap; gap: 6px; }
/* Patients with balances' sortable heads and Follow-up column (its filters are the shared filter bar) (stable touch-ups, 2026-11-07). */
.st-sort { padding: 0; border: 0; background: none; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-align: inherit; }
.st-sort:hover { color: var(--accent); }
.st-sort.on { color: var(--accent); }
.st-arrow { font-size: 0.75em; min-width: 0.8em; }
table.st-balances td.st-tasks { min-width: 9rem; }
.st-task { margin: 0 0 4px; font-size: var(--fs-13); }
.st-add-task { margin-top: 2px; }
.st-confirm { font-size: var(--fs-17); font-weight: 600; margin: 0 0 8px; }
.st-progress { width: 100%; height: 12px; accent-color: var(--accent); }
.st-progress-words { font-weight: 600; margin: 0 0 6px; }
.st-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 6px 16px; margin: 8px 0; }
.st-facts dt { font-size: var(--fs-12); color: var(--muted); }
.st-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.st-sub { font-size: var(--fs-15); margin: 14px 0 6px; }
.st-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-13); }
.st-cancel { margin-top: 10px; }
.st-account-acts { margin: 6px 0 4px; }

@media (max-width: 640px) {
  .st-line { grid-template-columns: minmax(0, 1fr) auto; }
  .st-line .st-what { grid-column: 1 / -1; grid-row: 2; }
  .st-line .st-line-date { display: none; }
  .st-lines, .st-earlier { padding-left: 0; margin-left: 0; }
  .st-group { padding: 6px 8px; }
  .st-mark { white-space: normal; }
  table.st-list tbody td.r { white-space: normal; text-align: left; }
  td.st-marks { display: block; }
  .st-bal-acts { width: 100%; }
  .st-bal-acts .btn, .st-account-acts .btn { flex: 1 1 auto; }
  .st-filters { gap: 6px 12px; }
}
@media print {
  body.st-print > :not(.modal-backdrop) { display: none !important; }
  body.st-print .modal-backdrop { position: static; background: none; padding: 0; }
  body.st-print .modal { box-shadow: none; max-width: none; width: auto; max-height: none; overflow: visible; }
  body.st-print .st-no-print, body.st-print .modal-foot { display: none !important; }
  .st-group { break-inside: avoid; }
}

/* Texting beta 1: the Texts page (public/texts.mjs), the patient page's Texts card and Settings → Texting
   (public/texts-settings.mjs). Colors from the tokens and color-mix, as the payments classes above.
   - .tx-layout: the two columns (.open while a thread is shown: on a phone the list makes way for it). .tx-side the
     left column (.tx-views the views, .tx-count their numbers, .tx-search, .tx-list of .tx-row buttons: .unread bold,
     .on the open one, .tx-dot Needs reply, .tx-chips family, .tx-flag, .tx-initials the assignee).
   - .tx-thread: the thread pane (.tx-head with .tx-who and .tx-acts, .tx-consent ok | bad, .tx-flagged, .tx-activity,
     .tx-msgs of .tx-msg in | out with .tx-bubble and .tx-tick wait | sent | ok | bad, .tx-note yellow, .tx-sys a line)
     and .tx-composer (.note while writing a note, .tx-lock, .tx-warn, .tx-tpl a quick reply's preview with .tx-field
     marks, .tx-counter). [data-narrow]: shown on a phone only. .tx-sr: read by screen readers, not shown.
   - .tx-card: the patient page's card (.tx-mini, the last texts). .tx-settings: Settings → Texting.
   - Beta 2: .tx-msg-act a message's Make a task, .tx-links Insert link's (and Text which plan's) choices, .tx-new
     New text, .tx-card-acts / .tx-card-comp the card's buttons and composer, .tx-edge-mode the line Diastema support
     set, .tx-auto-words an automatic reply's wording, .tx-tpl-* the templates editor.
   - .nav-badge.calm: the Texts tab's count while nothing assigned to me is unread (red otherwise). */
.tx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-badge.calm { background: var(--neutral-soft); color: var(--neutral-ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.texts-page .page-head { flex-wrap: wrap; }
.tx-page-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.tx-mode { font-size: var(--fs-13); font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.tx-mode:empty { display: none; }
.tx-mode.test { background: color-mix(in srgb, var(--att-amber) 22%, var(--card)); color: #5c4300; }
.tx-mode.off { background: color-mix(in srgb, var(--danger) 10%, var(--card)); color: var(--danger); }
.tx-mode.live { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.tx-sound { font-size: var(--fs-13); color: var(--muted); padding: 0; align-items: center; }
.tx-sound input { margin: 0; }
/* UI release 2 B2: the title row's small menu (this computer's sound), the views as the .seg, the off strip. */
.texts-page h1.page .tx-mode { vertical-align: middle; margin-left: var(--sp-2); }
.tx-gear { position: relative; }
.tx-gear > summary { list-style: none; min-width: var(--control-h); padding: 0 var(--sp-2); font-size: var(--fs-17); }
.tx-gear > summary::-webkit-details-marker { display: none; }
.tx-gear-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; width: max-content; max-width: min(320px, 80vw); padding: var(--sp-3);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: 0 10px 30px rgba(16, 24, 40, .16); }
.texts-page > .seg { margin-bottom: var(--sp-3); }
.tx-off-strip { margin: 0 0 var(--sp-3); padding: 10px var(--sp-4); border: 1px solid color-mix(in srgb, var(--info) 30%, var(--line)); border-radius: var(--r-sm); background: var(--info-soft); color: var(--info-ink); }
.tx-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; height: calc(100vh - 230px); min-height: 520px; }
.tx-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tx-views a:focus-visible, .tx-row:focus-visible, .tx-mode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tx-count { font-variant-numeric: tabular-nums; }
.tx-list-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-row { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.tx-row:hover { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.tx-row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tx-row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tx-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row.unread .tx-row-name, .tx-row.unread .tx-preview { font-weight: 700; color: var(--ink); }
.tx-row-time { flex: none; font-size: var(--fs-12); color: var(--muted); }
.tx-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #2f6fde; }
.tx-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tx-chip { font-size: var(--fs-12); padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tx-row-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tx-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-13); color: var(--muted); }
.tx-flag { flex: none; color: #c2410c; cursor: help; }
.tx-initials { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: var(--fs-11); font-weight: 700; }
.tx-more { text-align: center; margin: 10px 0; }
/* A short window: the pane scrolls as a whole rather than squeezing the messages. */
.tx-thread { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.tx-pick { margin: auto; max-width: 420px; }
.tx-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; padding: 12px 16px 6px; }
.tx-who { min-width: 0; }
.tx-who h2 { margin: 0 0 2px; font-size: var(--fs-17); overflow-wrap: anywhere; }
.tx-who h2 a { text-decoration: none; }
.tx-who h2 a:hover { text-decoration: underline; }
.tx-family { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.tx-family .pat-tag[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tx-facts { overflow-wrap: anywhere; }
.tx-consent.ok { color: var(--ok); font-weight: 600; }
.tx-consent.bad { color: var(--danger); font-weight: 600; }
.tx-acts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tx-acts [data-narrow] { display: none; }
#tx-t-head > p, .tx-thread .tx-activity { margin: 0 16px 6px; }
.tx-thread > .error { margin: 16px; }
.tx-linknote { font-size: var(--fs-13); color: var(--muted); }
.tx-flagged { font-size: var(--fs-13); padding: 4px 10px; border-radius: 6px; background: color-mix(in srgb, #c2410c 10%, var(--card)); color: #9a3412; }
.tx-activity summary { cursor: pointer; }
.tx-activity ol { margin: 4px 0 0; padding-left: 18px; }
.tx-msgs { flex: 1 0 auto; min-height: 220px; height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); background: var(--bg); }
.tx-msg { display: flex; flex-direction: column; max-width: min(78%, 560px); }
.tx-msg.in { align-self: flex-start; }
.tx-msg.out { align-self: flex-end; align-items: flex-end; }
.tx-meta { font-size: var(--fs-12); color: var(--muted); margin-bottom: 2px; }
.tx-from { font-weight: 600; color: var(--ink); }
.tx-bubble { padding: 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; }
.tx-msg.in .tx-bubble { border-bottom-left-radius: 4px; }
.tx-msg.out .tx-bubble { background: var(--accent); border-color: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.tx-words { white-space: pre-wrap; }
.tx-pic { display: block; margin-top: 6px; }
.tx-pic img { display: block; max-width: 240px; max-height: 240px; border-radius: 8px; }
.tx-pic-note { display: block; font-size: var(--fs-13); font-style: italic; margin-top: 4px; }
.tx-tick { font-size: var(--fs-12); margin-top: 2px; color: var(--muted); }
.tx-tick.ok { color: var(--ok); }
.tx-tick.bad { color: var(--danger); font-weight: 600; }
.tx-tick .btn { margin-left: 6px; }
.tx-comm { font-size: var(--fs-12); color: var(--danger); margin-top: 2px; }
.tx-sys { align-self: center; font-size: var(--fs-13); color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: 999px; padding: 3px 12px; text-align: center; }
.tx-note { align-self: stretch; padding: 8px 12px; border-radius: 8px; background: #fff6cc; border: 1px solid #f0d97a; }
.tx-note .tx-meta { color: #6b5600; }
.tx-msgs > .empty { align-self: center; }
.tx-composer { border-top: 1px solid var(--line); padding: 10px 16px 12px; display: grid; gap: 6px; background: var(--card); }
.tx-composer [hidden] { display: none !important; }
.tx-composer.note { background: #fffbe6; }
.tx-modes { display: inline-flex; gap: 4px; }
.tx-mode-btn { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--muted); font: inherit; font-size: var(--fs-13); font-weight: 600; cursor: pointer; }
.tx-mode-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tx-composer.note .tx-mode-btn[data-mode="note"][aria-pressed="true"] { background: #a16207; border-color: #a16207; }
.tx-composer textarea { width: 100%; resize: vertical; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.tx-lock { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-strong); font-size: var(--fs-15); }
.tx-warn { margin: 0; padding: 6px 10px; border-radius: 8px; font-size: var(--fs-13); background: color-mix(in srgb, var(--att-amber) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 55%, var(--line)); }
.tx-tpl { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.tx-tpl-words { white-space: pre-wrap; }
.tx-tpl-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 4px; }
.tx-field { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.tx-comp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-comp-foot select { max-width: 220px; }
.tx-counter { flex: 1; font-size: var(--fs-13); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.tx-counter-warn { margin: 0; font-size: var(--fs-13); color: #8a5a00; }
.tx-keys { margin: 0; }
.tx-msg-act { font-size: var(--fs-12); }
.tx-msg.out .tx-msg-act, .tx-note .tx-msg-act { color: inherit; }
.tx-links { display: grid; gap: 8px; }
.tx-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tx-new { display: grid; gap: 8px; }
.tx-new-to { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.tx-new-picked { margin: 0; }
.tx-new .tx-composer { border-top: 0; padding: 0; }
.tx-card-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tx-card-comp .tx-composer { border-top: 1px solid var(--line); margin-top: 10px; padding: 10px 0 0; }
.attempt-form #fux-host .tx-composer { border-top: 0; padding: 0 0 10px; }
.tx-edge-mode { margin: 6px 0; font-size: var(--fs-15); overflow-wrap: anywhere; }
.tx-older { margin: 0 0 8px; }
.tx-auto-words { margin-top: 6px; }
.tx-auto-words summary { cursor: pointer; }
.tx-auto-word p { margin: 4px 0; font-size: var(--fs-13); overflow-wrap: anywhere; }
.tx-hours-n { width: 80px; }
.tx-tpl-cat { margin: 16px 0 6px; font-size: var(--fs-15); }
.tx-tpl-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tx-tpl-item { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.tx-tpl-item > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 12px; cursor: pointer; }
.tx-tpl-name { font-weight: 600; }
.tx-tpl-peek { flex: 1 1 240px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-tpl-item[open] .tx-tpl-peek { display: none; }
.tx-tpl-edit { padding: 0 12px 12px; display: grid; gap: 8px; }
.tx-tpl-langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tx-tpl-lang { display: grid; gap: 4px; min-width: 0; }
.tx-tpl-lang textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
.tx-tpl-count { text-align: right; }
.tx-tpl-edit .help { margin: 0; color: var(--muted); font-size: var(--fs-13); }
.tx-tpl-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-tpl-acts .spacer { flex: 1; }
.fs-texted { margin: 0; color: var(--ok); font-weight: 600; overflow-wrap: anywhere; }
.fu-replied { color: var(--ok); font-weight: 600; }
.tx-snooze { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.tx-snooze-own { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-snooze-own .flbl { margin: 0; }
.tx-pick-more { padding: 8px; margin: 0; }
.tx-card .tx-consent-line { margin: 0 0 8px; font-size: var(--fs-13); }
.tx-card-threads { margin: 0 0 8px; }
.tx-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tx-mini li { padding: 6px 10px; border-radius: 8px; background: var(--bg); }
.tx-mini li.tx-mini-out { background: var(--accent-soft); }
.tx-mini li.tx-mini-system { background: none; border: 1px dashed var(--line-strong); }
.tx-mini-words { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-15); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tx-settings .notice { background: color-mix(in srgb, var(--att-amber) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 55%, var(--line)); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.tx-status-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 8px 0; font-size: var(--fs-15); }
.tx-status-facts dt { color: var(--muted); }
.tx-status-facts dd { margin: 0; overflow-wrap: anywhere; }
.tx-set-test { margin: 10px 0 14px; display: grid; gap: 4px; }
.tx-set-test .lbl { font-weight: 600; font-size: var(--fs-15); }
.tx-set-test .help { color: var(--muted); font-size: var(--fs-13); }
.tx-set-test-row, .tx-num-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-nums { display: grid; gap: 6px; margin: 8px 0 6px; }
.tx-num-row input { width: 220px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
.tx-num-add { margin-bottom: 14px; }
.tx-hours { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tx-days { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.tx-days .check { padding: 2px 0; }

@media (max-width: 900px) {
  .tx-layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .tx-layout.open .tx-side { display: none; }
  .tx-layout:not(.open) .tx-thread { display: none; }
  .tx-side { max-height: 75vh; }
  .tx-thread { min-height: calc(100vh - 150px); }
  .tx-msgs { max-height: 60vh; }
  .tx-acts { justify-content: flex-start; }
  .tx-acts [data-narrow] { display: inline-block; }
  .tx-msg { max-width: 92%; }
  .tx-pic img { max-width: 100%; }
  .tx-num-row input { width: 100%; }
  .tx-comp-foot select { max-width: none; flex: 1 1 100%; }
  .tx-tpl-langs { grid-template-columns: minmax(0, 1fr); }
}

/* Texting beta 4: the Group text page (public/texts-group.mjs). .tg-layout: the list (.tg-who: .tg-groups the group
   pills, .tg-day the day picked, .tg-sum-row with .tg-sum and .tg-tick-acts, table.tg-list a card per row at phone
   width through table.cards: .tg-row, .tg-off someone who can't get the text, .tg-tick, .tg-num the mobile's last four,
   .tg-why) beside the message (.tg-msg: .tg-fields the Add buttons, .tg-preview, .tg-send-row). .tg-job: the send's
   progress (.tg-progress) and results (.tg-results of .tg-result ok | bad). */
.tg-page [hidden] { display: none !important; }
.tg-intro { margin: -4px 0 12px; }
.tg-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 16px; align-items: start; }
.tg-who, .tg-msg, .tg-job { padding: 14px 16px; min-width: 0; }
.tg-msg { display: grid; gap: 8px; position: sticky; top: 12px; }
.tg-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-group { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: var(--fs-13); font-weight: 600; cursor: pointer; }
.tg-group:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.tg-group input { margin: 0; accent-color: var(--accent); }
.tg-group:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tg-day { margin: 8px 0 0; font-weight: 600; }
.tg-day:empty { display: none; }
.tg-sum-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 10px 0 8px; }
.tg-sum { margin: 0; font-size: var(--fs-13); color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-tick-acts { display: inline-flex; gap: 6px; }
.tg-list-wrap { min-width: 0; }
table.tg-list { width: 100%; }
table.tg-list td { vertical-align: top; overflow-wrap: anywhere; }
table.tg-list th.tg-tick, table.tg-list td.tg-tick { width: 2rem; }
.tg-tick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.tg-row.tg-off td { color: var(--muted); }
.tg-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-why { font-size: var(--fs-13); color: var(--danger); }
:root[data-theme="dark"] .tg-why { color: #f3a3a6; }
.tg-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tg-msg textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
.tg-preview p { margin: 0; }
.tg-preview .tg-preview-to { margin-bottom: 4px; }
.tg-send-row { display: flex; justify-content: flex-end; }
.tg-job { margin: 0 0 16px; }
.tg-job-head { font-size: var(--fs-17); margin: 0 0 8px; }
.tg-progress { width: 100%; height: 12px; accent-color: var(--accent); }
.tg-results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.tg-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 4px 8px; border-radius: 6px; font-size: var(--fs-15); overflow-wrap: anywhere; }
.tg-result.ok { background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.tg-result.bad { background: color-mix(in srgb, var(--danger) 7%, var(--card)); }
.tg-result-name { font-weight: 600; }
.tg-again { margin: 12px 0 0; }

@media (max-width: 900px) {
  .tg-layout { grid-template-columns: minmax(0, 1fr); }
  .tg-msg { position: static; }
}

/* Texting beta 4: the patient page's Texts card's No review requests (.tx-no-reviews: its switch and words), and
   Settings → Texting's review link note (.tx-review-note). */
.tx-card .tx-no-reviews { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 8px; font-size: var(--fs-13); }
.tx-card .tx-no-reviews .switch { flex: none; }
.tx-review-note { margin: 4px 0 0; }


/* Settings → Online scheduling (online scheduling beta 1, regrouped by UI release S; public/scheduling-settings.mjs): the
   checker's banner, Overview's cards and the suggestions, the visit type rows, their editor's groups and the tile beside
   them, the chips, booking hours, English and Spanish side by side, and Try it's week strip and tables. */
.sc-problems { background: color-mix(in srgb, var(--att-amber) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--att-amber) 55%, var(--line)); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.sc-problems ul { margin: 4px 0 0; padding-left: 18px; }
.sc-problems .link, .sc-checks-list .link { text-align: left; vertical-align: top; }
.sc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.sc-suggestion { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.sc-suggestion h4 { margin: 0 0 4px; font-size: var(--fs-15, 15px); }
.sc-proposal { margin: 0 0 4px; font-weight: 600; }
.sc-because { margin: 0; color: var(--muted); font-size: var(--fs-13); }
/* Overview. */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.sc-grid .option-card { margin: 0; padding-bottom: var(--sp-3); min-width: 0; }
.sc-grid .sc-wide { grid-column: 1 / -1; }
.sc-settings .help { color: var(--muted); font-size: var(--fs-13); margin: 2px 0; }
.sc-grid .help, .sc-mode-line { color: var(--muted); font-size: var(--fs-13); margin: 4px 0 8px; }
.sc-grid .sc-problems { margin: 0; font-size: var(--fs-13); }
.sc-grid .sc-problems p { margin: 0; }
.seg.sc-mode { display: flex; margin: 8px 0 0; }
.seg.sc-mode button { flex: 1; }
.sc-check { list-style: none; padding: 0; margin: 4px 0 0; }
.sc-check li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: var(--fs-13); max-width: none; margin: 0; }
.sc-check li i { position: relative; flex: none; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 50%; }
.sc-check li.done i { background: var(--ok); border-color: var(--ok); }
.sc-check li.done i::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sc-check li.now { font-weight: 700; }
.sc-check li.now i { border-color: var(--accent); }
.sc-go { margin-left: auto; color: var(--accent); font-weight: 700; font-size: var(--fs-13); text-decoration: none; white-space: nowrap; }
.sc-actions .sc-go { margin-left: 0; }
.sc-all-done { margin: 6px 0 2px; }
.sc-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-13); }
.sc-kv:last-child { border-bottom: 0; }
.sc-kv b { font-size: var(--fs-17); }
/* The rows: the visit types and the questions. */
.sc-rows { display: grid; gap: 6px; margin: 8px 0; }
.sc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: var(--fs-13); }
.sc-row b { font-size: var(--fs-15); }
.sc-m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); }
.sc-acts { position: relative; display: flex; gap: 4px; align-items: center; }
.sc-menu { position: absolute; z-index: 5; top: 100%; right: 0; display: grid; min-width: 180px; padding: 4px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-sheet); }
.sc-menu button { min-height: var(--control-h-sm); padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.sc-menu button:hover:not(:disabled) { background: var(--accent-soft); }
.sc-menu button:disabled { color: var(--muted); cursor: default; }
.sc-menu .danger { color: var(--bad-ink); }
/* The editor: the groups, and the tile beside them. */
.sc-editor { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 12px; align-items: start; margin: 8px 0 14px; }
.sc-group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 8px; }
.sc-group > summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 8px 14px; cursor: pointer; font-size: var(--fs-13); }
.sc-group[open] > summary { border-bottom: 1px solid var(--line); }
.sc-group h4 { display: inline; margin: 0; font-size: var(--fs-13); }
.sc-gsum { min-width: 0; color: var(--muted); font-weight: 400; }
.sc-gbody { padding: 0 14px; }
.sc-gbody .field { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px 12px; padding: 8px 0; align-items: start; font-size: var(--fs-13); }
.sc-gbody .field .lbl { font-size: var(--fs-13); }
.sc-why { font-size: var(--fs-13); }
.sc-why summary { color: var(--accent); cursor: pointer; font-weight: 600; }
.sc-why p { margin: 4px 0 0; color: var(--muted); }
.sc-fold { margin-top: 6px; font-size: var(--fs-13); }
.sc-fold > summary { color: var(--accent); cursor: pointer; font-weight: 600; padding: 4px 0; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h-sm); padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); cursor: pointer; font-size: var(--fs-13); }
.sc-chip.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.sc-chip:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.sc-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sc-chips.sc-off .sc-chip { opacity: .5; cursor: not-allowed; }
.sc-up { border: 0; padding: 0 2px; background: none; color: var(--accent); font-size: var(--fs-12); cursor: pointer; }
.sc-done { margin-left: auto; }
/* Providers on the Booking page. The pill is public-forms/app.css .bk-prov, .bk-init and .bk-photo copied; patient pages stay light, so it does here too. */
.sc-prov { display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, auto); gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.sc-provs > .sc-prov:first-child { border-top: 0; }
.sc-face { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.sc-face-init { background: var(--sc-soft, #e8edf4); color: var(--sc-text, #3b5170); font-weight: 800; }
.sc-prov-main { min-width: 0; }
.sc-prov-name { display: block; max-width: 320px; margin: 4px 0; }
.sc-prov-name input { width: 100%; }
.sc-prov-photo { font-size: var(--fs-13); }
.sc-prov-none { color: var(--muted); }
.sc-pill { display: inline-flex; align-items: center; gap: .4rem; min-height: 3rem; padding: 0 .8rem 0 .35rem; font-size: 1rem; border: 2px solid #9aa4b0; border-radius: 999px; background: #fff; color: #1f2430; font-weight: 600; overflow-wrap: anywhere; }
.sc-pill-init { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--sc-soft, #e8edf4); color: var(--sc-text, #3b5170); font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.sc-pill-photo { flex: none; width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; }
@media (max-width: 600px) { .sc-prov { grid-template-columns: 48px minmax(0, 1fr); } .sc-prov-pill { grid-column: 1 / -1; } }
/* The tile: public-forms/app.css .opt and .bk-type copied. Patient pages stay light, so it does here too, in dark mode. */
.sc-prev { position: sticky; top: 16px; padding: 12px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 10px; font-size: var(--fs-13); }
.sc-eyebrow { margin: 0 0 8px; color: var(--muted); font-size: var(--fs-12); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.sc-tile { display: grid; grid-template-columns: 40px 1fr 16px; gap: 11px; align-items: center; min-height: 51px; padding: 12px 13px; color: #1f2430; background: #fff; border: 2px solid #9aa4b0; border-radius: 12px; font-size: 1rem; line-height: 1.35; }
.sc-tile-main { display: block; min-width: 0; }
.sc-tile strong { display: block; overflow-wrap: anywhere; }
.sc-tile-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--sc-soft, #e8edf4); color: var(--sc-text, #3b5170); }
.sc-tile-ico svg { width: 22px; height: 22px; }
.sc-tile-letter { font-weight: 800; }
.sc-tile-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 2px; color: #4f5866; font-size: .9rem; font-weight: 400; }
.sc-tile-tag { padding: 0 8px; border-radius: 999px; background: #eef1f5; font-weight: 600; }
.sc-tile-desc { display: block; margin-top: 3px; font-size: .95rem; font-weight: 400; }
.sc-tile-chev { width: 16px; height: 16px; color: #9aa4b0; }
.seg.sc-lang { margin: 10px 0 0; }
.seg.sc-lang button { padding: 3px 10px; font-size: var(--fs-13); }
.sc-checks { margin: 10px 0 0; }
.sc-checks-list { margin: 4px 0 0; padding-left: 18px; }
.sc-copy { display: flex; gap: 8px; align-items: flex-start; }
.sc-copy textarea { flex: 1 1 auto; min-width: 0; min-height: 0; resize: vertical; font-size: var(--fs-13, 13px); }
.sc-copy textarea[rows="1"] { height: var(--control-h); overflow: hidden; resize: none; white-space: nowrap; }
.sc-qr svg { width: 160px; height: 160px; display: block; margin: 0 0 8px; background: #fff; }
.sc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc-pair label { display: flex; flex-direction: column; gap: 2px; }
.sc-pair input, .sc-pair textarea { width: 100%; box-sizing: border-box; }
.sc-settings .sc-num { width: 6em; }
.sc-mono { font-family: ui-monospace, Consolas, monospace; }
.sc-sw-line { display: flex; align-items: center; gap: 8px; }
.sc-hours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0 6px; }
.sc-dayc { min-height: var(--control-h-sm); padding: 0; border: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: var(--fs-13); font-weight: 700; cursor: pointer; }
.sc-dayc[aria-pressed="false"] { background: var(--bg); color: var(--muted); font-weight: 500; }
.sc-shared { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sc-settings input[type=time] { min-height: var(--control-h); padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card); }
.sc-hours-rows { display: flex; flex-direction: column; gap: 4px; }
.sc-hours-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sc-hours-row select { flex: 1 1 8em; width: auto; }
.sc-day { width: 2.6em; font-weight: 600; }
.sc-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sc-dates .chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.sc-date-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.sc-date-add input { width: auto; }
.sc-sub-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.sc-question { margin: 4px 0 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.sc-type input:disabled { opacity: .6; cursor: not-allowed; }
.sc-bl-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.sc-bl-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sc-bl-add select, .sc-bl-add input { width: auto; flex: 1 1 160px; }
.sc-bl-add input[hidden] { display: none; }
.sc-try-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 14px; margin: 10px 0; }
.sc-try-bar label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-13, 13px); }
.sc-try-bar label[hidden] { display: none; }
.sc-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.sc-week-day { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 6px 4px; text-align: center; cursor: pointer; font: inherit; font-size: var(--fs-13, 13px); }
.sc-week-day span { display: block; color: var(--muted); }
.sc-week-day.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sc-try-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13, 13px); margin: 6px 0; }
.sc-try-table th, .sc-try-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sc-day-reasons { margin: 4px 0 8px; padding-left: 18px; }
@media (max-width: 760px) {
  .sc-editor { grid-template-columns: minmax(0, 1fr); }
  .sc-prev { position: static; }
  .sc-row { grid-template-columns: minmax(0, 1fr); }
  .sc-gbody .field { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .sc-pair { grid-template-columns: 1fr; }
  .sc-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
