:root {
  --bg: #f5f8f8;
  --card: #ffffff;
  --ink: #414142;
  --muted: #667175;
  --line: #d9e3e3;
  --brand: #207875;
  --brand-ink: #ffffff;
  --brand-soft: #e4f1f0;
  --danger: #b3261e;
  --ok: #1b7a46;
  --radius: 20px;
  --edge: #cfe3e1;
  --head: #17524f;
  --warn-bg: #fdf3dc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a1d;
    --card: #162428;
    --ink: #e8f1f3;
    --muted: #94a9af;
    --line: #2a3d42;
    --brand: #60abb0;
    --brand-ink: #0b2a2b;
    --brand-soft: #1b3338;
    --danger: #ff8a80;
    --ok: #66d19a;
    --edge: #2a3d42;
    --head: #a9d6d9;
    --warn-bg: #3a3118;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1100px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 16px; }
header.top h1 { font-size: 1.25rem; margin: 0; letter-spacing: 0.01em; }
header.top small { color: var(--muted); display: block; font-weight: 400; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
h2, h3, h4 { font-family: Nunito, system-ui, sans-serif; }
h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 600; }
.intro { color: var(--muted); margin: 0 0 16px; }
.banner { background: #fff3cd; color: #4a3b00; border: 1px solid #e6cf74; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }

/* progress */
.progress { display: flex; gap: 6px; margin-bottom: 8px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done { background: var(--brand); }
.progress span.now { background: var(--brand); opacity: 0.55; }
.steplabel { color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; }

/* fields */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.half { grid-column: span 1; }
@media (max-width: 520px) { .field.half { grid-column: 1 / -1; } }
.field[hidden] { display: none; }
label.lbl, .lbl { font-weight: 600; font-size: 0.92rem; }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 46px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.err { color: var(--danger); font-size: 0.85rem; min-height: 0; }
.help { color: var(--muted); font-size: 0.82rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 46px;
}
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { width: 18px; height: 18px; accent-color: var(--brand); }
h3.sub { grid-column: 1 / -1; margin: 10px 0 0; font-size: 1rem; padding-top: 12px; border-top: 1px solid var(--line); }

/* buttons */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; min-height: 46px; padding: 0 20px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
}
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--brand); padding: 0 4px; min-height: 0; text-decoration: underline; }
button:disabled { opacity: 0.55; cursor: progress; }

/* terms */
.terms { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--bg); }
.terms h4 { margin: 14px 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.terms ol { margin: 0; padding-left: 0; list-style: none; }
.terms li { display: grid; grid-template-columns: 2em 1fr; gap: 4px; margin: 8px 0; font-size: 0.93rem; }
.terms li b { color: var(--brand); }

/* review + signature */
.review { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.review .rh { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--bg); border-radius: 10px 10px 0 0; font-weight: 700; }
.review dl { margin: 0; padding: 4px 12px 10px; display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 4px 12px; }
.review dt { color: var(--muted); font-size: 0.88rem; }
.review dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.sigbox { border: 1.5px dashed var(--line); border-radius: 10px; background: #fff; }
canvas.sig { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sigbar { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.done-card { text-align: center; padding: 36px 20px; }
.tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2rem; margin: 0 auto 12px; }
.small { font-size: 0.85rem; color: var(--muted); }
.saving { font-size: 0.8rem; color: var(--muted); }

/* staff */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border-radius: 999px; padding: 0 14px; min-height: 38px; }
.tab[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tab .n { opacity: 0.8; margin-left: 6px; font-weight: 400; }
.toolbar input[type=search] { flex: 1; min-width: 180px; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 42px; background: var(--card); color: inherit; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
table.list th { background: var(--bg); color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--brand-soft); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--line); }
.pill.submitted { background: #fde7b0; color: #5a3d00; }
.pill.reviewed { background: #c9efd9; color: #0d4a28; }
.pill.draft { background: var(--line); color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); width: min(760px, 96vw); max-height: 92vh; padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog .dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
dialog .db { padding: 16px 20px 20px; }
dialog .df { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.sigimg { background: #fff; border: 1px solid var(--line); border-radius: 8px; max-width: 100%; height: 110px; object-fit: contain; }
.login { max-width: 380px; margin: 10vh auto; }
.login .field { margin-bottom: 12px; }

@media print {
  body { background: #fff; color: #000; }
  body > *:not(dialog) { display: none !important; }
  dialog { position: static; width: 100%; max-height: none; border: 0; }
  dialog .dh button, dialog .df { display: none; }
  dialog::backdrop { display: none; }
}

/* searchable dropdown */
.combo { position: relative; }
.combo input { padding-right: 44px; }
.combo-btn { position: absolute; right: 4px; top: 4px; width: 38px; min-height: 38px; height: 38px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1rem; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--card); border: 1.5px solid var(--brand); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14); }
.combo-list[hidden] { display: none; }
.combo-opt, .combo-empty { padding: 11px 12px; border-radius: 8px; cursor: pointer; }
.combo-opt[aria-selected=true], .combo-opt:hover { background: var(--brand-soft); }
.combo-empty { color: var(--muted); cursor: default; font-size: 0.9rem; }

/* sticky progress bar at the very top of the page */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px 8px; }
.topbar[hidden] { display: none; }
.topbar > div { max-width: 720px; margin: 0 auto; }
.topbar .progress { margin-bottom: 6px; }
.topbar .steplabel { margin: 0; }
header.top { flex-direction: column; align-items: stretch; gap: 4px; }
header.top .saving { align-self: flex-end; min-height: 1em; font-size: 0.8125rem; }
img.brand { width: 100%; height: auto; display: block; }
.combo-foot { padding: 8px 12px 4px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }

/* website link with the blink! icon */
.site-link { display: inline-flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 16px 8px 8px; border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 600; background: var(--card); }
.site-link:hover, .site-link:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.site-icon { width: 40px; height: 40px; border-radius: 10px; display: block; flex: none; }

.cardslots { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .cardslots { grid-template-columns: 1fr 1fr; } }
.cslot { border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.cardimg { width: 100%; max-height: 220px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.cardph { height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.9rem; border-radius: 8px; background: var(--bg); }
.cardbtns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cardthumbs { display: flex; gap: 12px; flex-wrap: wrap; }
.cardthumbs img { max-width: 100%; height: 180px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }

/* ---- build v4: language toggle, notes, branch card ---- */
[hidden] { display: none !important; }
.langbar { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.langbtn { border: 0; border-radius: 0; min-height: 38px; padding: 0 18px; background: var(--card); }
.langbtn[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); }
.note { grid-column: 1 / -1; background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 14px; font-size: 0.93rem; margin-bottom: 12px; }
.grid > .note { margin-bottom: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.branchcard { text-align: left; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; display: grid; gap: 4px; }
.branchcard .bname { font-weight: 700; }
.branchcard .bphones { display: flex; gap: 14px; flex-wrap: wrap; }
.branchcard a { color: var(--brand); font-weight: 600; }
.done-card .small a, .done-card a.small { display: inline-block; margin-top: 6px; color: var(--brand); }
.alertbanner { position: sticky; top: 0; z-index: 60; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); }
.alertbanner button { min-height: 36px; }
.alertbanner button.link { color: var(--brand-ink); }
.pill.tag { background: var(--brand-soft); color: var(--brand); margin-left: 6px; }
.pill.match { background: #fde7b0; color: #5a3d00; margin-left: 6px; }
.optcell { font-weight: 700; color: var(--ok); text-align: center; }
.matchnote { background: #fff3cd; border-left-color: #e0a800; color: #4a3b00; margin-bottom: 12px; }

/* existing patient: lookup + highlighting */
.lookup { margin-top: 8px; }
.field.missing input, .field.missing select, .field.missing textarea { background: #FFF4DB; border-color: #E0A800; }
.field.missing > .lbl::after, .field.missing > div > .lbl::after { content: " \25CF"; color: #E0A800; }
.field.changed input, .field.changed select, .field.changed textarea { border-color: #B3261E; box-shadow: 0 0 0 1px #B3261E; }
.fnote { font-size: 0.82rem; line-height: 1.3; }
.fnote.missing { color: #7A5A00; }
.fnote.changed { color: #B3261E; }
.review dd.chg { color: #B3261E; font-weight: 600; }
.review dd.chg, dd.chg { color: #B3261E; font-weight: 600; }
.was { color: #B3261E; font-weight: 400; }

/* ---- staff-assisted form ---- */
.pill.awaiting_signature { background: #fdf3dc; color: #7a4b00; }
.pill.overdue { background: #fbeaea; color: #a51d24; }
.tabs .tab[aria-pressed=true] { }
.note.awaitnote { background: #fdf3dc; border-left-color: #a86a00; }
.staffbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #fdf3dc; border: 1.5px solid #a86a00; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; color: #5a3a00; }
.whobox { display: grid; gap: 8px; margin: 6px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.choice.who span.small { margin-top: 2px; }
.refcode { font: 800 2rem/1.1 "Nunito", sans-serif; letter-spacing: .08em; margin: 0 0 12px; }
ol.todo { text-align: left; max-width: 28rem; margin: 0 auto 14px; padding-left: 1.2rem; }
.uploaddlg { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); }
.uploaddlg::backdrop { background: rgba(10, 20, 20, .55); }
.uploaddlg .dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.uploaddlg .db { padding: 14px 16px; }
.uploaddlg .df { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.dropzone { border: 2px dashed var(--brand); background: var(--brand-soft); border-radius: 12px; padding: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fileitem { padding: 4px 0; overflow-wrap: anywhere; }
.scanlinks { display: flex; gap: 8px; flex-wrap: wrap; }


/* ================= v4 look (matches the Blink Practice Dashboard) ================= */
body::before { content: ""; display: block; height: 6px; background: linear-gradient(90deg, #404040 0 20%, #7CB4B4 20% 40%, #60A8B0 40% 60%, #488488 60% 80%, #207874 80% 100%); }
.topbar { top: 0; }
.wrap { padding: 20px 16px 32px; }
h1, h2 { color: var(--head); font-weight: 800; letter-spacing: 0; }
h2 { font-size: 1.5rem; line-height: 1.15; }
h3.sub { border-top-color: var(--line); color: var(--head); font-weight: 800; }
.card { border: 0; border-radius: 20px; padding: 24px; box-shadow: 0 4px 14px rgba(32, 120, 116, .10); }
.intro { color: var(--muted); }
label.lbl, .lbl { font-weight: 800; font-size: .9rem; color: var(--muted); }
.help, .small, .saving, .steplabel { color: var(--muted); }
.steplabel { font-weight: 700; }
.progress { gap: 6px; }
.progress span { height: 8px; border-radius: 99px; background: var(--edge); }
.progress span.done { background: var(--brand); }
.progress span.now { background: var(--brand); opacity: .55; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea {
  border: 2px solid var(--edge); border-radius: 16px; min-height: 50px; padding: 12px 14px; font-weight: 500; }
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #7CB4B4; outline-offset: 2px; border-color: var(--brand); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.err { color: var(--danger); font-weight: 700; }
.choices { gap: 10px; }
.choice { border: 2px solid var(--edge); border-radius: 99px; padding: 10px 18px; min-height: 48px; font-weight: 700; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--head); }
.choice input { width: 22px; height: 22px; }
button, .btn { border: 2px solid var(--edge); border-radius: 99px; min-height: 48px; padding: 0 24px; font-weight: 800; font-size: 1rem; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.link { border: 0; min-height: 44px; color: var(--brand); font-weight: 800; }
button:hover:not(:disabled):not(.link) { filter: brightness(.97); }
.langbar { border: 2px solid var(--edge); border-radius: 99px; background: var(--card); padding: 3px; gap: 3px; }
.langbtn { border-radius: 99px; min-height: 40px; border: 0; font-weight: 800; }
.note { background: var(--brand-soft); border-left: 0; border-radius: 20px; padding: 16px 20px; color: var(--head); }
.banner, .matchnote, .note.awaitnote { border-radius: 20px; }
.branchcard { border: 2px solid var(--edge); border-radius: 20px; padding: 16px 18px; }
.site-link { border: 2px solid var(--edge); border-radius: 99px; }
.terms { border: 2px solid var(--edge); border-radius: 20px; }
.review { border: 2px solid var(--edge); border-radius: 20px; overflow: hidden; }
.review .rh { border-radius: 0; background: var(--brand-soft); color: var(--head); }
.sigbox { border: 2px dashed var(--brand); border-radius: 20px; }
.cslot, .whobox, .dropzone { border-radius: 20px; }
.dropzone { border-width: 2px; }
.tick { background: var(--ok); }
.done-card { padding: 40px 20px; }
.pill { border-radius: 99px; font-weight: 800; padding: 4px 12px; }
/* staff list */
.tab { border-radius: 99px; min-height: 42px; padding: 0 16px; }
.toolbar input[type=search] { border-radius: 99px; border: 2px solid var(--edge); min-height: 46px; padding: 0 18px; }
table.list { border: 0; border-radius: 20px; box-shadow: 0 4px 14px rgba(32, 120, 116, .10); }
table.list th { background: var(--brand-soft); color: var(--head); font-weight: 800; }
dialog { border: 0; border-radius: 24px; box-shadow: 0 14px 40px rgba(32, 120, 116, .25); }
.uploaddlg { border-radius: 24px; }
.combo-list { border: 2px solid var(--brand); border-radius: 16px; }
.alertbanner { border-radius: 0; }
.staffbar { border-radius: 20px; }
@media (max-width: 520px) { .card { padding: 18px; } h2 { font-size: 1.3rem; } }
img.brand { width: min(100%, 260px); height: auto; margin: 4px 0 2px; }
header.top { padding-bottom: 8px; }
#another { margin: 16px 0 6px; }
