:root {
  --ink: #17262b;
  --muted: #5f7177;
  --line: #dde5e7;
  --bg: #f5f8f8;
  --card: #fff;
  --brand: #0f5e66;
  --brand-ink: #0b4a50;
  --brand-soft: #e4f1f2;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #a15c07;
  --amber-soft: #fef4e2;
  --green: #1f7a4d;
  --green-soft: #e6f4ec;
  --grey-soft: #eef2f3;
  --radius: 10px;
  --topbar-h: 3.75rem;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Every size in the app is in rem, so the reader's text size setting scales the whole layout. */
  font-size: calc(15px * var(--text-scale, 1));
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0.2rem 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0; }

header.topbar {
  /* Grows with the text size; the menu scrolls sideways rather than pushing the reading controls off screen. */
  display: flex; align-items: center; gap: 1.25rem; padding: 0 1.25rem; height: var(--topbar-h);
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--brand); }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 0.25rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
nav a { white-space: nowrap; flex: none; }
.brand, .who { flex: none; }
nav a { padding: 0.45rem 0.5rem; border-radius: 8px; color: var(--muted); font-weight: 500; }
nav a:hover { background: var(--grey-soft); text-decoration: none; }
nav a.on { color: var(--brand-ink); background: var(--brand-soft); }
.who { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); }
.env-banner { background: var(--amber-soft); color: var(--amber); text-align: center; font-size: 0.85rem; padding: 0.35rem; }

main { max-width: 80rem; margin: 0 auto; padding: 1.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.back { font-size: 0.9rem; }
.muted { color: var(--muted); }
.pad { padding: 0.75rem 0; }
.nowrap { white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.75rem; }
.narrow { max-width: 420px; }
.center { min-height: 70vh; display: grid; place-items: center; padding: 1rem; }
.signin { text-align: center; padding: 2rem 2.5rem; }
.signin h1 { color: var(--brand); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } header { gap: 1rem; } .who span { display: none; } }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card table { border: none; }
th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); background: #fafcfc; }
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
table.compact td { padding: 0.5rem 0.6rem; }
table.compact th { padding: 0.45rem 0.6rem; }

.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill.big { font-size: 0.9rem; padding: 0.3rem 0.8rem; }
.pill-overdue { background: var(--red-soft); color: var(--red); }
.pill-due_soon { background: var(--amber-soft); color: var(--amber); }
.pill-upcoming { background: var(--grey-soft); color: var(--muted); }
.pill-met { background: var(--green-soft); color: var(--green); }
.pill-met_late { background: var(--green-soft); color: var(--amber); }
.pill-waived, .pill-cancelled { background: var(--grey-soft); color: var(--muted); }

.stats { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; min-width: 130px; display: flex; flex-direction: column; }
.stat b { font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.stat-overdue b { color: var(--red); }
.stat-due_soon b { color: var(--amber); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: var(--card); }
.seg button.on { background: var(--brand); color: #fff; }

button { font: inherit; padding: 0.45rem 0.9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button:hover:not(:disabled) { border-color: #b9c7ca; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--brand-ink); }
button.link { border: none; background: none; color: var(--brand); padding: 0.2rem 0.3rem; }
button.danger { color: var(--red); }

input, select, textarea { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.form.stack { flex-direction: column; align-items: stretch; margin-top: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 160px; flex: 1; }
.field > span { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.field.wide, .wide { flex-basis: 100%; }
.actions { display: flex; gap: 0.5rem; }
.check { display: flex; gap: 0.4rem; align-items: center; flex-basis: 100%; }
.check input { width: auto; }
.inline-form { padding-bottom: 1rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.search { display: flex; gap: 0.5rem; margin-bottom: 1rem; max-width: 480px; }

.alert { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; flex-basis: 100%; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); margin-bottom: 1rem; }

.records { list-style: none; margin: 0; padding: 0; }
.records li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.records li:last-child { border-bottom: none; }
.records li.voided .rec-main { text-decoration: line-through; opacity: 0.6; }
.rec-side { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.note { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; white-space: pre-wrap; }
.tag { display: inline-block; background: var(--brand-soft); color: var(--brand-ink); border-radius: 6px; padding: 0.05rem 0.4rem; font-size: 0.78rem; margin-left: 0.4rem; }
.status { font-size: 0.82rem; color: var(--muted); }
.status-draft { color: var(--amber); font-weight: 600; }
.status-cosigned, .status-signed { color: var(--green); }

.team { list-style: none; padding: 0; margin: 0; }
.team li { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); align-items: center; }

details { border-top: 1px solid var(--line); padding: 0.6rem 0; }
summary { cursor: pointer; font-weight: 600; margin-bottom: 0.5rem; }

/* ── My Dashboard ── */
.small { font-size: 0.82rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chips { display: flex; gap: 0.4rem; }
.chip { border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.88rem; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter { max-width: 280px; }
.rate-stat.good b { color: var(--green); }
.rate-stat.fair b { color: var(--amber); }
.rate-stat.poor b { color: var(--red); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(720px, 100%), 1fr)); gap: 1rem; align-items: start; }
.ccard { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 0.8rem; display: flex; flex-direction: column; gap: 0.75rem; }
.ccard.urg-0 { border-left-color: var(--red); }
.ccard.urg-1 { border-left-color: #e5a23a; }
.ccard.urg-2 { border-left-color: var(--brand); }
.ccard.urg-3 { border-left-color: var(--green); }
.ccard-head { display: flex; justify-content: space-between; gap: 0.75rem; }
.ccard-name { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.roles { margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.roles .tag { margin-left: 0; }
.rate { text-align: center; min-width: 64px; padding: 0.3rem 0.5rem; border-radius: 10px; background: var(--grey-soft); align-self: flex-start; }
.rate b { display: block; font-size: 1.2rem; line-height: 1.1; }
.rate span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rate.good { background: var(--green-soft); color: var(--green); }
.rate.fair { background: var(--amber-soft); color: var(--amber); }
.rate.poor { background: var(--red-soft); color: var(--red); }

.wf { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.wf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.wf-label { font-weight: 600; font-size: 0.92rem; }
.wf-stage { font-size: 0.78rem; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }
.stepper { list-style: none; display: flex; margin: 0.55rem 0 0; padding: 0; }
.stepper li { flex: 1; position: relative; padding-top: 14px; font-size: 0.72rem; color: var(--muted); text-align: center; }
.stepper li::before { content: ""; position: absolute; top: 3px; left: 0; right: 0; height: 3px; background: var(--line); }
.stepper li:first-child::before { left: 50%; }
.stepper li:last-child::before { right: 50%; }
.stepper li::after { content: ""; position: absolute; top: 0; left: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--line); box-sizing: border-box; }
.stepper li.done::before, .stepper li.current::before { background: var(--brand); }
.stepper li.done::after { background: var(--brand); border-color: var(--brand); }
.stepper li.current::after { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.stepper li.current { color: var(--brand-ink); font-weight: 600; }
.stepper li span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }

.due-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.due-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 0.5rem; align-items: baseline; padding: 0.42rem 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.due-list li:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.due-overdue .dot { background: var(--red); }
.due-due_soon .dot { background: #e5a23a; }
.due-upcoming .dot { background: #9fb1b5; }
.due-when { font-size: 0.8rem; white-space: nowrap; color: var(--muted); }
.due-overdue .due-when { color: var(--red); font-weight: 600; }
.due-due_soon .due-when { color: var(--amber); font-weight: 600; }
.all-clear { border-top: 1px solid var(--line); padding-top: 0.6rem; color: var(--green); font-size: 0.9rem; }
.more { align-self: flex-start; padding: 0; font-size: 0.85rem; }
.ccard-foot { border-top: 1px solid var(--line); padding-top: 0.5rem; }

@media (max-width: 700px) {
  header.topbar { gap: 0.75rem; padding: 0 0.75rem; overflow-x: auto; }
  header.topbar nav a { white-space: nowrap; padding: 0.4rem 0.5rem; }
  .who button { white-space: nowrap; }
  main { padding: 1rem; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .seg button { white-space: nowrap; }
  .stats { flex-wrap: wrap; }
  .stat { min-width: calc(50% - 0.4rem); flex: 1; }
  .cards { grid-template-columns: 1fr; }
  .filter { max-width: none; }
}

/* ───────── shared bits ───────── */
.small { font-size: 0.85rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }
code { background: var(--grey-soft); border-radius: 4px; padding: 0.05rem 0.3rem; margin-right: 0.2rem; }
.notice { background: var(--brand-soft); color: var(--brand-ink); border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 1rem; font-size: 0.9rem; }
.check.inline { flex-basis: auto; display: inline-flex; margin-right: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.88rem; }
.chip code { margin-left: 0.3rem; }
tr.archived td { opacity: 0.55; }
tr.sel td { background: var(--brand-soft); }
input.short { max-width: 11rem; }
.tag.score { background: var(--grey-soft); color: var(--ink); }
.perm { display: flex; flex-wrap: wrap; }
.warn-text { color: var(--amber); margin-top: 0.3rem; }
ul.bad li { color: var(--red); }
ul.warn li { color: var(--amber); }
main.wide { max-width: 112rem; }

/* ───────── forms list ───────── */
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem 1rem; }
.starter-item { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem; border-radius: 8px; cursor: pointer; }
.starter-item:hover { background: var(--grey-soft); }
.starter-item input { width: auto; margin-top: 0.25rem; }

/* ───────── builder ───────── */
.builder h1 .link { font-size: 0.85rem; font-weight: 500; vertical-align: middle; margin-left: 0.5rem; }
.save-state { font-size: 0.85rem; color: var(--muted); align-self: center; white-space: nowrap; }
.save-state.dirty, .save-state.saving { color: var(--amber); }
.save-state.error { color: var(--red); }
.tabs { display: flex; gap: 0.25rem; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 500; padding: 0.55rem 0.9rem; }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs .problems { margin-left: auto; font-size: 0.85rem; color: var(--amber); cursor: help; }
.tabs .problems.ok { color: var(--green); }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr); gap: 1rem; align-items: start; }
.builder-grid.three { grid-template-columns: 300px minmax(0, 1fr) minmax(340px, 0.9fr); }
.builder-outline { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem; position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 34px); overflow: auto; }
.ol-group { margin-bottom: 0.4rem; }
.ol-row { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.5rem 0.35rem 1.3rem; border-radius: 6px; cursor: pointer; font-size: 0.88rem; }
.ol-row.ol-section { padding-left: 0.5rem; font-weight: 600; }
.ol-row:hover { background: var(--grey-soft); }
.ol-row.on { background: var(--brand-soft); color: var(--brand-ink); }
.ol-label { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.ol-kind { font-size: 0.72rem; color: var(--muted); white-space: nowrap; font-weight: 400; }
.ol-tools { display: flex; }
.ol-tools button { padding: 0 0.25rem; }
.ol-add { font-size: 0.85rem; margin-left: 1rem; }
.ol-add-section { width: 100%; margin-top: 0.4rem; border-style: dashed; }
.ol-types { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.4rem 0.5rem 0.4rem 1.3rem; }
.ol-types button { font-size: 0.8rem; padding: 0.25rem 0.5rem; }
.props .form.stack { margin-top: 0; }
.props fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.sub { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.75rem; }
.sub fieldset { border: none; padding: 0; margin: 0; }
.sub-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.sub-head b { margin-right: auto; }
.opt-row, .cond-row { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.35rem; }
.opt-row input.pts { width: 4.5rem; flex: none; }
.cond-row select, .cond-row input { flex: 1; min-width: 0; }
.cond-multi { display: flex; flex-wrap: wrap; flex: 2; }
.inline-select { width: auto; padding: 0.15rem 0.3rem; }
.score-fields { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.6rem; }
.score-fields .check { margin-bottom: 0.25rem; font-size: 0.9rem; align-items: flex-start; }
table.bands input { padding: 0.3rem 0.4rem; }
table.bands td { padding: 0.3rem; }
.problems-list ul { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--amber); font-size: 0.9rem; }
.builder-preview { background: #fbfcfc; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 34px); overflow: auto; }
.preview-head { display: flex; gap: 0.6rem; align-items: baseline; margin-bottom: 0.6rem; }
.preview-head .link { margin-left: auto; }
.wide-btn { width: 100%; margin-top: 0.5rem; }
.publish { border-color: var(--brand); }
@media (max-width: 1100px) {
  .builder-grid, .builder-grid.three { grid-template-columns: 1fr; }
  .builder-outline, .builder-preview { position: static; max-height: none; }
}

/* ───────── form renderer ───────── */
.fv-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem 0.9rem; margin: 0 0 0.9rem; background: var(--card); min-width: 0; }
.fv-section legend { font-weight: 700; padding: 0 0.35rem; }
.fv-desc { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.fv-q { padding: 0.5rem 0; }
.fv-q + .fv-q { border-top: 1px dashed var(--line); }
.fv-label { font-weight: 500; margin-bottom: 0.3rem; }
.fv-label .req { color: var(--red); }
.fv-help { color: var(--muted); font-size: 0.85rem; margin: -0.15rem 0 0.35rem; }
.fv-error { color: var(--red); font-size: 0.85rem; margin-top: 0.25rem; }
.fv-q.has-error input, .fv-q.has-error textarea, .fv-q.has-error select { border-color: var(--red); }
.fv-info { background: var(--brand-soft); color: var(--brand-ink); border-radius: 8px; padding: 0.5rem 0.7rem; margin: 0.4rem 0; font-size: 0.92rem; }
.fv-choices { display: flex; flex-direction: column; gap: 0.15rem; }
.fv-choice { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: 6px; cursor: pointer; }
.fv-choice:hover { background: var(--grey-soft); }
.fv-choice input { width: auto; margin: 0; }
.fv-pts { margin-left: auto; color: var(--muted); font-size: 0.78rem; }
.fv-clear { align-self: flex-start; font-size: 0.8rem; }
.fv-item { border-left: 3px solid var(--brand-soft); padding: 0.2rem 0 0.4rem 0.8rem; margin: 0.4rem 0 0.8rem; }
.fv-item-head { display: flex; justify-content: space-between; align-items: center; }
.fv-none { padding: 0.4rem 0; font-size: 0.9rem; }
.fv-scores { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.8rem; padding: 0.4rem 0; position: sticky; top: var(--topbar-h); z-index: 2; background: var(--fv-bg, var(--bg)); }
.builder-preview { --fv-bg: #fbfcfc; }
.builder-preview .fv-scores { top: -0.8rem; }
.fv-score { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.7rem; display: flex; flex-direction: column; }
.fv-score span { font-size: 0.78rem; color: var(--muted); }
.fv-score b em { font-style: normal; font-weight: 600; }
.fv-score.flag { border-color: var(--amber); background: var(--amber-soft); }
.fv-score.flag b { color: var(--amber); }
.fv-read .fv-q { padding: 0.35rem 0; }
.fv-answer { color: var(--ink); }
.fv-answer .pre, .pre { white-space: pre-wrap; }
.builder-preview .hl { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.builder-preview .fv-section, .builder-preview .fv-q, .builder-preview .fv-info { cursor: pointer; }

/* ───────── records ───────── */
.records li { flex-direction: column; }
.rec-row { display: flex; justify-content: space-between; gap: 1rem; }
.records li.open { background: #fbfcfc; }
.records li.voided.open .rec-main { text-decoration: none; }
.record-form { margin-top: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--bg); }
.record-form-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.date-field { flex: none; min-width: 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 0.6rem 0; align-items: center; border-top: 1px solid var(--line); }

/* ───────── completing requirements from cards and the chart ───────── */
.due-list li.due-action { cursor: pointer; border-radius: 6px; margin: 0 -0.35rem; padding-left: 0.35rem; padding-right: 0.35rem; }
.due-list li.due-action:hover { background: var(--grey-soft); }
.due-link { border: none; background: none; padding: 0; font: inherit; color: var(--brand-ink); font-weight: 500; text-align: left; cursor: pointer; }
.due-link:hover { text-decoration: underline; }
.due-go { display: inline-block; margin-left: 0.4rem; font-size: 0.74rem; color: var(--brand); border: 1px solid var(--brand-soft); border-radius: 999px; padding: 0 0.45rem; vertical-align: 1px; }
.due-go.draft { color: var(--amber); border-color: var(--amber-soft); background: var(--amber-soft); }
.done-list { border-top: 1px solid var(--line); margin-top: 0.4rem; padding-top: 0.2rem; }
.done-list .due-when { color: var(--green); }
.ccard-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.req-link { padding: 0; font: inherit; font-weight: 500; text-align: left; }
.small-btn { font-size: 0.82rem; padding: 0.2rem 0.6rem; }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 30, 35, 0.45); z-index: 20; display: flex; justify-content: center; align-items: flex-start; padding: 3vh 1rem; overflow: auto; }
.dialog { background: var(--bg); border-radius: 12px; width: min(860px, 100%); padding: 1rem 1.25rem 0.25rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.25rem; }
.dialog-head h2 { font-size: 1.25rem; }
.dialog .record-form { margin-top: 0.5rem; border: none; padding: 0; background: none; }
.dialog .fv-scores { top: 0; }
.done-list .due-met .dot { background: var(--green); }
.done-list .due-met_late .dot { background: var(--amber); }
.dialog .record-form-head > div:first-child b { display: none; }
button.req-link { padding: 0; }

/* ───────── AI: assistant panel ───────── */
.spacer { flex: 1; }
.ask-btn { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; padding: 0.35rem 0.85rem; color: var(--brand-ink); border-color: var(--brand-soft); background: var(--brand-soft); font-weight: 600; }
.ask-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.assistant { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 420px; max-width: 100vw; background: var(--card); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(15, 30, 35, 0.08); z-index: 15; display: flex; flex-direction: column; }
@media (min-width: 1300px) { main.with-assistant { margin-right: 420px; } }
.assistant-head { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.assistant-body, .assistant-history { flex: 1; overflow: auto; padding: 0.9rem; }
.assistant-hello p { color: var(--muted); margin-top: 0; }
.assistant-hello .chips { flex-direction: column; align-items: flex-start; }
.assistant-hello .chip { text-align: left; }
.hist-item { display: flex; justify-content: space-between; gap: 0.75rem; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0.6rem 0.2rem; background: none; }
.hist-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-input { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.6rem 0.9rem; border-top: 1px solid var(--line); }
.assistant-input textarea { resize: none; }
.assistant-foot { padding: 0 0.9rem 0.6rem; }
.msg { margin-bottom: 0.75rem; line-height: 1.45; }
.msg p { margin: 0 0 0.5rem; }
.msg p:last-child { margin-bottom: 0; }
.msg-user { margin-left: 2.5rem; background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px 12px 2px 12px; padding: 0.5rem 0.75rem; white-space: pre-wrap; }
.msg-assistant { margin-right: 1rem; }
.msg-error { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 0.5rem 0.75rem; }
.md ul, .md ol { margin: 0.25rem 0 0.5rem; padding-left: 1.2rem; }
.md li { margin-bottom: 0.2rem; }
.md .md-h { font-weight: 700; margin-top: 0.5rem; }
.ai-thinking { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.88rem; margin-top: 0.3rem; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); opacity: 0.3; animation: pulse 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (max-width: 700px) { .assistant { width: 100vw; } }

/* ───────── AI: builder dialog ───────── */
.ai-builder { padding-bottom: 1rem; }
.ai-builder .msg-user { margin-left: 4rem; }
.ai-prompt { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ai-prompt .chips { margin-bottom: 0.25rem; }
.ai-made { background: var(--green-soft); border-color: #cfe8da; }
.ai-made ul { margin: 0.4rem 0; padding-left: 1.1rem; }

/* ───────── governance ───────── */
.hits { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }
.hit { border-left: 3px solid var(--brand-soft); padding: 0.2rem 0 0.2rem 0.8rem; }
.hit-src { font-size: 0.85rem; margin-bottom: 0.2rem; }
.hit-text { white-space: pre-wrap; font-size: 0.92rem; line-height: 1.45; }

/* ───────── workflows ───────── */
.card.highlight { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.card-head .spacer + button { align-self: center; }
details { margin-top: 0.5rem; }
details summary { cursor: pointer; padding: 0.35rem 0; }
.edition-draft { border: 1px dashed var(--amber); border-radius: 8px; padding: 0.25rem 0.75rem 0.75rem; background: #fffdf8; }
.draft-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.5rem 0 0.75rem; font-size: 0.88rem; color: var(--muted); }
.draft-bar > span:first-child { flex: 1 1 320px; }
.basis { margin-top: 0.2rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.basis span { font-size: 0.75rem; color: var(--brand-ink); background: var(--brand-soft); border-radius: 4px; padding: 0.05rem 0.35rem; cursor: help; }
.basis span::before { content: "§ "; opacity: 0.6; }
.tag-warn { background: var(--amber-soft); color: var(--amber); }
.gates { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.md-table { width: auto; margin: 0.4rem 0 0.6rem; font-size: 0.88rem; }
.md-table th, .md-table td { padding: 0.3rem 0.5rem; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 0.6rem 0; }
.md blockquote { margin: 0.4rem 0; padding: 0.3rem 0.7rem; border-left: 3px solid var(--brand-soft); color: var(--muted); }

/* ───────── required policies ───────── */
.tabs a.tab { padding: 0.55rem 0.9rem; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a.tab:hover { text-decoration: none; color: var(--ink); }
.tabs a.tab.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.stat-btn { text-align: left; font: inherit; cursor: pointer; }
.stat-btn.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.stat-met b { color: var(--green); }
.stats { flex-wrap: wrap; align-items: stretch; }
.review-card { border-color: var(--brand); }
.req { display: flex; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.card-head + .req, .review-card p + .req { border-top: none; }
.req.dismissed { opacity: 0.6; }
.req-main { flex: 1; min-width: 0; }
.req-title { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.req-desc { margin: 0.2rem 0; font-size: 0.92rem; }
.basis a { font-size: 0.75rem; color: var(--brand-ink); background: var(--brand-soft); border-radius: 4px; padding: 0.05rem 0.35rem; }
.basis a::before { content: "§ "; opacity: 0.6; }
.gap { font-size: 0.86rem; margin-top: 0.35rem; padding: 0.3rem 0.55rem; border-radius: 6px; }
.gap-covered { background: var(--green-soft); }
.gap-partial { background: var(--amber-soft); }
.gap-not_found { background: var(--red-soft); }
.gap .link { margin-left: 0.3rem; }
.req-side { display: flex; flex-direction: column; gap: 0.35rem; align-items: stretch; flex: none; }
.req-fields { width: 230px; }
.req-fields select, .req-fields input { font-size: 0.85rem; padding: 0.3rem 0.45rem; }
.due-field { display: flex; flex-direction: column; gap: 0.1rem; }
.req-notes { display: flex; gap: 0.4rem; align-items: flex-end; margin-top: 0.4rem; }
@media (max-width: 760px) { .req { flex-direction: column; } .req-fields { width: auto; } }

/* ───────── dashboard: whole workflow on the card ───────── */
.steps-group { margin-top: 0.5rem; }
.steps-stage { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0.35rem 0 0.1rem; }
.steps { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.step { display: grid; grid-template-columns: 16px 1fr auto; gap: 0.5rem; align-items: baseline; padding: 0.32rem 0.3rem; margin: 0 -0.3rem; border-radius: 6px; font-size: 0.88rem; }
.step.clickable { cursor: pointer; }
.step.clickable:hover { background: var(--grey-soft); }
.step-icon { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #b7c5c8; box-sizing: border-box; transform: translateY(1px); position: relative; }
.step-met .step-icon { background: var(--green); border-color: var(--green); }
.step-met_late .step-icon { background: #e5a23a; border-color: #e5a23a; }
.step-met .step-icon::after, .step-met_late .step-icon::after { content: ""; position: absolute; left: 3px; top: 0.5px; width: 3px; height: 6px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.step-overdue .step-icon { background: var(--red); border-color: var(--red); }
.step-due_soon .step-icon { background: #e5a23a; border-color: #e5a23a; }
.step-upcoming .step-icon { border-color: var(--brand); background: var(--brand-soft); }
.step-waiting .step-icon { border-style: dashed; }
.step-not_needed .step-icon, .step-waived .step-icon, .step-cancelled .step-icon { border: none; height: 2px; border-radius: 1px; background: #b7c5c8; transform: translateY(-3px); }
.step-not_needed .step-label > span:first-child, .step-waived .step-label > span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: #c3cfd2; }
.step-waiting .step-label > span:first-child { color: var(--muted); }
.step-label { min-width: 0; }
.step-note { display: block; font-size: 0.76rem; color: var(--muted); }
.step-when { font-size: 0.8rem; white-space: nowrap; color: var(--muted); }
.step-overdue .step-when { color: var(--red); font-weight: 600; }
.step-due_soon .step-when { color: var(--amber); font-weight: 600; }
.step-met .step-when { color: var(--green); }
.step-met_late .step-when { color: var(--amber); }
.switch { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: var(--ink); cursor: pointer; white-space: nowrap; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 34px; height: 20px; border-radius: 999px; background: #c9d4d6; position: relative; transition: background 0.15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.step-summary { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.55rem; font-size: 0.86rem; }
.step-summary .next { color: var(--muted); }
.step-summary .next.step-overdue { color: var(--red); font-weight: 600; }
.step-summary .next.step-due_soon { color: var(--amber); font-weight: 600; }
.overdue-text { color: var(--red); font-weight: 600; }
.toolbar-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.manage { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; margin-bottom: 0.75rem; background: var(--bg); display: flex; flex-direction: column; gap: 0.75rem; }
.manage .seg { align-self: flex-start; flex-wrap: wrap; }
.manage .seg button { font-size: 0.85rem; padding: 0.35rem 0.7rem; }
.enrollment-closed { opacity: 0.85; }
.enrollment-void { opacity: 0.6; }
.enrollment-void h2 { text-decoration: line-through; }
button.danger-btn { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }

/* ───────────────────────── scheduling ───────────────────────── */

.label-sm { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; margin: 0.6rem 0 0.25rem; }
ul.plain { list-style: none; padding: 0; margin: 0.25rem 0; }
ul.plain li { padding: 0.25rem 0; }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin: 0.5rem 0 0.75rem; }
.form-grid .field.wide { grid-column: 1 / -1; }
.span-note { align-self: end; padding-bottom: 0.55rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.checks .check { flex-basis: auto; }
.actions.wrap { flex-wrap: wrap; margin: 0.75rem 0; }
.dialog .actions { margin: 0.75rem 0; }
a.button { display: inline-flex; align-items: center; padding: 0.45rem 0.9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
a.button:hover { text-decoration: none; border-color: #b9c7ca; }
a.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* services */
.service-card { border-left: 5px solid var(--brand); }
.service-card.inactive { opacity: 0.6; }
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.editor h3 { margin: 1.2rem 0 0.25rem; font-size: 0.95rem; }
.editor .row { display: flex; gap: 1rem; align-items: center; padding: 0.25rem 0; }
.editor select { margin-top: 0.25rem; }
.editor input.code { width: 7rem; }
.editor input.num { width: 5.5rem; }
.swatches { display: flex; gap: 0.35rem; padding-top: 0.2rem; }
.swatch { width: 1.6rem; height: 1.6rem; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* calendar */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0 0.75rem; }
.cal-toolbar input[type="date"] { width: auto; }
.cal-toolbar label.inline { display: flex; gap: 0.5rem; align-items: center; color: var(--muted); }
.cal-toolbar select { width: auto; }
.cal { display: grid; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 230px); position: relative; }
.cal-corner, .cal-colhead { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); }
.cal-colhead { padding: 0.5rem; font-weight: 600; font-size: 0.88rem; text-align: center; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-colhead.today { color: var(--brand); }
.cal-hours { position: relative; }
.cal-hour { position: absolute; right: 0.4rem; transform: translateY(-0.55em); font-size: 0.72rem; color: var(--muted); }
.cal-hour:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: copy; }
.cal-col:hover { background: #fafcfc; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid #eef2f3; pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 1; pointer-events: none; }
.appt {
  position: absolute; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden;
  padding: 0.2rem 0.4rem; border-radius: 6px; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  background: #f2f7f8; font-size: 0.78rem; line-height: 1.25; cursor: pointer; z-index: 1;
}
.appt:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); z-index: 3; }
.appt-time { color: var(--muted); font-size: 0.72rem; }
.appt-name { font-weight: 600; }
.appt-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.appt-status { font-size: 0.7rem; font-weight: 600; }
.struck { text-decoration: line-through; }
.appt.st-checked_in { background: var(--amber-soft); }
.appt.st-in_session { background: var(--brand-soft); }
.appt.st-completed { background: var(--green-soft); }
.appt.st-cancelled, .appt.st-no_show { background: var(--grey-soft); opacity: 0.7; }
.appt-pill { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; background: var(--grey-soft); color: var(--muted); }
.appt-pill.big { font-size: 0.9rem; padding: 0.3rem 0.8rem; }
.appt-pill.st-checked_in { background: var(--amber-soft); color: var(--amber); }
.appt-pill.st-in_session { background: var(--brand-soft); color: var(--brand-ink); }
.appt-pill.st-completed { background: var(--green-soft); color: var(--green); }
.appt-pill.st-no_show { background: var(--red-soft); color: var(--red); }

/* appointment dialogs */
.dialog.narrow-dialog { width: min(620px, 100%); }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; list-style: none; margin: 2px 0 0; padding: 0.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); z-index: 3; }
.picker-list button { width: 100%; text-align: left; border: none; }
.picker-list button:hover { background: var(--brand-soft); }
.chosen { padding: 0.45rem 0; }
.facts { display: grid; grid-template-columns: 7rem 1fr; gap: 0.35rem 0.75rem; margin: 0.75rem 0; }
.facts dt { color: var(--muted); font-size: 0.88rem; }
.facts dd { margin: 0; }
.subpanel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; }

/* session */
.session-start .consent { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 1rem; margin: 0.5rem 0 1rem; }
.session-start h3 { margin: 0.25rem 0; font-size: 1rem; }
.session-live { text-align: center; padding: 2rem; }
.session-live .actions { justify-content: center; margin-top: 1.25rem; }
.session-clock { font-size: 3.2rem; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.rec-state { margin-top: 0.75rem; font-weight: 600; color: var(--red); display: inline-flex; gap: 0.4rem; align-items: center; }
.rec-state.paused { color: var(--muted); }
.rec-dot { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--red); vertical-align: middle; }
button.primary .rec-dot { background: #fff; }
.rec-state.on .rec-dot { animation: rec-pulse 1.4s ease-in-out infinite; }
.rec-state.paused .rec-dot { background: var(--muted); }
@keyframes rec-pulse { 50% { opacity: 0.25; } }
.working { display: flex; gap: 1rem; align-items: center; }
.spinner { width: 1.6rem; height: 1.6rem; flex: none; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.session-done { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.session-done .record-form { border: none; padding: 0; }
.ai-banner { background: var(--brand-soft); color: var(--brand-ink); border-radius: 8px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; font-size: 0.9rem; }
.billing h3, .session-done h3 { margin: 0; font-size: 1rem; }
.code-chip { font-weight: 700; font-family: ui-monospace, monospace; background: var(--grey-soft); padding: 0.15rem 0.5rem; border-radius: 6px; }
.checklist { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.checklist li { display: flex; gap: 0.6rem; padding: 0.4rem 0; border-top: 1px solid #eef2f3; }
.checklist .mark { flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.checklist .ok .mark { background: var(--green-soft); color: var(--green); }
.checklist .bad .mark { background: var(--red-soft); color: var(--red); }
.checklist .info .mark { background: var(--grey-soft); color: var(--muted); font-style: italic; }
.good { color: var(--green); font-weight: 600; }
ul.flags { padding-left: 1.1rem; margin: 0.4rem 0; }
ul.flags li { margin: 0.25rem 0; color: var(--amber); }
.transcript summary { cursor: pointer; font-weight: 600; }
.transcript p { font-size: 0.88rem; margin: 0.5rem 0; }
@media (max-width: 900px) {
  .session-done, .service-grid { grid-template-columns: 1fr; }
}
.page-head > button, .page-head > a.button { white-space: nowrap; flex: none; }

/* next appointment and Schedule on dashboard cards */
.ccard-appt { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-top: 0.4rem; }
.ccard-appt .link { text-align: left; }
.ccard-schedule { padding: 0.2rem 0.6rem; }
.dialog > label.check { margin: 0.25rem 0 0.75rem; }
.simple-record textarea { width: 100%; } .simple-record .actions { margin-top: 0.75rem; }

/* signed records a step is waiting on */
.pending-chip { margin-left: 0.4rem; font-size: 0.72rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--amber-soft); color: var(--amber); }
.pending-chip.p-early { background: var(--brand-soft); color: var(--brand-ink); }
.pending-chip.p-too_early { background: var(--red-soft); color: var(--red); }
.cosign-bar { display: flex; align-items: center; gap: 0.75rem; background: var(--amber-soft); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
.cosign-bar span { flex: 1; }

/* validation rules */
.rules-tab { display: flex; flex-direction: column; gap: 0.75rem; }
.rules-tab > .card { margin: 0; }
.rules-tab h2 { margin: 0 0 0.25rem; }
.ai-rules textarea { width: 100%; margin: 0.25rem 0; }
.ai-rules h3 { margin: 0; font-size: 1rem; }
.sev-chip { flex: none; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.sev-chip.sev-error { background: var(--red-soft); color: var(--red); }
.sev-chip.sev-warning { background: var(--amber-soft); color: var(--amber); }
.rule-card { border-left: 4px solid var(--red); }
.rule-card.sev-warning { border-left-color: #e5a23a; }
.rule-head { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; }
.rule-title { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.alert-chip { font-size: 0.72rem; font-weight: 600; background: var(--red-soft); color: var(--red); padding: 0.1rem 0.5rem; border-radius: 999px; }
.rule-form { border: none; padding: 0; margin: 0.75rem 0 0; display: flex; flex-direction: column; gap: 0.6rem; }
.rule-form .field { display: flex; flex-direction: column; gap: 0.2rem; }
.rule-form .field > span { font-size: 0.8rem; color: var(--muted); }
.rule-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.6rem; }
.rule-problems { color: var(--red); font-size: 0.85rem; margin: 0; padding-left: 1.1rem; }
.proposed { display: flex; gap: 0.75rem; align-items: flex-start; border-top: 1px solid var(--line); padding: 0.6rem 0; }
.proposed-actions { display: flex; gap: 0.4rem; flex: none; }
.check-result { margin-top: 0.6rem; border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.check-result ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.check-result.ok { background: var(--green-soft); color: var(--green); }
.check-result.warn { background: var(--amber-soft); color: var(--amber); }
.check-result.bad { background: var(--red-soft); color: var(--red); }

/* attachments in the AI builder */
.attachments, .msg-files { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.file-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; background: var(--grey-soft); border-radius: 999px; padding: 0.15rem 0.6rem; }
.file-chip.uploading { opacity: 0.7; }
.file-chip.error { background: var(--red-soft); color: var(--red); }
.file-chip .link { padding: 0 0.1rem; }

/* ───────────────────────── reading help ───────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.a11y-menu { position: relative; }
.a11y-btn { display: inline-flex; align-items: baseline; gap: 0.05rem; padding: 0.3rem 0.6rem; border-radius: 999px; font-weight: 700; line-height: 1; }
.a11y-btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.a11y-a-small { font-size: 0.8rem; }
.a11y-a-big { font-size: 1.15rem; }
.a11y-pop { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 60; width: min(22rem, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16); padding: 0.9rem; color: var(--ink); }
.a11y-label { font-weight: 600; margin-bottom: 0.4rem; }
.a11y-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; margin-bottom: 0.8rem; }
.a11y-sizes button { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.45rem 0.2rem; font-size: 0.72rem; }
.a11y-sizes button span { font-weight: 700; line-height: 1.1; }
.a11y-sizes button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand); }
.a11y-magnify { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 600; }
.a11y-hint { font-size: 0.78rem; color: var(--muted); margin: 0.5rem 0 0; }
.signin-a11y { display: flex; justify-content: flex-end; margin: -0.4rem -0.4rem 0 0; }

body.magnify-picking, body.magnify-picking * { cursor: zoom-in !important; }
.magnify-outline { position: fixed; z-index: 70; pointer-events: none; border: 3px solid var(--brand); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 30, 35, 0.18); transition: all 0.08s ease-out; }
.magnify-banner { position: fixed; z-index: 71; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: flex; gap: 0.8rem; align-items: center; background: var(--ink); color: #fff; padding: 0.6rem 0.6rem 0.6rem 1rem; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-size: 0.95rem; }
.magnify-banner button { border-radius: 999px; }

.magnifier { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; }
.magnifier-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.magnifier-note { color: var(--muted); font-size: 0.85rem; }
.magnifier-zoom { display: inline-flex; align-items: center; gap: 0.4rem; }
.magnifier-zoom button { width: 2.4rem; height: 2.4rem; font-size: 1.3rem; padding: 0; }
.magnifier-zoom span { min-width: 3.5rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.magnifier-stage { flex: 1; overflow: auto; padding: 1.5rem; }
.magnifier-host { margin: 0 auto; }
.magnifier-host .magnified-copy { margin: 0 !important; width: auto !important; max-width: none !important; height: auto !important; position: static !important; transform: none !important; }
.magnifier-host .magnified-copy :is(.sticky-actions, .score-chip) { position: static !important; }

/* At the two largest text sizes the menu gets its own row and wraps, so every link stays in view. */
html[data-text-scale="1.5"] header.topbar,
html[data-text-scale="2"] header.topbar { height: auto; flex-wrap: wrap; gap: 0.3rem 1.5rem; padding: 0.4rem 1.5rem; }
html[data-text-scale="1.5"] header.topbar nav,
html[data-text-scale="2"] header.topbar nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow: visible; }
html[data-text-scale="1.5"] header.topbar .who,
html[data-text-scale="2"] header.topbar .who { margin-left: auto; }
.page-head .actions > button, .page-head .actions > a.button { white-space: nowrap; }
/* Wide tables scroll inside their card instead of running off the page at large text sizes. */
html[data-text-scale="1.5"] main table, html[data-text-scale="2"] main table { display: block; overflow-x: auto; }

/* calm stream view during recorded sessions */
.calm { position: fixed; inset: 0; z-index: 90; background: #2b6470; cursor: none; }
.calm.show-controls { cursor: default; }
.calm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.calm-rec { position: absolute; top: 1rem; right: 1.2rem; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.75rem; border-radius: 999px; background: rgba(10, 25, 28, 0.45); color: #fff; font-size: 0.85rem; backdrop-filter: blur(6px); }
.calm-rec.on .rec-dot { animation: rec-pulse 1.4s ease-in-out infinite; }
.calm-rec.paused .rec-dot { background: #c9c9c9; }
.calm-controls {
  position: absolute; left: 50%; bottom: 1.6rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem 0.6rem 1.1rem; border-radius: 999px;
  background: rgba(10, 25, 28, 0.55); backdrop-filter: blur(10px); color: #fff; transition: opacity 0.4s, transform 0.4s;
}
.calm.show-controls .calm-controls { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.calm-controls button { border-radius: 999px; background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.calm-controls button:hover { background: rgba(255, 255, 255, 0.24); }
.calm-controls .calm-end { background: #fff; color: var(--ink); font-weight: 600; }
.calm-time { font-variant-numeric: tabular-nums; font-size: 1.1rem; margin-right: 0.3rem; }
.calm-pref { margin: 0.25rem 0 0.75rem; }
@media (prefers-reduced-motion: reduce) { .calm-controls { transition: none; } }

/* ── telehealth ── */
.video-panel { margin-bottom: 1rem; }
.video-panel .pill { background: var(--grey-soft); color: var(--muted); }
.video-panel .waiting-pill { background: var(--amber-soft); color: var(--amber); }
.admit-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.75rem 1rem; margin: 0.5rem 0 0.75rem;
  background: var(--amber-soft); border-radius: var(--radius); font-weight: 600; }
.invite { margin-top: 0.75rem; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.invite summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 0.25rem 0; }
.invite-ways { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.6rem 0; align-items: flex-start; }
.invite-ways .disabled { color: var(--muted); }
.invite-result { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.copy-link { display: flex; gap: 0.5rem; }
.copy-link input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 0.8rem; }
.invite-log { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.contact-form { display: grid; gap: 0.6rem; max-width: 28rem; margin-top: 0.5rem; }
.contact-form label:not(.check) { display: grid; gap: 0.2rem; font-weight: 600; font-size: 0.9rem; }

.video-stage { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.5rem 0; }
.video-main { position: relative; background: #0d2226; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; max-height: 70vh; }
.video-main video { display: block; }
.video-main .hidden { display: none; }
.v-remote, .v-content { width: 100%; height: 100%; object-fit: contain; background: #0d2226; }
.v-local { position: absolute; right: 0.75rem; bottom: 0.75rem; width: 24%; min-width: 7rem; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; border: 2px solid rgba(255,255,255,0.7); transform: scaleX(-1); background: #000; }
.v-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #cfe6e6; font-size: 1.1rem; padding: 1rem; text-align: center; }
.v-banner { position: absolute; top: 0.75rem; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.6); color: #fff;
  padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.85rem; }
.video-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.video-controls .spacer { flex: 1; }
.video-controls button { min-height: 2.6rem; }
.video-controls .on-alert { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.video-controls .danger { background: var(--red); color: #fff; border-color: var(--red); }

/* the client's join page */
.join { min-height: 100vh; display: flex; flex-direction: column; }
.join-head { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); }
.join-head .spacer { flex: 1; }
.join-main { flex: 1; width: 100%; max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem; display: flex; flex-direction: column; align-items: stretch; }
.join-main .card.narrow { align-self: center; width: 100%; max-width: 30rem; display: flex; flex-direction: column; gap: 0.75rem; font-size: 1.05rem; }
.join-main label { display: grid; gap: 0.3rem; font-weight: 600; }
.join-main input[type="date"] { font-size: 1.1rem; padding: 0.55rem; }
button.big { font-size: 1.05rem; padding: 0.7rem 1.2rem; }
.waiting-room { text-align: center; align-items: center; }
.device-check .preview { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: #0d2226; transform: scaleX(-1); }
.mic-meter { height: 0.6rem; background: var(--grey-soft); border-radius: 999px; overflow: hidden; }
.mic-meter span { display: block; height: 100%; background: var(--green); transition: width 80ms linear; }
@media (max-width: 40rem) {
  .video-main { aspect-ratio: 3 / 4; max-height: 75vh; }
  .v-local { width: 32%; }
}

/* ── audit log ── */
.audit-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.audit-filters label { display: grid; gap: 0.2rem; font-size: 0.85rem; font-weight: 600; }
.audit-filters label.grow { flex: 1; min-width: 12rem; }
.audit-filters .actions { margin: 0; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.audit-table th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.audit-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.audit-table tbody tr:not(.audit-detail) { cursor: pointer; }
.audit-table tbody tr:not(.audit-detail):hover { background: var(--bg); }
.audit-table .nowrap { white-space: nowrap; }
.audit-table tr.a-denied td:nth-child(3) { color: var(--red); }
.audit-table tr.a-join_dob_mismatch td:nth-child(3), .audit-table tr.a-join_locked td:nth-child(3) { color: var(--amber); }
.audit-detail td { background: var(--bg); }
.audit-detail pre { margin: 0.4rem 0 0; font-size: 0.78rem; white-space: pre-wrap; word-break: break-word; }
.access-history { margin-top: 1rem; }
.access-history summary { cursor: pointer; display: flex; align-items: baseline; gap: 0.75rem; list-style: none; }
.access-history summary::before { content: "▸"; color: var(--brand); }
.access-history[open] summary::before { content: "▾"; }
.access-history[open] summary { margin-bottom: 0.75rem; }

/* ── profiles ── */
.profile-editor .pf-section, .new-client .pf-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.9rem 0.25rem; margin: 0 0 0.9rem; background: var(--card); }
.pf-section legend { font-weight: 700; font-size: 0.95rem; padding: 0 0.35rem; }
.pf-section .form-grid { margin: 0.25rem 0 0.5rem; }
.pf-section .field small { font-weight: 400; }
.pf-bool { align-self: end; padding-bottom: 0.45rem; }
.pf-bool small { display: block; }
.pf-multi { grid-column: 1 / -1; border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.pf-multi legend { font-size: 0.82rem; color: var(--muted); font-weight: 500; margin-bottom: 0.3rem; padding: 0; }
.new-client .required .field > span::after { content: " *"; color: var(--red); }
.new-client h2 { margin-bottom: 0.75rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 0.6rem 0; margin: 0 !important; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.9rem; margin: 0.25rem 0 0.5rem; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .pre { white-space: pre-line; }
.profile-links { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.contact-list li { border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.contact-list li:last-child { border-bottom: none; }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.2rem 0; }
.tag { font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.tag-brand { background: var(--brand-soft); color: var(--brand-ink); }
.h1-sub { font-weight: 500; font-size: 1.1rem; }
.user-name { color: var(--muted); font-weight: 500; }
.invite-person { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--line); width: 100%; }

/* ── golden thread ── */
.thread-banner { background: var(--brand-soft); color: var(--brand-ink); border-radius: 8px; padding: 0.35rem 0.7rem; margin: 0.25rem 0 0.75rem; }
.thread-chip { display: inline-block; background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: 0.1rem 0.55rem; margin: 0 0.3rem 0.2rem 0; font-size: 0.9em; }
.thread-diagram { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.thread-node { display: flex; flex-direction: column; gap: 0.15rem; background: var(--card); border: 2px solid var(--brand); border-radius: var(--radius); padding: 0.5rem 0.8rem; min-width: 9rem; }
.thread-node.note { border-style: dashed; }
.thread-arrow { align-self: center; color: var(--brand); font-size: 1.3rem; font-weight: 700; }
.thread-src { align-items: end; }
.thread-empty { text-align: center; }
.thread-proposal { margin: 0.25rem 0 0.75rem; padding-left: 1.2rem; font-size: 0.92rem; }
.thread-proposal li { margin: 0.2rem 0; }
.thread-ai .working { display: flex; align-items: center; gap: 0.5rem; }
.thread-tree, .thread-tree ul { list-style: none; margin: 0; padding: 0; }
.thread-tree ul { margin-left: 1.1rem; border-left: 2px solid var(--brand-soft); padding-left: 0.8rem; }
.thread-tree > li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.thread-tree > li:last-child { border-bottom: none; }
.thread-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; padding: 0.15rem 0; }
.thread-level { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); min-width: 7.5rem; }
.thread-label { font-weight: 600; }
.thread-gap { color: var(--amber); margin: 0.1rem 0 0.2rem 1.1rem; }
.tag-warn { background: var(--amber-soft); color: var(--amber); }
.thread-link { font-weight: 600; }

/* ── client chart sections ── */
.chart-layout { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.chart-nav { position: sticky; top: calc(var(--topbar-h) + 1rem); display: flex; flex-direction: column; gap: 0.15rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem; }
.chart-nav a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.7rem; border-radius: 8px; color: var(--ink); font-weight: 500; }
.chart-nav a:hover { background: var(--bg); text-decoration: none; }
.chart-nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav-badge { font-size: 0.72rem; font-weight: 700; min-width: 1.4rem; text-align: center; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.nav-badge.bad { background: var(--red-soft); color: var(--red); }
.chart-body { min-width: 0; }
.chart-body > .card:first-child { margin-top: 0; }
.chart-head a.pill:hover { text-decoration: none; }
.due-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.due-list li { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.profile-section { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.profile-section > .card { margin: 0; }
.appt-table td { vertical-align: middle; }
.svc-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; }
.seg.small button { font-size: 0.82rem; padding: 0.25rem 0.6rem; }
@media (max-width: 56rem) {
  .chart-layout { grid-template-columns: 1fr; }
  .chart-nav { position: static; flex-direction: row; overflow-x: auto; padding: 0.3rem; }
  .chart-nav a { white-space: nowrap; flex: none; }
  .profile-section { grid-template-columns: 1fr; }
}
.head-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.worklist-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.worklist-head .stats { margin: 0; }
.profile-tools { margin: 0 0 0.5rem !important; }
.env-demo { margin-left: 0.75rem; color: inherit; font-weight: 600; text-decoration: underline; }
.demo-block { border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.demo-block h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.danger-zone { border-color: #e7b4ae; background: #fdf6f5; }
.ok-text { color: #1f7a4d; }

/* ───────── OCEAN ───────── */
.ocean-title { letter-spacing: 0.12em; }
.ocean .page-head p { margin: 0.1rem 0 0; }
.ocean-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .ocean-layout { grid-template-columns: 1fr; } }
.ocean-side { position: sticky; top: 5rem; }
.side-h { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 1rem 0 0.4rem; }
.side-h:first-child { margin-top: 0; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { padding: 0.3rem 0.5rem; border-radius: 6px; font-size: 0.92rem; }
.side-list li.on { background: var(--card); box-shadow: inset 3px 0 0 #0f5e66; }
.side-list li a { color: var(--ink); }
.side-list button.link { text-align: left; }
.side-list .tag { margin-left: 0.4rem; font-size: 0.7rem; background: #e6f0f1; color: #0f5e66; border-radius: 999px; padding: 0.05rem 0.45rem; }
.ocean-welcome .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.chip { border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.88rem; }
.ocean-pinned { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ocean-pin { color: inherit; display: block; }
.ocean-pin h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.ocean-pin .ocean-legend { display: none; }
.ocean-report-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ocean-report-head h2 { margin: 0 0 0.25rem; }
.ocean-report-head p { margin: 0.15rem 0; }
.ocean-report-head .actions { align-self: flex-start; flex-wrap: wrap; justify-content: flex-end; max-width: 460px; }
.ocean-chart { margin: 1rem 0 0.5rem; }
.ocean-plot { position: relative; }
.ocean-plot svg { width: 100%; height: auto; display: block; overflow: visible; }
.ocean-plot .grid { stroke: #e8eef0; stroke-width: 1; }
.ocean-plot .tick { fill: var(--muted); font-size: 11px; }
.ocean-plot .cat { fill: var(--ink); font-size: 12px; }
.ocean-plot .val { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.ocean-plot .hit { fill: transparent; }
.ocean-plot g.on .hit { fill: #f2f7f7; }
.ocean-plot .crosshair { stroke: #9fb3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.ocean-tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.6rem; box-shadow: 0 4px 14px rgba(23, 38, 43, 0.12); font-size: 0.85rem; min-width: 120px; z-index: 2; transform: translateY(-4px); }
.ocean-tip .row { display: flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.ocean-tip i, .ocean-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ocean-legend { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.85rem; color: var(--ink); }
.ocean-legend li { display: flex; align-items: center; gap: 0.35rem; }
.ocean-number { padding: 1.25rem 0; }
.ocean-number b { display: block; font-size: 2.6rem; color: var(--ink); line-height: 1.1; }
.ocean-number span { color: var(--muted); }
.ocean-data { margin-top: 0.5rem; }
.ocean-data summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.ocean-table { max-height: 520px; overflow: auto; margin-top: 0.5rem; }
.ocean-table td.num, .ocean-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ocean-chat { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.5rem 0; }
.ocean-chat .msg { max-width: 80%; padding: 0.5rem 0.75rem; border-radius: 10px; font-size: 0.93rem; }
.ocean-chat .msg.you { align-self: flex-end; background: #0f5e66; color: #fff; }
.ocean-chat .msg.ocean { align-self: flex-start; background: #eef4f5; }
.ocean-ask { display: flex; gap: 0.5rem; align-items: flex-end; }
.ocean-ask textarea { flex: 1; }
.ocean-spec { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 1rem; padding: 0.6rem 0.8rem; background: #f7fafa; border: 1px solid var(--line); border-radius: 8px; }
.ocean-spec p { margin: 0; flex: 1 1 100%; }
.field.inline { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.ocean-save { display: grid; grid-template-columns: 1fr 2fr; gap: 0.75rem; margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.ocean-save .check, .ocean-save .actions, .ocean-save .alert { grid-column: 1 / -1; }
@media print {
  .ocean-side, .ocean .page-head button, .no-print { display: none !important; }
  .ocean-layout { display: block; }
  .ocean-data { display: block; }
  .ocean-data > summary { display: none; }
  .ocean-table { max-height: none; overflow: visible; }
}
.ocean-spec .field.inline span { margin: 0; }
.ocean-spec .field.inline select { width: auto; min-width: 150px; }
.ocean-spec .field.inline { display: flex !important; flex-direction: row; align-items: center; gap: 0.5rem; }
.ocean-scope { margin: 0.35rem 0 0 !important; color: #0f5e66; background: #e6f0f1; border-radius: 6px; padding: 0.25rem 0.6rem; display: inline-block; }

/* ───────── Programs ───────── */
.program-card { border: 1px solid var(--line); border-radius: var(--radius); background: #f7fafa; padding: 0.9rem 1rem 0.25rem; margin-bottom: 1rem; }
.program-head { display: flex; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.program-head h2 { margin: 0.1rem 0; font-size: 1.15rem; }
.program-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: #0f5e66; font-weight: 700; }
.program-head .actions { margin: 0; flex-wrap: wrap; }
.program-head .actions button.on { background: #e6f0f1; }
.program-workflows > .card { margin-bottom: 0.75rem; }
.wf-program { color: var(--muted); font-weight: 500; }
.program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }
.program-tile { color: inherit; display: block; }
.program-tile h3 { margin: 0 0 0.3rem; }
.program-tile p { margin: 0.25rem 0; }
.program-title { margin: 0.4rem 0 0.2rem; font-size: 1.4rem; }
.program-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.program-setup .card { margin-bottom: 0; }
.program-setup h3, .card-head h3 { margin: 0; }
.plain-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.plain-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .link.danger { margin-left: auto; }
.inline-check { margin-left: auto; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.3rem; }
select.attach { margin-top: 0.4rem; width: 100%; }
table.standards td { vertical-align: top; }
.program-setup + .card { margin-top: 1rem; }

/* ───────── Diagnoses ───────── */
.code-picker { position: relative; }
.code-picker input { width: 100%; }
.code-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 0.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(23, 38, 43, 0.14); max-height: 320px; overflow: auto; }
.code-results li { padding: 0.4rem 0.55rem; border-radius: 6px; cursor: pointer; font-size: 0.92rem; }
.code-results li.on, .code-results li:not(.header):not(.muted):hover { background: #e6f0f1; }
.code-results li.header { cursor: default; color: var(--muted); }
.code-results .code-version { text-align: right; cursor: default; }
.dx-chips { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.dx-chip { display: flex; align-items: center; gap: 0.4rem; background: #f2f7f7; border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.55rem; font-size: 0.92rem; }
.dx-chip span:not(.tag) { flex: 1; }
.dx-chips.read .dx-chip { background: transparent; border: 0; padding: 0.1rem 0; }
.tag { font-size: 0.7rem; background: #e6f0f1; color: #0f5e66; border-radius: 999px; padding: 0.05rem 0.45rem; margin-left: 0.35rem; font-weight: 600; }
.dx-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.dx-row { border-bottom: 1px solid var(--line); padding: 0.6rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-start; }
.dx-row:last-child { border-bottom: 0; }
.dx-row .dx-main { flex: 1 1 360px; }
.dx-row .dx-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.dx-row > form, .dx-row > .dx-history, .dx-row > .alert { flex-basis: 100%; }
.dx-row.resolved .dx-code, .dx-row.ruled_out .dx-code, .dx-row.error .dx-code { color: var(--muted); }
.dx-row.error { opacity: 0.7; }
.dx-row .pill { margin-left: 0.4rem; }
.dx-code { font-variant-numeric: tabular-nums; margin-right: 0.25rem; }
.dx-compact { margin: 0; padding-left: 1.1rem; }
.dx-compact li { margin: 0.25rem 0; font-size: 0.92rem; }
.dx-picked { padding: 0.45rem 0.6rem; background: #f2f7f7; border-radius: 8px; }
.dx-history { margin: 0.3rem 0 0; padding-left: 1rem; color: var(--muted); }
.dx-suggest { margin: 0.75rem 0; }
/* Diagnosis rows keep their own layout inside other lists (e.g. a record opened in Documents). */
ul.dx-list > li.dx-row { flex-direction: row; align-items: flex-start; border-left: 0; background: transparent; margin: 0; }
ul.dx-list > li.dx-row > .dx-main { flex: 1 1 320px; min-width: 0; }
.wf-rule { flex-direction: column; align-items: stretch !important; }
.wf-rule-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.wf-rule-head .link.danger { margin-left: 0; }
.wf-rule-head > a { margin-right: auto; }
.rule-text { color: var(--muted); }
.rule-text.conditional { color: #0f5e66; }
.rule-text.conditional::before { content: "⚡ "; }
.rule-editor { display: grid; grid-template-columns: 1fr; gap: 0.5rem; background: #f7fafa; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.75rem; margin-top: 0.4rem; }
.rule-editor .wide { grid-column: 1 / -1; }
.rule-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.rule-row input[type=number] { width: 6rem; }
.rule-values { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.start-reason { margin: -0.3rem 0 0.5rem; color: #0f5e66; background: #e6f0f1; border-radius: 6px; padding: 0.2rem 0.5rem; display: inline-block; }

/* MyStream (client portal), staff side */
.inset { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0 0.75rem; }
.attention { color: var(--red); font-weight: 600; }
.threads { list-style: none; padding: 0; margin: 0; }
.threads > li { border-top: 1px solid var(--line); }
.threads > li:first-child { border-top: none; }
.threads > li.unread .thread-row b { color: var(--brand-ink); }
.threads > li.flagged { border-left: 4px solid var(--red); padding-left: 0.5rem; }
.thread-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: left; background: none; border: none; padding: 0.65rem 0.25rem; border-radius: 0; font: inherit; color: inherit; cursor: pointer; }
.thread-row:hover { background: var(--grey-soft); }
.thread { padding: 0.25rem 0 0.9rem; }
.msgs { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.msgs li { max-width: 80%; }
.msgs .from-staff { align-self: flex-end; text-align: right; }
.msg-body { white-space: pre-wrap; padding: 0.55rem 0.8rem; border-radius: 12px; background: var(--grey-soft); text-align: left; overflow-wrap: anywhere; }
.from-staff .msg-body { background: var(--brand-soft); }
.review h4 { margin: 0.75rem 0 0.25rem; }
.answers { display: grid; grid-template-columns: minmax(10rem, 40%) 1fr; gap: 0.25rem 1rem; margin: 0; }
.answers dt { color: var(--muted); }
.answers dd { margin: 0; white-space: pre-wrap; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ───────────── Billing ───────────── */
.billing-editor { display: flex; flex-direction: column; gap: 0.6rem; background: #f7fafa; border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; margin-top: 0.5rem; }
.billing-editor h4 { margin: 0.25rem 0 0; font-size: 0.95rem; }
.billing-editor .form-grid { margin: 0; }
.basis-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem; }
.basis-choice .basis { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; padding: 0.55rem 0.7rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.basis-choice .basis.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
table.fees input { width: 100%; padding: 0.3rem 0.4rem; }
table.fees td { padding: 0.3rem; }
.billing-editor details.qualifying summary { cursor: pointer; font-weight: 500; }
.rule-summary { margin: 0; padding: 0.45rem 0.6rem; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 0.9rem; }
.rule-summary.bad { background: var(--amber-soft); color: var(--amber); }
.try-it { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.preview { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.75rem; }
.preview h4 { margin: 0.6rem 0 0.25rem; font-size: 0.9rem; }
.stat-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.stat-row .stat { flex: 1 1 120px; display: flex; flex-direction: column; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.stat-row .stat strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stat-row .stat span { color: var(--muted); font-size: 0.82rem; }
.stat-row .stat.warn strong { color: var(--amber); }
.note-line { margin: 0.2rem 0; color: var(--amber); }
.hold { color: var(--amber); }
.reason-list { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.program-billing .arrangements { list-style: none; padding: 0; margin: 0 0 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.program-billing .arrangements > li { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.65rem; }
.program-billing .arrangements > li.inactive { opacity: 0.65; }
.upcoming-edition { color: var(--brand-ink); margin-top: 0.2rem; }
.new-arrangement { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 0.6rem; }
.new-arrangement h4 { margin: 0 0 0.4rem; }
.coverages { list-style: none; padding: 0; margin: 0 0 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.coverages > li { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.65rem; }
.billing-page .page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.month-pick { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.run-card h3 { margin: 0 0 0.2rem; }
.run-card .run-result { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 0.5rem; }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: #f3d29b; }
.alert.warn ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
table.payer-summary { margin-bottom: 0.75rem; }
.filters { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; flex-wrap: wrap; }
table.charges td.why { max-width: 26rem; }
table.charges tr.bundled td { color: var(--muted); }
tr.voided td { color: var(--muted); text-decoration: line-through; }
tr.voided td .muted, tr.voided td button { text-decoration: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.status-tag { display: inline-block; border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.8rem; background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.status-tag.pending { background: var(--brand-soft); color: var(--brand-ink); }
.status-tag.held { background: var(--amber-soft); color: var(--amber); }
.status-tag.approved { background: var(--green-soft); color: var(--green); }
.status-tag.invoiced, .status-tag.issued { background: #e8ecfb; color: #3843a3; }
.status-tag.void { background: var(--red-soft); color: var(--red); }
.inline-void { display: inline-flex; gap: 0.3rem; margin-left: 0.3rem; }
.inline-void input { width: 10rem; padding: 0.25rem 0.4rem; }
.unbilled-group h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.unbilled-group .fix { color: var(--brand-ink); margin: 0 0 0.5rem; }
.ready-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ready-list li { display: flex; align-items: center; gap: 0.75rem; }
.ready-list li button { margin-left: auto; }
.invoice-dialog { width: min(980px, 100%); }
.invoice-sheet { background: #fff; padding: 1rem; border-radius: 8px; border: 1px solid var(--line); }
.invoice-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.invoice-head h2 { margin: 0; }
.invoice-head .right { text-align: right; }
.invoice-sheet tfoot td { border-top: 2px solid var(--line); }
.pre { white-space: pre-line; }
@media print {
  body * { visibility: hidden; }
  .invoice-sheet, .invoice-sheet * { visibility: visible; }
  .invoice-sheet { position: absolute; inset: 0 auto auto 0; width: 100%; border: none; }
  .no-print { display: none !important; }
}
.basis-choice .basis .basis-hint { font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.filters select { width: auto; min-width: 11rem; }
.try-it input[type=month], .month-pick input { width: auto; }
.billing-editor .rule-values { align-items: center; }
.billing-editor .rule-values .inline-check, .billing-editor .rule-row .inline-check { display: inline-flex; align-items: center; gap: 0.3rem; width: auto; margin: 0; }
.billing-editor .rule-values input[type=checkbox], .billing-editor .rule-row input[type=checkbox] { width: auto; }
.billing-editor .rule-row select, .billing-editor .rule-row input[type=number] { width: auto; }
.program-billing > .rule-row select { width: auto; }
.billing-editor .form-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.claims-ready > li { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; }
.claims-ready > li table { margin-top: 0.5rem; }
.status-tag.test-tag { margin-left: 0.35rem; background: var(--amber-soft); color: var(--amber); }
pre.x12 { max-height: 18rem; overflow: auto; background: #0f1e22; color: #d7e6e8; font-size: 0.78rem; padding: 0.6rem 0.75rem; border-radius: 8px; white-space: pre; }
.settings-form .card { margin-bottom: 0.75rem; }
.settings-form .field .muted.small { font-weight: 400; }

/* ───────────── Account setup ───────────── */
.setup-panel { position: fixed; top: calc(var(--topbar-h) + 1.9rem); left: 0; bottom: 0; width: 19rem; overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); padding: 1rem 0.9rem 1.5rem; z-index: 3; }
main.with-setup { margin-left: 19rem; }
@media (min-width: 1300px) { main.with-setup { margin-left: calc(19rem + 0.5rem); } }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.6rem; }
.setup-title { font-weight: 700; font-size: 1.05rem; color: var(--brand-ink); }
.setup-progress { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; color: var(--muted); }
.setup-progress .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--grey-soft); overflow: hidden; }
.setup-progress .bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width 0.3s; }
.setup-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.setup-step-link { display: grid; grid-template-columns: 1.7rem 1fr; grid-template-rows: auto auto; column-gap: 0.55rem; padding: 0.5rem 0.55rem; border-radius: 8px; color: var(--ink); border: 1px solid transparent; }
.setup-step-link:hover { text-decoration: none; background: var(--grey-soft); }
.setup-step.on .setup-step-link { background: var(--brand-soft); border-color: #c4dfe1; }
.step-mark { grid-row: 1 / span 2; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; background: var(--grey-soft); color: var(--muted); border: 1.5px solid var(--line); }
.setup-step.done .step-mark { background: var(--green); border-color: var(--green); color: #fff; }
.setup-step.in_progress .step-mark { border-color: var(--brand); color: var(--brand-ink); background: #fff; }
.setup-step.on .step-mark:not(:empty) { box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--brand); }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-label { font-weight: 600; font-size: 0.95rem; }
.step-detail { font-size: 0.8rem; color: var(--muted); }
.step-status { grid-column: 2; justify-self: start; margin-top: 0.25rem; font-size: 0.72rem; border-radius: 999px; padding: 0.05rem 0.5rem; background: var(--grey-soft); color: var(--muted); }
.step-status.done { background: var(--green-soft); color: var(--green); }
.step-status.in_progress { background: var(--brand-soft); color: var(--brand-ink); }
.step-status.todo { background: var(--amber-soft); color: var(--amber); }
.step-help { margin: 0.35rem 0 0.4rem 2.25rem; font-size: 0.85rem; color: var(--ink); display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.step-help p { margin: 0; color: var(--muted); }
.step-help ul { margin: 0; padding-left: 1.1rem; color: var(--amber); }
.setup-next { display: block; margin-top: 0.9rem; font-weight: 600; }
.setup-done { margin-top: 0.9rem; padding: 0.7rem; border-radius: 8px; background: var(--green-soft); color: var(--green); }
.setup-done p { color: var(--ink); margin: 0.3rem 0 0.5rem; }
button.small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.account-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.account-type { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; text-align: left; padding: 0.85rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.account-type strong { font-size: 1.05rem; }
.account-type.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.account-setup .card { margin-bottom: 0.9rem; }
@media (max-width: 900px) {
  .setup-panel { position: static; width: auto; border-right: none; border-bottom: 1px solid var(--line); }
  main.with-setup { margin-left: auto; }
}
.account-form .actions { display: flex; align-items: center; gap: 0.75rem; }
.library-bar { display: flex; align-items: center; gap: 0.75rem; margin: 0.25rem 0 0.75rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: none; border-radius: 0; background: transparent; padding: 0.4rem 0.85rem; display: inline-flex; gap: 0.4rem; align-items: center; color: var(--ink); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.seg-count { font-size: 0.75rem; background: var(--grey-soft); color: var(--muted); border-radius: 999px; padding: 0 0.45rem; }
.area-tag { display: inline-block; border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.78rem; }
.area-tag.clinical { background: var(--brand-soft); color: var(--brand-ink); }
.area-tag.billing { background: #e8ecfb; color: #3843a3; }
.draft-guidance { margin-top: 0.5rem; border: 1px dashed #b9c9e8; border-radius: 8px; padding: 0.5rem 0.7rem; background: #f6f8fe; }
.draft-guidance summary { cursor: pointer; }
.guidance-pick { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.25rem; }
.guidance-pick .inline-check { display: inline-flex; align-items: center; gap: 0.4rem; width: auto; }
.guidance-pick input[type=checkbox] { width: auto; }
.draft-notes { margin-top: 0.5rem; border-left: 3px solid #3843a3; background: #f6f8fe; border-radius: 0 8px 8px 0; padding: 0.55rem 0.75rem; }
.draft-notes p { margin: 0.3rem 0; }
.draft-uncertain { color: var(--amber); margin: 0.3rem 0; }
.draft-uncertain ul, .draft-cites { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.draft-cites li { margin: 0.2rem 0; }
.service-details { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.75rem 0.6rem; margin: 0.5rem 0; }
.service-details legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.3rem; }
.bundle-editor { display: flex; flex-direction: column; gap: 0.45rem; }
.bundle-editor h4 { margin: 0.6rem 0 0; }
.template-row { background: var(--brand-soft); border-radius: 8px; padding: 0.45rem 0.6rem; }
table.comps input, table.tiers input { width: 100%; padding: 0.3rem 0.4rem; }
.bundle-lines { display: flex; flex-direction: column; gap: 0.4rem; }
.bundle-line { border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.bundle-line-head { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: baseline; width: 100%; text-align: left; background: transparent; border: none; padding: 0.5rem 0.7rem; }
.bundle-line-head code { font-size: 0.8rem; }
.bundle-line.open .bundle-line-head { border-bottom: 1px solid var(--line); }
.line-editor { padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.45rem; }
.line-editor h5 { margin: 0.4rem 0 0; font-size: 0.88rem; }
.conditions .rule-row input[type=number] { width: 5rem; }
.cond-rows { display: flex; flex-direction: column; gap: 0.25rem; }
.line-editor .inline-check, .conditions .inline-check { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; margin: 0; }
.line-editor input[type=checkbox], .line-editor input[type=radio] { width: auto; }
.line-editor .rule-row select, .line-editor .rule-row input { width: auto; }

/* OCEAN deep dives */
.ocean > .tabs { margin-bottom: 1rem; }
.dive-new { width: 100%; margin-bottom: 0.75rem; }
.dive-kicker { margin: 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); font-weight: 600; }
.dive-head h2 { margin: 0.1rem 0 0.35rem; }
.dive-problem { margin: 0 0 0.35rem; white-space: pre-wrap; max-width: 70ch; }
.dive-edit { max-width: 640px; }
.dive-steps { list-style: none; display: flex; gap: 0.5rem; padding: 0; margin: 1rem 0; flex-wrap: wrap; }
.dive-steps li { flex: 1; min-width: 120px; border-top: 3px solid var(--line); padding-top: 0.4rem; }
.dive-steps li.done { border-color: var(--brand); }
.dive-steps li.on { border-color: var(--brand-ink); }
.dive-steps li button { color: var(--muted); font-weight: 500; padding: 0; }
.dive-steps li.on button { color: var(--ink); font-weight: 700; }
.dive-steps li.done button { color: var(--brand); }
.dive-steps li button:disabled { cursor: default; text-decoration: none; }
.dive-steps b { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--grey-soft); font-size: 0.8rem; margin-right: 0.25rem; }
.dive-steps li.on b, .dive-steps li.done b { background: var(--brand); color: #fff; }
.dive-step h3 { margin: 0.25rem 0 0.25rem; }
.dive-step h4 { margin: 1.25rem 0 0.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dive-ask { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.dive-ask input { flex: 1; min-width: 240px; }
.dive-progress { width: 100%; margin: 0; }
.dive-ai { background: var(--brand-soft); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin-bottom: 0.75rem; }
.dive-ai p { margin: 0.2rem 0; }
.dive-chosen { margin-bottom: 0.5rem; }
.dive-row { display: flex; gap: 0.75rem; align-items: flex-end; margin: 0.5rem 0; }
.dive-row .field { max-width: 180px; margin: 0; }
.dive-metric { display: flex; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.6rem; background: var(--card); }
.dive-metric h5, .dive-kpi h5 { margin: 0.15rem 0 0.25rem; font-size: 1rem; }
.dive-metric p { margin: 0.15rem 0; }
.dive-metric-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; min-width: 220px; }
@media (max-width: 700px) { .dive-metric { flex-direction: column; } .dive-metric-side { align-items: stretch; } }
.dive-gaps { border: 1px dashed var(--line); border-radius: var(--radius); padding: 0.25rem 1rem; }
.dive-kpis input, .dive-kpis select { min-width: 0; }
.dive-kpis .dive-target { width: 5.5rem; text-align: right; }
.dive-kpis td { vertical-align: top; }
.dive-track-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.dive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.dive-kpi { margin: 0; border-left: 4px solid var(--line); }
.dive-kpi.met { border-left-color: var(--green); }
.dive-kpi.not_met { border-left-color: var(--amber); }
.dive-kpi-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.dive-kpi-nums b { font-size: 1.8rem; display: block; line-height: 1.15; }
.dive-kpi p { margin: 0.25rem 0; }
.dive-trend.better { color: var(--green); }
.dive-trend.worse { color: var(--red); }
.dive-trendchart { position: relative; width: 100%; }
.dive-trendchart.small { width: 220px; }
.dive-trendchart svg { width: 100%; height: auto; display: block; overflow: visible; }
.dive-trendchart .grid { stroke: #e8eef0; stroke-width: 1; }
.dive-trendchart .tick { fill: var(--muted); font-size: 10px; }
.dive-trendchart .series { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dive-trendchart .pt { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.dive-trendchart .target line { stroke: var(--muted); stroke-width: 1.25; stroke-dasharray: 5 4; }
.dive-trendchart .target text { fill: var(--muted); font-size: 10px; }
.dive-trendchart .hit { fill: transparent; }
.dive-nodata { padding: 0.75rem 0; }
.dive-kpis .nowrap { white-space: nowrap; }
.dive-kpis td:nth-child(1) { min-width: 14rem; }
.dive-kpis select { width: auto; }
.dive-head h2 { max-width: 70ch; }
.dive-trendchart .tick, .dive-trendchart .target text { font-size: 11px; }

/* Program check: drafting the fixes */
.check-draft { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.check-draft .muted { flex: 1; min-width: 260px; }
.check-drafts { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.check-draft-card { margin: 0; border-left: 4px solid var(--brand); }
.check-draft-card .card-head { margin-bottom: 0.25rem; }
.check-made { margin: 0.5rem 0; padding-left: 1.2rem; }
.standards .nowrap { white-space: nowrap; }
