/* Blue Angels HC: navy + gold brand (from the logo). Light by default, dark when the device is in dark mode. */
:root {
  color-scheme: light dark;
  --navy: #0b1f4d; --navy-2: #163378; --gold: #ffd60a; --gold-soft: #fff4b8;
  --bg: #f2f5fb; --card: #fff; --ink: #15203a; --muted: #5b6782; --line: #e0e6f0;
  --brand: #1a4fc9; --btn: #1a4fc9; --btn-ink: #fff; --accent-num: #0b1f4d;
  --th-bg: #f6f8fc; --input-bg: #fff; --input-line: #c6cfde; --hover: #edf2fb; --tag-bg: #e6edfa;
  --ok: #1e7a46; --ok-bg: #e4f4ea; --err: #a12a2a; --err-bg: #fbe9e9; --warn-bg: #fff5d6; --warn-ink: #7a5600;
  --shadow: 0 1px 2px rgba(11, 31, 77, .06), 0 2px 8px rgba(11, 31, 77, .06);
  --radius: 12px;
}
/* Theme: "System" (no data-theme) follows the device; the top-bar switch can force light or dark.
   The dark values appear twice on purpose: once for System-on-a-dark-device, once for a forced Dark. */
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --navy: #071535; --navy-2: #0f2759;
    --bg: #0a1120; --card: #121b2e; --ink: #e6eaf3; --muted: #98a4bc; --line: #24304a;
    --brand: #8cb0ff; --btn: #3a6cf0; --btn-ink: #fff; --accent-num: #ffd60a;
    --th-bg: #0f1829; --input-bg: #0d1526; --input-line: #34425f; --hover: #17223a; --tag-bg: #1b2846;
    --ok: #67d495; --ok-bg: #11301f; --err: #ff8f8f; --err-bg: #3a1618; --warn-bg: #352a0c; --warn-ink: #ffd36b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #071535; --navy-2: #0f2759;
  --bg: #0a1120; --card: #121b2e; --ink: #e6eaf3; --muted: #98a4bc; --line: #24304a;
  --brand: #8cb0ff; --btn: #3a6cf0; --btn-ink: #fff; --accent-num: #ffd60a;
  --th-bg: #0f1829; --input-bg: #0d1526; --input-line: #34425f; --hover: #17223a; --tag-bg: #1b2846;
  --ok: #67d495; --ok-bg: #11301f; --err: #ff8f8f; --err-bg: #3a1618; --warn-bg: #352a0c; --warn-ink: #ffd36b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar + left sidebar menu. "Freeze" (default) keeps both in place while scrolling; "Hide" folds the sidebar away. */
:root { --hdr: 64px; --side: 236px; }
header.top { position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); height: var(--hdr); box-sizing: border-box;
  display: flex; align-items: center; gap: 14px; padding: 6px 18px;
  background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 100%); border-bottom: 3px solid var(--gold); color: #fff; }
header.top .brand { display: flex; align-items: center; background: #fff; border-radius: 10px; padding: 3px 8px;
  box-shadow: 0 0 0 2px rgba(255, 214, 10, .55); }
header.top .brand img { height: 40px; width: auto; display: block; }
.nav-toggle { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .25);
  color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.nav-toggle svg { width: 18px; height: 18px; }
.nav-toggle:hover { background: rgba(255, 255, 255, .16); filter: none; }
header.top .who { display: flex; align-items: center; gap: 14px; margin-left: auto; }
header.top .who a { color: #fff; opacity: .9; }
.who-role { background: rgba(255, 255, 255, .14); color: var(--gold); }
header.top .logout button { color: rgba(255, 255, 255, .7); }
header.top .logout button:hover { color: var(--gold); }
.theme-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 2px; }
.theme-switch button { background: none; border: 0; color: rgba(255, 255, 255, .75); font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.theme-switch button:hover { color: #fff; filter: none; }
.theme-switch button[aria-pressed="true"] { background: var(--gold); color: var(--navy); }
.theme-switch svg { width: 13px; height: 13px; }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; }
.side { position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr)); overflow-y: auto; display: flex; flex-direction: column;
  background: var(--card); border-right: 1px solid var(--line); padding: 10px 8px 0; }
body.sandbox .side { height: calc(100vh - var(--hdr) - 32px); }
.side nav { flex: 1; }
.side-sec { margin-bottom: 6px; }
.side-head { list-style: none; cursor: pointer; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 8px 10px 4px; display: flex; align-items: center; gap: 6px; }
.side-head::-webkit-details-marker { display: none; }
.side-head::before { content: "▸"; font-size: 10px; transition: transform .15s; }
details[open] > .side-head::before { transform: rotate(90deg); }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 6px 36px; border-radius: 8px;
  color: var(--ink); font-weight: 500; }
.side a:hover { background: var(--hover); text-decoration: none; }
.side a.on { background: var(--tag-bg); color: var(--brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
.side-tools { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: 8px; padding: 10px; margin: 0 -8px;
  border-top: 1px solid var(--line); background: var(--card); font-size: 12px; }
.side-tools button { color: var(--muted); font-size: 12px; }
.side-tools button[aria-pressed="true"] { color: var(--brand); font-weight: 700; }
/* hidden menu */
:root[data-nav="hidden"] .shell { grid-template-columns: minmax(0, 1fr); }
:root[data-nav="hidden"] .side { display: none; }
/* not frozen: top bar and menu scroll away with the page */
:root[data-navfreeze="off"] header.top { position: static; }
:root[data-navfreeze="off"] .side { position: static; height: auto; min-height: calc(100vh - var(--hdr)); }
/* phones and narrow windows: the menu slides over the page */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: var(--hdr); bottom: 0; height: auto; width: min(280px, 85vw); box-shadow: 4px 0 20px rgba(0, 0, 0, .25);
    transform: translateX(-105%); transition: transform .2s; }
  :root[data-navopen="1"] .side { transform: none; display: flex; }
  :root[data-nav="hidden"] .side { display: flex; }
  :root[data-navfreeze="off"] .side { position: fixed; height: auto; }
  header.top { padding: 6px 10px; gap: 8px; }
  header.top .brand img { height: 32px; }
  header.top .theme-switch button { padding: 3px 7px; font-size: 0; gap: 0; }
  header.top .theme-switch svg { width: 14px; height: 14px; }
  .who-role, .nav-toggle span { display: none; }
}
/* Jump links (e.g. Settings#axiscare) shouldn't land underneath the frozen bar. */
[id] { scroll-margin-top: 90px; }
.pill { background: var(--gold); color: var(--navy); border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 700; }

/* ---- layout */
main { max-width: 1280px; margin: 0 auto; padding: 22px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 26px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 750; margin-top: 4px; color: var(--accent-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 14px; border-radius: 8px; }
.warn a { color: inherit; text-decoration: underline; }

/* ---- tables */
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--th-bg); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.clickable:hover { background: var(--hover); cursor: pointer; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }

/* ---- forms and buttons */
input, select, textarea { font: inherit; color: var(--ink); padding: 7px 9px; border: 1px solid var(--input-line); border-radius: 7px; background: var(--input-bg); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--btn); }
label { display: block; margin: 8px 0 4px; font-weight: 600; font-size: 13px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 0 12px 0 0; }
button, .btn { font: inherit; font-weight: 600; padding: 7px 15px; border-radius: 8px; border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); cursor: pointer; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button.secondary, .btn.secondary { background: var(--card); color: var(--brand); border-color: var(--brand); }
button.danger { background: var(--card); color: var(--err); border-color: var(--err); }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
.btn.small, button.small { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > div { min-width: 140px; }
form.inline { display: inline; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; }
code { background: var(--tag-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---- reports */
.rpt { max-width: 1100px; margin: 0 auto; }
.rpt-head { text-align: center; margin-bottom: 14px; }
.rpt-head .co { font-size: 18px; font-weight: 700; }
.rpt-head .t { font-size: 16px; }
.rpt-logo { height: 64px; width: auto; display: block; margin: 0 auto 6px; background: #fff; border-radius: 8px; padding: 4px; }
.rpt tr.section td { font-weight: 700; padding-top: 12px; }
.rpt tr.subsection td { font-weight: 600; }
.rpt tr.total td { font-weight: 700; border-top: 1px solid var(--muted); }
.rpt tr.grand td { font-weight: 800; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.rpt td.i1 { padding-left: 24px; } .rpt td.i2 { padding-left: 44px; }
.rpt td.i3 { padding-left: 64px; } .rpt td.i4 { padding-left: 84px; } .rpt td.i5 { padding-left: 104px; }
.rpt tr.parent td { font-weight: 600; }
.rpt tr.subtotal td { font-weight: 600; border-top: 1px solid var(--line); }

/* ---- misc existing pieces */
.rec { border-left: 4px solid var(--gold); }
.rec .why { color: var(--muted); margin: 4px 0 10px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--tag-bg); color: var(--brand); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.bankline { display: grid; grid-template-columns: 22px 100px 1fr 130px; gap: 12px; align-items: start; }
.bankline .amt { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.actions { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.check-ok { color: var(--ok); font-weight: 700; } .check-bad { color: var(--err); font-weight: 700; }
.sticky-bar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 24px; flex-wrap: wrap; align-items: center; box-shadow: 0 -2px 8px rgba(0,0,0,.08); }

/* ---- sign-in page: navy backdrop */
body:has(.login) { background: radial-gradient(circle at 20% 0%, var(--navy-2), var(--navy) 60%); min-height: 100vh; }
.login { max-width: 400px; margin: 70px auto; border-top: 4px solid var(--gold); padding: 24px; }
.login-logo { display: block; margin: 0 auto 10px; width: 200px; max-width: 70%; height: auto; background: #fff; border-radius: 10px; padding: 6px; }
.login button { width: 100%; padding: 9px; }

/* ---- operations workspace */
.hero { position: relative; overflow: hidden; border-radius: 16px; padding: 22px 24px; margin-bottom: 20px; color: #fff;
  background: linear-gradient(115deg, var(--navy) 0%, var(--navy-2) 70%, #2450b0 100%); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  border: 28px solid rgba(255, 214, 10, .18); }
.hero .eyebrow { color: var(--gold); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.hero h1 { color: #fff; font-size: 28px; margin: 4px 0 6px; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; position: relative; z-index: 1; }
.hero .facts b { color: var(--gold); font-size: 20px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.hero .facts a { color: #fff; }
a.ops-tile { color: var(--ink); display: flex; gap: 14px; align-items: flex-start; border-top: 4px solid var(--gold); transition: transform .12s, box-shadow .12s; }
a.ops-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(11, 31, 77, .14); }
.icon-chip { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--navy); color: var(--gold); }
.icon-chip svg { width: 22px; height: 22px; }
.ops-two { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: start; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-title .icon-chip { width: 32px; height: 32px; border-radius: 8px; }
.section-title .icon-chip svg { width: 18px; height: 18px; }
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 13px; }
.subnav a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.subnav a.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.subnav a.on .muted { color: var(--gold); }
.tag.st { text-transform: none; letter-spacing: 0; white-space: nowrap; }
.tag.st-warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.st-bad { background: var(--err-bg); color: var(--err); }
.tag.st-done { background: var(--ok-bg); color: var(--ok); }
td.nowrap { white-space: nowrap; }
td.due { color: var(--err); font-weight: 700; }
.ops-form textarea { white-space: pre-wrap; }
/* to-do list */
button.check { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--input-line);
  background: var(--card); color: transparent; font-size: 14px; line-height: 1; }
button.check:hover { border-color: var(--ok); color: var(--ok); filter: none; }
button.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
tr.is-done td a, tr.is-done td:nth-child(2) { color: var(--muted); text-decoration: line-through; }
.tag.prio-1 { background: var(--err-bg); color: var(--err); }
.tag.prio-2 { background: var(--tag-bg); color: var(--brand); }
.tag.prio-3 { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.todo-add summary { font-size: 15px; }
h2.section-title .btn { font-size: 12px; }
.ops-wording { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ops-wording textarea { width: 100%; }
@media (max-width: 700px) { .ops-wording, .ops-two { grid-template-columns: 1fr; } .hero h1 { font-size: 22px; } }
@media (max-width: 700px) { .bankline { grid-template-columns: 1fr; } .bankline .amt { text-align: left; } }

/* ---- messages */
.msg-convs { padding: 6px; }
.msg-conv { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--ink); }
.msg-conv + .msg-conv { border-top: 1px solid var(--line); }
.msg-conv:hover { background: var(--hover); text-decoration: none; }
.msg-conv.unread b { color: var(--accent-num); }
.msg-conv.unread .msg-conv-preview { color: var(--ink); font-weight: 600; }
.msg-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy-2); color: #fff; font-weight: 700; }
.msg-avatar.group { background: var(--gold); color: var(--navy); border-radius: 10px; }
.msg-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-conv-top { display: flex; align-items: center; gap: 6px; }
.msg-conv-when { margin-left: auto; white-space: nowrap; }
.msg-conv-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-newgroup { display: inline-block; }
.msg-newgroup > summary { list-style: none; }
.msg-newgroup > summary::-webkit-details-marker { display: none; }
.msg-people { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 12px; }
.msg-card { padding: 0; overflow: hidden; max-width: 900px; }
.msg-list { max-height: calc(100vh - 380px); min-height: 220px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg-meta { font-size: 12px; color: var(--muted); margin: 0 4px 2px; }
.msg-bubble { display: inline-block; text-align: left; background: var(--th-bg); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; max-width: 100%; overflow-wrap: anywhere; }
.msg.mine .msg-bubble { background: var(--tag-bg); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.msg-text { white-space: pre-wrap; }
.msg-link, .msg-file { display: block; margin-top: 4px; font-weight: 600; }
.msg-img { display: block; max-width: min(320px, 100%); max-height: 260px; border-radius: 8px; margin-top: 6px; }
.msg-del { margin: 2px 4px 0; }
.msg-del button { font-size: 11px; color: var(--muted); }
.msg-system { align-self: center; font-size: 12px; color: var(--muted); background: var(--th-bg); padding: 2px 10px; border-radius: 999px; }
.msg-empty { margin: auto; }
.msg-compose { border-top: 1px solid var(--line); padding: 12px 16px; background: var(--card); }
.card.msg-compose { border-top: 1px solid var(--line); }
.msg-compose textarea { width: 100%; margin-top: 8px; resize: vertical; }
.msg-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.msg-tools .file-pick { margin: 0; }
.msg-tools .msg-link-input { flex: 1; min-width: 220px; }
.msg-tools button:last-child { margin-left: auto; }
.msg-link-preview { margin-top: 8px; }
.file-names { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 6px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); max-width: 100%; overflow-wrap: anywhere; }
.file-chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; flex: none; }
.file-chip button.link { padding: 0 6px; font-size: 14px; color: var(--muted); }
.file-note { margin-top: 4px; }
.msg-compose.drop-here { outline: 2px dashed var(--gold); outline-offset: -4px; }
a.msg-row { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--brand); font-size: 14px; margin-right: 4px; }
a.msg-row:hover { background: var(--hover); border-color: var(--brand); text-decoration: none; }
a.btn.msg-about { font-size: 13px; padding: 4px 12px; vertical-align: middle; margin-left: 6px; }
@media (max-width: 700px) { .msg { max-width: 92%; } .msg-list { max-height: calc(100vh - 330px); } }

/* ---- calendar */
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.swatch.big { width: 22px; height: 22px; border-radius: 6px; }
.swatch.hatch { background: repeating-linear-gradient(135deg, #94a3b8 0 3px, transparent 3px 6px); border: 1px solid #94a3b8; }
.cal-head { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h1 { margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { margin: 0 0 0 8px; font-size: 18px; }
.cal-arrow { padding: 7px 12px; }
.cal-views { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); margin-left: auto; }
.cal-views a { padding: 5px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.cal-views a.on { background: var(--navy-2); color: #fff; }
.cal-views a:hover { text-decoration: none; }
.cal-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; align-items: start; }
.cal-side { position: sticky; top: 120px; }
.cal-toggle { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 13px; cursor: pointer; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-wd { padding: 6px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: var(--th-bg); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 112px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--th-bg); }
.cal-cell.other .cal-daynum { color: var(--muted); }
.cal-cell-top { display: flex; justify-content: space-between; align-items: center; }
.cal-daynum { font-weight: 700; font-size: 13px; color: var(--ink); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-daynum, .cal-col.today .cal-col-head b { background: var(--gold); color: var(--navy); }
.cal-add { color: var(--muted); font-weight: 700; padding: 0 6px; border-radius: 6px; opacity: 0; }
.cal-cell:hover .cal-add, .cal-col:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-add:hover { background: var(--hover); text-decoration: none; }
.cal-chip { display: block; font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; color: var(--ink);
  background: color-mix(in srgb, var(--c) 16%, var(--card)); border-left: 3px solid var(--c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { text-decoration: none; filter: brightness(.97); }
.cal-chip.allday { background: var(--c); color: #fff; border-left-color: transparent; }
.cal-chip .t { font-weight: 700; color: var(--muted); }
.cal-chip.k-ooo { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--card)) 0 6px, var(--card) 6px 12px);
  color: var(--ink); border: 1px dashed var(--c); }
.cal-chip.k-closed { background: var(--err); color: #fff; }
.cal-chip.k-visit { border-left-color: #0d9488; }
.cal-chip.k-visit.late { border-left-color: var(--err); background: var(--err-bg); }
.cal-chip.k-visit.open { border: 1px dashed #0d9488; background: var(--card); }
.cal-visits { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cal-chip.k-work { background: transparent; color: var(--warn-ink); border: 1px solid var(--line); border-left: 3px solid var(--c); }
.cal-chip.k-deadline::before { content: "⚑ "; }
.cal-chip.tentative { background: var(--card); border: 1px dashed var(--c); color: var(--ink); }
.cal-chip.declined { text-decoration: line-through; opacity: .6; }
.cal-chip[hidden], .cal-agenda-row[hidden], .cal-days[hidden], .cal-form .cal-until[hidden], .cal-time[hidden] { display: none; }
.cal-form .not-todo[hidden], .cal-form .todo-only[hidden] { display: none !important; }
.todo-days[hidden], .todo-until[hidden] { display: none !important; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-week.one { grid-template-columns: minmax(0, 720px); }
.cal-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 320px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0; box-shadow: var(--shadow); }
.cal-col-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.cal-col-head a { color: var(--ink); }
.cal-col-head b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.cal-timed { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.cal-week:not(.one) .cal-chip { white-space: normal; }
.cal-slots { display: flex; flex-direction: column; margin-top: 10px; border-top: 1px solid var(--line); }
.cal-slots a { padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; }
.cal-slots a span { opacity: 0; color: var(--brand); }
.cal-slots a:hover { background: var(--hover); text-decoration: none; }
.cal-slots a:hover span { opacity: 1; }
.cal-agenda-day { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cal-agenda-day:last-child { border-bottom: 0; }
.cal-agenda-date { width: 56px; flex: none; text-align: center; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; }
.cal-agenda-date b { font-size: 22px; color: var(--ink); line-height: 1.1; }
.cal-agenda-day.today .cal-agenda-date b { color: var(--accent-num); }
.cal-agenda-day > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-agenda-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-agenda-row .cal-chip { flex: 0 1 auto; max-width: 100%; }
.cal-agenda-time { width: 140px; flex: none; }
.cal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.cal-grid select, .cal-grid input:not([type=checkbox]) { max-width: 100%; }
.cal-form label { display: block; }
.cal-form label.inline, .cal-form .msg-people label { display: inline-flex; }
.cal-form > label { margin-bottom: 10px; }
.cal-days { margin: -2px 0 10px; }
.cal-rsvp { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 860px; border-left: 4px solid var(--gold); }
.cal-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-colors label { cursor: pointer; }
.cal-colors input { position: absolute; opacity: 0; }
.cal-colors input:checked + .swatch { outline: 3px solid var(--ink); outline-offset: 1px; }
.cal-colors input:focus-visible + .swatch { outline: 3px solid var(--gold); }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-col { min-height: 0; }
  .cal-views { margin-left: 0; }
}
@media (max-width: 700px) {
  .cal-cell { min-height: 74px; padding: 2px; }
  .cal-chip { font-size: 10px; padding: 1px 3px; }
  .cal-chip .t { display: none; }
  .cal-grid { grid-template-columns: 1fr; }
  .cal-agenda-time { width: auto; }
}

/* ---- billing */
.bill-totals .big { font-size: 24px; font-weight: 800; color: var(--accent-num); }
.bill-totals .warn-num { color: var(--warn-ink); }
.bill-group > summary { display: flex; align-items: center; gap: 10px; }
.bill-amt { margin-left: auto; font-weight: 800; font-size: 16px; }

/* ---- users & access */
.access-card { max-width: 1100px; }
.access-head { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.access-head h2 { margin: 0; flex: 1; min-width: 200px; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.access-sec { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.access-sec legend { font-weight: 700; padding: 0 4px; }

/* ---- AxisCare today (overview) */
.ax-today h2 { display: flex; align-items: center; gap: 8px; }
.ax-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ax-stats > div { background: var(--th-bg); border-radius: 10px; padding: 10px; text-align: center; }
.ax-stats b { display: block; font-size: 24px; color: var(--accent-num); }
.ax-stats span { font-size: 12px; color: var(--muted); }
.ax-stats .bad b { color: var(--err); }
.ax-stats .warn b { color: var(--warn-ink); }
@media (max-width: 700px) { .ax-stats { grid-template-columns: repeat(3, 1fr); } }

/* ---- AxisCare lookup */
.lookup-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; max-width: 900px; }
.lookup-form input { flex: 1; min-width: 240px; font-size: 15px; }
.lookup-table td { vertical-align: top; }

/* ---- help */
.help-search { max-width: 1100px; padding: 10px; }
.help-search input { width: 100%; font-size: 15px; }
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1100px; }
.help-toc { position: sticky; top: calc(var(--hdr) + 12px); display: flex; flex-direction: column; gap: 2px; }
.help-toc a { padding: 4px 6px; border-radius: 6px; }
.help-toc a:hover { background: var(--hover); text-decoration: none; }
.help-topic h2 { margin-top: 0; }
.help-topic li { margin-bottom: 6px; }
.help-topic[hidden] { display: none; }
.side-help { margin-top: 8px; padding-left: 10px !important; border-top: 1px solid var(--line); border-radius: 0 !important; }
header.top .help-link { color: var(--gold) !important; font-weight: 700; }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } header.top .help-link { display: none; } }

/* ---- list filters and sorting */
tr.filter-row th { background: var(--card); padding: 4px 6px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.filter-input { width: 100%; min-width: 90px; font-size: 12px; padding: 4px 6px; }
.sort-input { margin-top: 4px; }
th.sortable:not([data-dir])::after { content: " ⇅"; font-size: 10px; opacity: .4; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--brand); }
th.sortable[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
th.sortable[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.filter-info { margin: 6px 2px 14px; }
tr[hidden] { display: none; }

/* ---- personnel */
.hr-bar { display: inline-block; width: 120px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.hr-bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.hr-bar.small-bar { width: 80px; margin-left: 8px; }
.hr-stage { display: flex; gap: 12px 24px; flex-wrap: wrap; align-items: end; max-width: 980px; border-left: 4px solid var(--gold); }
.hr-grid4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hr-address { display: grid; grid-template-columns: 2fr 1fr 1.3fr auto auto; gap: 12px; }
.hr-address input { width: 100%; }
@media (max-width: 700px) { .hr-address { grid-template-columns: 1fr 1fr; } }
.hr-files-add { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 10px 0; }
.hr-file-row { align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.hr-file-row select { min-width: 220px; }
.hr-file-row input[type=file] { max-width: 100%; }
.hr-file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
button.link.danger-text { color: #c92a2a; }
.top-search { flex: 1 1 260px; max-width: 460px; margin: 0 12px; position: relative; display: flex; align-items: center; }.top-search svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.top-search input { width: 100%; padding: 7px 10px 7px 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
@media (max-width: 700px) { .top-search { flex: 1 1 90px; min-width: 0; margin: 0 4px; } .top-search input { padding-left: 28px; } }
.search-group { margin-bottom: 12px; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.search-results li:last-child { border-bottom: 0; }
.email-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 4px; }
.esign-picks { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.hr-section { max-width: 980px; }
.hr-section > summary { display: flex; align-items: center; gap: 8px; }
.hr-table td { vertical-align: middle; }
.hr-table td:first-child { width: 32%; }
.hr-table label { display: block; margin: 0; }
.hr-table input[type=date] { width: 140px; }
.hr-note { width: 100%; }
.hr-table tr.hr-done td:first-child { color: var(--muted); }
.hr-table tr.hr-expired td { background: var(--err-bg); }
.hr-state { min-width: 150px; }
.hr-collins { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; }
.hr-table th { font-size: 11px; }
.hr-save { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; max-width: 980px; }
@media (max-width: 700px) {
  .hr-table, .hr-table tbody, .hr-table tr, .hr-table td { display: block; width: auto !important; }
  .hr-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .hr-table td { border: 0; padding: 2px 8px; }
}

/* ---- print: always light, no chrome */
@media print {
  :root:not([data-theme="none"]), :root[data-theme] { color-scheme: light; --bg: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #ccc; --th-bg: #fff; --brand: #000; }
  header.top, .side, .no-print, .flash, .hero::after { display: none !important; }
  .shell { display: block; }
  body { background: #fff; } main { padding: 0; } .table-wrap { border: 0; box-shadow: none; }
  .card { border: 0; padding: 0; box-shadow: none; }
}

/* Sandbox copy: an unmistakable stripe on every page (also printed, so test reports can't pass for real ones) */
.sandbox-banner { background: repeating-linear-gradient(135deg, #e8590c 0 14px, #d9480f 14px 28px); color: #fff;
  font-weight: 700; letter-spacing: .02em; text-align: center; padding: 6px 16px; font-size: 14px; }
body.sandbox header.top { top: 0; border-top: 4px solid #e8590c; }
.demo-banner { background: repeating-linear-gradient(135deg, #0f766e 0 14px, #0d6b63 14px 28px); }
body.sandbox:has(.demo-banner) header.top { border-top-color: #0f766e; }
@media print { .sandbox-banner { background: none; color: #000; border: 2px solid #000; } }

.err-text { color: #b42318; }
:root[data-theme="dark"] .err-text { color: #ff8a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err-text { color: #ff8a80; } }

/* Type-to-filter dropdowns (select[data-filter]) */
.fsel { position: relative; display: inline-block; min-width: 280px; max-width: 100%; vertical-align: middle; }
.fsel-input { width: 100%; padding-right: 26px; }
.fsel::after { content: "▾"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.fsel-input.fsel-missing { border-color: #b42318; }
.fsel-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none;
  max-height: 300px; overflow-y: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 7px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); min-width: 100%; width: max-content; max-width: min(520px, 90vw); }
.fsel-list li { padding: 6px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsel-list li.active { background: var(--btn); color: var(--btn-ink); }
.fsel-list li.fsel-none { color: var(--muted); cursor: default; }
.fsel-list mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.fsel-list li.active mark { color: inherit; }

/* Expenses overview */
.exp-actions { gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.exp-top { display: grid; gap: 16px; grid-template-columns: minmax(280px, 1fr) minmax(320px, 2fr); margin-bottom: 16px; }
@media (max-width: 900px) { .exp-top { grid-template-columns: 1fr; } }
.exp-h { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.exp-sub { margin: 0 0 8px; font-size: 14px; }
.exp-table { width: 100%; border-collapse: collapse; }
.exp-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.exp-table tr:last-child td { border-bottom: 0; }
.exp-glance { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.exp-glance .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.exp-glance .value { font-size: 24px; font-weight: 750; margin: 4px 0 2px; color: var(--accent-num); font-variant-numeric: tabular-nums; }
.exp-glance .exp-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-up { color: #c2410c; } .exp-down { color: #15803d; }
:root[data-theme="dark"] .exp-up { color: #fb923c; } :root[data-theme="dark"] .exp-down { color: #4ade80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .exp-up { color: #fb923c; } :root:not([data-theme="light"]) .exp-down { color: #4ade80; } }
.exp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.exp-tabs { gap: 4px; }
.exp-tabs a { padding: 4px 10px; border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--muted); border: 1px solid var(--line); }
.exp-tabs a.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.exp-chart { display: flex; gap: 10px; align-items: flex-end; height: 230px; padding: 8px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.exp-month { flex: 1 1 0; min-width: 44px; display: flex; flex-direction: column; align-items: center; height: 100%; text-decoration: none; color: var(--ink); }
.exp-month:hover .exp-bar.this { filter: brightness(1.15); }
.exp-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.exp-bar { display: block; width: min(38%, 46px); min-height: 2px; border-radius: 4px 4px 0 0; }
.exp-bar.this { background: var(--btn); }
.exp-bar.this.future { opacity: .35; }
.exp-bar.last { background: var(--line); }
.exp-month-label { font-size: 12px; font-weight: 600; margin-top: 6px; }
.exp-month-amt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.exp-legend { margin-top: 8px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; vertical-align: middle; }
.exp-legend .dot.this { background: var(--btn); } .exp-legend .dot.last { background: var(--line); margin-left: 10px; }
.exp-insights { display: grid; gap: 24px; grid-template-columns: minmax(300px, 1.2fr) minmax(280px, 1fr); }
@media (max-width: 900px) { .exp-insights { grid-template-columns: 1fr; } }
.exp-donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.exp-donut { width: 170px; height: 170px; flex: none; }
.exp-ring { stroke: var(--line); }
.exp-donut-total { font-size: 5px; font-weight: 750; fill: var(--ink); }
.exp-donut-sub { font-size: 3px; fill: var(--muted); }
.exp-keys { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px; }
.exp-keys li { padding: 4px 0; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.exp-c0 { stroke: #1a4fc9; } .exp-c1 { stroke: #0d9488; } .exp-c2 { stroke: #d97706; } .exp-c3 { stroke: #7c3aed; } .exp-c4 { stroke: #db2777; } .exp-c5 { stroke: #64748b; }
.exp-bg0 { background: #1a4fc9; } .exp-bg1 { background: #0d9488; } .exp-bg2 { background: #d97706; } .exp-bg3 { background: #7c3aed; } .exp-bg4 { background: #db2777; } .exp-bg5 { background: #64748b; }
:root[data-theme="dark"] .exp-c0 { stroke: #6f9bff; } :root[data-theme="dark"] .exp-bg0 { background: #6f9bff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .exp-c0 { stroke: #6f9bff; } :root:not([data-theme="light"]) .exp-bg0 { background: #6f9bff; } }

/* Document viewer (viewer.js) */
html.dv-open, html.dv-open body { overflow: hidden; }
.dv { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: rgba(8, 14, 28, .94); }
.dv[hidden] { display: none; }
.dv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top)); background: var(--navy); color: #fff; }
.dv-title { min-width: 0; flex: 1 1 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-pages { opacity: .75; margin-left: 6px; }
.dv-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dv-tools .btn, .dv-tools button { padding: 5px 10px; font-size: 13px; }
.dv-pct { min-width: 42px; text-align: center; opacity: .85; }
.dv-close { background: var(--gold); color: #15203a; border: 0; font-weight: 700; }
.dv-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; outline: none;
  -webkit-overflow-scrolling: touch; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.dv-page { background: #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .45); flex: none; max-width: none; }
.dv-page canvas { display: block; }
.dv-img { max-width: none; width: 100%; height: auto; background: #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
.dv-msg { color: #e6eaf3; margin: 40px auto; max-width: 520px; text-align: center; line-height: 1.5; }
@media (max-width: 600px) { .dv-body { padding: 8px; } .dv-tools .dv-tab { display: none; } }

/* Bank Review: Needs Further Review */
.bank-tabs a.on { font-weight: 700; text-decoration: none; }
.hold-note { border-left: 4px solid var(--gold); padding-left: 10px; justify-content: space-between; }
.bank-held { border-left: 4px solid var(--gold); }
.hold-box { margin-top: 6px; }
.hold-box summary { cursor: pointer; color: var(--muted); }

/* Bank Review: match candidates */
.match-others { margin: 4px 0 2px; }
.match-others summary { cursor: pointer; color: var(--muted); }
.match-choice { padding-left: 14px; border-left: 3px solid var(--line); margin-left: 4px; }

/* Payroll review: long check notes wrap so the table fits */
#payroll-form td .tag { white-space: normal; display: inline-block; max-width: 340px; line-height: 1.35; }

/* Payroll: final paycheck */
.final-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; align-items: end; }
.final-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.final-due { border-left: 4px solid var(--gold); padding: 8px 12px; background: var(--hover); border-radius: 0 8px 8px 0; }
.final-due.final-late { border-left-color: #c2410c; }
.ax-fix { margin-top: 4px; font-size: 12px; padding: 3px 8px; }
input.ax-fixed { outline: 2px solid var(--gold); }

/* Chat: reactions, replies, pinned and sections */
.msg-actions { display: flex; gap: 10px; align-items: center; margin-top: 2px; opacity: .75; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg.mine .msg-actions { justify-content: flex-end; }
.msg-actions form { margin: 0; }
.msg-react-pick { position: relative; }
.msg-react-pick summary { list-style: none; cursor: pointer; color: var(--muted); }
.msg-react-pick summary::-webkit-details-marker { display: none; }
.msg-react-menu { position: absolute; z-index: 20; bottom: 100%; left: 0; display: flex; gap: 2px; padding: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); white-space: nowrap; }
.msg.mine .msg-react-menu { left: auto; right: 0; }
.msg-react-menu form { margin: 0; }
.msg-react-choice { background: none; border: 0; font-size: 20px; line-height: 1; padding: 4px 5px; cursor: pointer; border-radius: 8px; }
.msg-react-choice:hover, .msg-react-choice:focus-visible { background: var(--hover); transform: scale(1.15); }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg.mine .msg-reacts { justify-content: flex-end; }
.msg-reacts form { margin: 0; }
.msg-react { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; cursor: pointer; }
.msg-react span { font-size: 12px; color: var(--muted); }
.msg-react.by-me { border-color: var(--btn); background: var(--tag-bg); }
.msg-react.by-me span { color: var(--brand); font-weight: 700; }
.msg-quote { display: block; border-left: 3px solid var(--gold); padding: 2px 8px; margin-bottom: 6px; border-radius: 4px;
  background: var(--hover); color: var(--ink); font-size: 13px; text-decoration: none; }
.msg-quote span { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.msg-replying { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-left: 3px solid var(--gold);
  padding: 4px 8px; margin-bottom: 6px; background: var(--hover); border-radius: 4px; }
.msg-replying[hidden] { display: none; }
.msg-replying-text { color: var(--muted); }
.msg-flash { animation: msg-flash 1.6s ease; }
@keyframes msg-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold); border-radius: 12px; } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .msg-flash { animation: none; outline: 2px solid var(--gold); } }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg-head form { margin: 0; }
.msg-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.msg-convs[hidden] { display: none; }
.msg-conv-row { display: flex; align-items: center; gap: 4px; }
.msg-conv-row[hidden] { display: none; }
.msg-conv-row .msg-conv { flex: 1; min-width: 0; }
.msg-conv-row + .msg-conv-row { border-top: 1px solid var(--line); }
.msg-conv-row .msg-conv + .msg-conv { border-top: 0; }
.msg-pin { margin: 0; }
.msg-pin button { opacity: .3; font-size: 16px; padding: 6px; filter: grayscale(1); }
.msg-pin button.on, .msg-conv-row:hover .msg-pin button { opacity: 1; filter: none; }
.msg-search { margin-bottom: 10px; }
.msg-search input { width: 100%; max-width: 420px; }
.sec-list { display: grid; gap: 6px; }
.sec-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sec-row form { margin: 0; }
.sec-rename input { width: 220px; max-width: 100%; }
.danger-link { color: #b42318; }
:root[data-theme="dark"] .danger-link { color: #ff8a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .danger-link { color: #ff8a80; } }

/* Chat: @mentions */
.mention { color: var(--brand); font-weight: 650; }
.mention-me { background: var(--gold-soft); color: #15203a; border-radius: 4px; padding: 0 3px; }
:root[data-theme="dark"] .mention-me { background: var(--gold); color: #15203a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mention-me { background: var(--gold); color: #15203a; } }
.msg-compose { position: relative; }
.mention-menu { position: absolute; z-index: 30; left: 8px; bottom: calc(100% - 4px); margin: 0; padding: 4px 0; list-style: none; min-width: 240px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.mention-menu[hidden] { display: none; }
.mention-menu li { padding: 6px 12px; cursor: pointer; }
.mention-menu li span { color: var(--muted); font-size: 13px; }
.mention-menu li.active { background: var(--btn); color: var(--btn-ink); }
.mention-menu li.active span { color: var(--btn-ink); }

/* Leads */
.lead-form h2.lead-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }
.lead-form h2.lead-h:first-of-type { margin-top: 0; }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; align-items: end; }
.lead-grid label, .lead-form > label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.lead-form > label { margin-top: 10px; }
.lead-grid input, .lead-grid select, .lead-form textarea, .lead-form > label input { width: 100%; font-weight: 400; }
.lead-grid .span2 { grid-column: span 2; }
@media (max-width: 600px) { .lead-grid .span2 { grid-column: auto; } }
.lead-addr { margin-top: 10px; }
.lead-check span:last-child { font-weight: 400; padding: 8px 0; }
.lead-services { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.lead-summary { margin-bottom: 14px; }
.lead-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
.lead-facts .label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.lead-notes { margin-bottom: 14px; }
.lead-note-form textarea { width: 100%; }
.lead-note { border-top: 1px solid var(--line); padding: 8px 0; }
.lead-note:first-of-type { margin-top: 10px; }

/* Billing: invoices */
.inv-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.inv-lines input { width: 100%; }
.inv-lines td { vertical-align: middle; }
.inv-email { white-space: pre-wrap; font-family: inherit; font-size: 14px; background: var(--hover); padding: 12px; border-radius: 8px; }

/* Billing → Private Insurance */
.warn-text { color: var(--warn-ink); font-weight: 600; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; margin: 6px 0 12px; }
.check-grid label { display: flex; gap: 6px; align-items: baseline; }
.inline-edit { display: inline-block; }
.inline-edit[open] { display: block; min-width: 320px; }
.ins-tabs a.on { font-weight: 700; }

/* Bank Review: filters and bulk actions */
.bank-filter { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.bank-filter label { display: flex; flex-direction: column; font-size: 12px; gap: 3px; }
.bank-filter input[name=q] { min-width: 220px; }
.bank-filter .bf-found { flex-basis: 100%; margin: 2px 0 0; }
.bulk-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; border: 1px solid var(--accent, #b8861b); }
.bulk-bar label:not(.inline) { display: flex; flex-direction: column; font-size: 12px; gap: 3px; }
.bulk-bar .bulk-add { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulk-bar .bulk-add[hidden], .bulk-bar .bulk-hold[hidden] { display: none; }
.bankline .bulk-tick { margin-top: 3px; width: 16px; height: 16px; }

/* Bank Review ↔ Subscriptions */
.sub-tag { text-decoration: none; margin-left: 6px; }
.sub-box .actions label { display: inline-flex; flex-direction: column; gap: 2px; }
.sub-box .actions label[hidden] { display: none; }

/* Prior authorizations ending: the pop-up after signing in */
.auth-popup { max-width: min(760px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--warn-ink); border-radius: 12px;
  background: var(--card, #fff); color: inherit; padding: 18px 20px; max-height: 85vh; overflow: auto; }
.auth-popup::backdrop { background: rgba(10, 20, 40, .55); }

/* Chat: #client / #employee tags, and the notes history on their pages */
.msg-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--tag-bg); text-decoration: none; }
.msg-tags-picked { margin: 2px 0 6px; color: var(--muted); }
.chat-notes .chat-note { border-top: 1px solid var(--line); padding: 8px 0; }
.chat-notes .chat-note:first-of-type { border-top: 0; }
.chat-notes .chat-note-text { white-space: pre-wrap; margin-top: 2px; }

/* A client's month calendar (live from AxisCare), colored like AxisCare */
.ccal { table-layout: fixed; min-width: 900px; }
.ccal th { text-align: center; }
.ccal td { vertical-align: top; height: 92px; padding: 4px; border: 1px solid var(--line); }
.ccal td.out { background: var(--hover); opacity: .65; }
.ccal td.today { box-shadow: inset 0 0 0 2px var(--gold); }
.ccal-date { text-align: right; font-size: 13px; margin-bottom: 3px; }
.ccal-wk { width: 130px; background: var(--th-bg); }
.ccal-visit { border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; font-size: 12px; line-height: 1.3; color: #14203a; border: 1px solid rgba(0,0,0,.08); }
.ccal-visit.st-verified { background: #20e070; }
.ccal-visit.st-completed { background: #b9efb0; }
.ccal-visit.st-scheduled { background: #cfdaf0; }
.ccal-visit.st-in_progress { background: #f5e44a; }
.ccal-visit.st-unassigned { background: #f58ef0; }
.ccal-visit.st-missed { background: #c9504a; color: #fff; }
.ccal-visit.st-removed { background: #d9d9d9; color: #555; text-decoration: line-through; }
.ccal-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ccal-legend .ccal-visit { margin: 0; }
.ccal-visit.can-edit { cursor: pointer; display: block; width: 100%; text-align: left; font: inherit; font-size: 12px; }
.ccal-visit.can-edit:hover, .ccal-visit.can-edit:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ccal-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin: 14px 0; }
.ccal-forms form label, .ccal-dialog label { display: block; margin-bottom: 8px; }
.ccal-forms .two, .ccal-dialog .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ccal-days { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.ccal-days label { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.ccal-dialog { max-width: min(460px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--card, #fff); color: inherit; }
.ccal-dialog::backdrop { background: rgba(10, 20, 40, .55); }
.bill-shifts { margin: 10px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
.bill-shifts > summary { font-weight: 400; }
.bill-shifts .total-row td { border-top: 2px solid var(--line); }
.auth-update > summary { white-space: nowrap; }
.auth-update[open] .auth-update-box { min-width: 340px; padding: 8px 0; }
.auth-update-box .row { flex-direction: column; align-items: flex-start !important; gap: 10px !important; }
.auth-update-box form.row { flex-direction: row; flex-wrap: wrap; }

/* Chat: reply threads (replies sit under the message they answer, collapsed to "💬 N replies") */
.msg-group { display: flex; flex-direction: column; gap: 4px; }
.msg-group > .msg { align-self: flex-start; }
.msg-group.mine > .msg { align-self: flex-end; }
.msg-thread { align-self: flex-start; max-width: 78%; min-width: min(360px, 100%); margin-left: 14px; padding-left: 10px;
  border-left: 2px solid var(--line); }
.msg-group.mine .msg-thread { align-self: flex-end; margin-left: 0; margin-right: 14px; padding-left: 0; padding-right: 10px;
  border-left: 0; border-right: 2px solid var(--line); }
.msg-thread > summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 2px 0; list-style: none; }
.msg-thread > summary::-webkit-details-marker { display: none; }
.msg-thread > summary .muted { font-weight: 400; }
.msg-thread > summary.msg-thread-new::after { content: " ● new"; color: var(--gold); font-size: 12px; }
.msg-thread[open] { border-color: var(--gold); }
.msg-thread-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.msg-thread-list > .msg { max-width: 100%; }
.msg-thread-slot { margin-top: 6px; text-align: left; }
.msg-thread-compose { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: left; }
.msg-thread-compose textarea { margin-top: 0; }
@media (max-width: 700px) { .msg-thread { max-width: 96%; margin-left: 6px; } .msg-group.mine .msg-thread { margin-right: 6px; } }
/* Wide screens: an open thread shows in a column to the right of the conversation (chat.js) */
.chat-thread-pane { display: none; }
@media (min-width: 1100px) {
  .chat-body.pane-open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 14px; align-items: start; }
  .chat-body.pane-open > .msg-card { margin: 0; }
  .chat-body.pane-open > .chat-thread-pane { display: flex; flex-direction: column; padding: 0; margin: 0; overflow: hidden; }
  .chat-thread-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .chat-thread-close { font-size: 18px; line-height: 1; padding: 2px 6px; color: var(--muted); text-decoration: none; }
  .chat-thread-scroll { overflow-y: auto; max-height: calc(100vh - 250px); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
  .chat-thread-root { padding-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
  .chat-thread-root > .msg { max-width: 100%; }
  .chat-thread-body .msg-thread-list { margin-top: 0; }
  .chat-thread-body .msg-thread-slot { margin-top: 10px; }
  .msg-thread.in-pane { border-color: var(--gold); }
  .msg-thread.in-pane > summary { text-decoration: underline; }
}

/* Client / employee profile: tabs and the Notes tab */
.profile-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 14px; flex-wrap: wrap; }
.profile-tabs a { padding: 8px 16px; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; margin-bottom: -2px;
  border-bottom: 2px solid transparent; }
.profile-tabs a:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.profile-tabs a.on { color: var(--brand); border-bottom-color: var(--gold); background: var(--card); }
.pill-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--tag-bg); color: var(--brand);
  font-size: 12px; text-align: center; }
.important-notes { border-left: 4px solid var(--gold); }
.important-notes .small { margin-top: 4px; }
/* Client page → Personal Profile (from ChartHearth, read only) */
.profile-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; margin: 10px 0 0; }
.profile-facts dt { font-size: .78rem; color: var(--muted); margin: 0; }
.profile-facts dd { margin: 0; }
.profile-medical { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; margin-top: 4px; }
.profile-section { font-size: 14px; color: var(--brand); margin: 14px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
/* A card's title row: the heading, any tags, and its actions on the right */
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head-note, .card-head-end { margin-left: auto; }
/* Edit inside a card (client page): Edit shows the form in place of the read-only view */
[data-editable] .edit-mode { display: none; }
[data-editable].editing .edit-mode { display: block; }
[data-editable].editing .view-mode { display: none; }
[data-editable].editing { border-color: var(--brand); }
[data-editable] .edit-mode > input[name], [data-editable] .edit-mode > textarea { width: 100%; box-sizing: border-box; }
[data-editable] h3 { font-size: 14px; margin: 14px 0 6px; color: var(--brand); }
.ops-two > [data-editable].editing { grid-column: 1 / -1; }
.paperwork { list-style: none; margin: 0; padding: 0; }
.paperwork li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.paperwork li:first-child { border-top: 0; }
.address-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.address-fields .span2 { grid-column: span 2; }
.address-fields input { width: 100%; box-sizing: border-box; }
@media (max-width: 560px) { .address-fields { grid-template-columns: 1fr 1fr; } .address-fields .span2 { grid-column: 1 / -1; } }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px 28px; }
.settings-section h3, #client-settings h3 { font-size: 14px; margin: 0 0 8px; color: var(--brand); }
#client-settings #portal { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
/* A client's Documents tab: the forms to sign */
.form-adds .form-add { gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.note-add { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--hover); margin-bottom: 12px; }
.note-add-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-add-head b { font-size: 17px; margin-right: auto; }
.note-add textarea { width: 100%; margin-top: 10px; resize: vertical; }
.note-when { align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.note-when label { font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .switch-track { background: var(--gold); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--btn); outline-offset: 2px; }
.note-filter { margin: 4px 0 8px; text-align: right; }
.profile-note { border-top: 1px solid var(--line); padding: 10px 2px; }
.profile-note.important { border-left: 4px solid var(--gold); padding-left: 10px; background: var(--hover); }
.note-actions { float: right; }
.note-actions form { margin: 0 0 0 8px; }

/* Initial Assessment & Care Plan */
.asmt-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--line); margin: 8px 0 12px; position: sticky; top: 0;
  background: var(--bg); z-index: 5; scrollbar-width: thin; }
.asmt-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 12px; color: var(--muted); font-weight: 600;
  white-space: nowrap; cursor: pointer; margin-bottom: -2px; border-radius: 6px 6px 0 0; }
.asmt-tab:hover { background: var(--hover); color: var(--ink); }
.asmt-tab.on { color: var(--brand); border-bottom-color: var(--gold); background: var(--card); }
.asmt-panel { max-width: 1000px; }
.asmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; align-items: start; }
.asmt-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0; }
.asmt-f input, .asmt-f select, .asmt-f textarea { font-weight: 400; color: var(--ink); width: 100%; }
.asmt-wide, .asmt-h { grid-column: 1 / -1; }
.asmt-h { margin: 10px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 14px; text-transform: uppercase;
  letter-spacing: .03em; color: var(--brand); }
fieldset.asmt-f { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; }
fieldset.asmt-f legend { padding: 0 4px; }
.asmt-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 14px; }
.asmt-checks legend { grid-column: 1 / -1; }
.asmt-checks label, .asmt-yn label { font-weight: 400; color: var(--ink); display: flex; gap: 6px; align-items: flex-start; }
.asmt-yn { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
.asmt-adl td, .asmt-adl th { text-align: center; }
.asmt-adl td:first-child, .asmt-adl th:first-child { text-align: left; }
.asmt-legal p { margin: 6px 0; }
.asmt-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; max-width: 1000px; box-shadow: 0 -4px 14px rgba(0,0,0,.08); z-index: 5; }
.asmt-bar a { margin-left: auto; }
.asmt-unsaved { color: var(--gold); font-weight: 600; }
.asmt-sign { max-width: 1000px; margin-top: 12px; }
.asmt-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 12px; }
.asmt-f[hidden] { display: none; }
.asmt-way { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sig-pad { margin: 8px 0; }
.sig-pad canvas { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 160; background: #fff; border: 1px dashed var(--muted);
  border-radius: 8px; touch-action: none; display: block; cursor: crosshair; }
/* the @ list in a note box: anchored to the box, just under the text you're typing */
.note-add { position: relative; }
.note-add .mention-menu { bottom: auto; top: auto; left: 14px; margin-top: 2px; }

/* Cash Flow forecast chart (server-drawn SVG) */
.cash-chart svg text { font-size: 11px; }
.cf-grid { stroke: var(--line); stroke-width: 1; }
.cf-axis { fill: var(--muted); }
.cf-zero { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.cf-min { stroke: var(--err); stroke-width: 1.5; stroke-dasharray: 6 4; }
.cf-min-label { fill: var(--err); }
.cf-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cf-pay { fill: var(--warn-ink); stroke: var(--card); stroke-width: 2; }
.cf-low { fill: var(--err); stroke: var(--card); stroke-width: 2; }
.cf-hit { fill: transparent; }
.cf-hit:hover { fill: var(--hover); opacity: .35; }
.cf-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.cf-key-pay { background: var(--warn-ink); }
.cf-key-low { background: var(--err); }
.cf-row-short td { background: var(--err-bg); }
.ok-box { background: var(--ok-bg); color: var(--ok); }

/* Two-step sign-in setup: the QR code to scan */
.mfa-qr svg { width: 240px; max-width: 100%; height: auto; aspect-ratio: 1; background: #fff; border-radius: 8px; display: block; margin: 6px 0 10px; }

/* Bank Review: a deposit that pays open insurance / Medicaid claims exactly */
.claim-hit { color: var(--ok); flex-basis: 100%; }

/* Ask the Books: chat panel on every page */
.ask-btn { position: fixed; right: 16px; bottom: 16px; z-index: 900; border-radius: 999px; padding: 10px 16px;
  background: var(--btn); color: var(--btn-ink); box-shadow: var(--shadow); font-weight: 600; }
.ask-panel { position: fixed; right: 16px; bottom: 64px; z-index: 901; width: 400px; max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 96px)); display: flex; flex-direction: column; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.ask-panel[hidden] { display: none; }
.ask-panel header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ask-panel header span { display: flex; gap: 6px; }
.ask-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ask-msg { padding: 8px 10px; border-radius: 10px; max-width: 92%; overflow-wrap: anywhere; }
.ask-msg p { margin: 0 0 6px; } .ask-msg p:last-child { margin-bottom: 0; }
.ask-msg ul, .ask-msg ol { margin: 4px 0 6px 18px; padding: 0; }
.ask-msg table { font-size: 13px; margin: 4px 0; } .ask-msg th, .ask-msg td { padding: 2px 6px; }
.ask-user { align-self: flex-end; background: var(--tag-bg); }
.ask-assistant { align-self: flex-start; background: var(--th-bg); border: 1px solid var(--line); }
.ask-note { align-self: center; color: var(--muted); font-size: 13px; text-align: center; }
.ask-error { align-self: flex-start; background: var(--err-bg); color: var(--err); }
.ask-panel form { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.ask-panel textarea { flex: 1; resize: none; }
.ask-foot { margin: 0; padding: 0 12px 8px; }
@media (max-width: 600px) { .ask-panel { right: 8px; left: 8px; width: auto; max-width: none; bottom: 60px; height: calc(100vh - 80px); }
  .ask-btn { right: 8px; bottom: 8px; } }
@media print { .ask-btn, .ask-panel { display: none !important; } }

/* Learning Academy (office side) */
.acad-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.acad-stats .card { margin: 0; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.acad-stats .card b { font-size: 26px; color: var(--accent-num); }
.acad-stats .card span { color: var(--muted); font-size: 13px; }
.acad-stats .acad-alert b { color: var(--err); }
.acad-attn p { margin: 6px 0; }
.acad-pending { border-top: 1px solid var(--line); padding: 8px 0; }
.acad-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.acad-wide { grid-column: 1 / -1; }
.acad-lesson { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.acad-lesson summary { cursor: pointer; }
.acad-add { border-top: 2px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.acad-choice { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.acad-choice input[type=text], .acad-choice input:not([type]) { flex: 1; max-width: 520px; }
.acad-pick { display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.acad-pick:hover { background: var(--hover); }
.acad-people { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; }
.acad-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 80px; }
.acad-bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
tr.acad-flag td:first-child { border-left: 3px solid var(--err); }
.acad-login { background: var(--th-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.acad-link { margin-top: 6px; }
.acad-review { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.acad-review.done { background: var(--ok-bg); color: var(--ok); }
.acad-list { padding-left: 18px; margin: 4px 0 10px; }
.acad-list li { margin: 4px 0; }
.acad-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0; }
.inline-details { display: inline-block; margin-left: 6px; }
.ok-text { color: var(--ok); }

/* Learning Academy: learner portal (phone first) */
body.learn { background: var(--bg); }
.learn-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px;
  background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 100%); border-bottom: 3px solid var(--gold); color: #fff; }
.learn-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.learn-brand:hover { text-decoration: none; }
.learn-brand img { height: 36px; background: #fff; border-radius: 8px; padding: 2px 6px; }
.learn-out { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .85); }
.learn-out button.link { color: var(--gold); }
.learn-main { max-width: 760px; margin: 0 auto; padding: 16px; }
.learn-main h1 { font-size: 24px; margin: 8px 0 12px; }
.learn-narrow { max-width: 420px; margin: 24px auto; }
.learn-input { width: 100%; font-size: 16px; padding: 10px; margin: 4px 0 10px; }
.learn-btn { display: inline-block; font-size: 16px; padding: 12px 20px; border-radius: 10px; background: var(--btn); color: var(--btn-ink);
  border: 1px solid var(--btn); font-weight: 600; text-align: center; }
.learn-btn:hover { text-decoration: none; filter: brightness(1.08); }
.learn-btn.secondary { background: var(--card); color: var(--brand); border-color: var(--brand); }
.learn-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.learn-stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.learn-stats b { display: block; font-size: 22px; color: var(--accent-num); }
.learn-stats span { font-size: 12px; color: var(--muted); }
.learn-stats .bad b { color: var(--err); }
.learn-course { display: block; color: var(--ink); position: relative; padding-right: 80px; }
.learn-course:hover { text-decoration: none; border-color: var(--brand); }
.learn-course-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; }
.learn-go { position: absolute; right: 14px; bottom: 14px; color: var(--brand); font-weight: 700; }
.learn-list { padding-left: 18px; } .learn-list li { margin: 6px 0; }
.learn-lessons { list-style: none; padding: 0; }
.learn-lessons li a { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; background: var(--card); color: var(--ink); }
.learn-lessons li a:hover { text-decoration: none; border-color: var(--brand); }
.learn-check { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--input-line); font-weight: 700; color: var(--muted); }
.learn-lessons li.done .learn-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.learn-video { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; }
.learn-pdf { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.learn-text { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin: 12px 0; font-size: 16px; line-height: 1.6; }
.learn-text h2, .learn-text h3, .learn-text h4 { margin: 14px 0 6px; }
.learn-next { margin: 18px 0; }
.learn-done { background: var(--ok-bg); border-color: var(--ok); }
.learn-fail { background: var(--warn-bg); color: var(--warn-ink); }
.learn-quiz { padding-left: 20px; }
.learn-quiz > li { margin-bottom: 16px; }
.learn-quiz fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); }
.learn-quiz legend { font-weight: 600; padding: 0 4px; }
.learn-choice { display: flex; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 16px; cursor: pointer; }
.learn-choice:last-child { border-bottom: 0; }
.learn-choice input { width: 20px; height: 20px; }
.learn-foot { text-align: center; padding: 20px 0 30px; }
@media (max-width: 520px) { .learn-stats { grid-template-columns: repeat(2, 1fr); } .learn-out span { display: none; } }
.learn-viewing { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 16px; text-align: center; font-size: 13px; }
.learn-viewing a { margin-left: 8px; font-weight: 600; }

/* Personnel checklist: Documents column */
.hr-docs{min-width:170px}
.hr-doc{display:flex;gap:4px;align-items:center;word-break:break-all}
.hr-doc-input{max-width:190px;font-size:12px}

/* Documents → Licenses */
.lic-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin-top:10px;align-items:end}
.lic-form .lic-wide{grid-column:1/-1}
.lic-form input:not([type=file]){width:100%}
.lic-edit{min-width:min(520px,80vw)}

/* Chat, Google Chat style: the chat list on the left, the conversation on the right (wide screens) */
.chat-side-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-side-title { margin: 0 auto 0 0; }
.chat-side .msg-convs { margin-bottom: 10px; }
.chat-pick { display: none; }
.msg-conv-row.on .msg-conv { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent, #f5c400); }
@media (min-width: 1000px) {
  .chat-shell { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
  .chat-side { position: sticky; top: 74px; max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 4px; }
  .chat-side .msg-conv { padding: 8px; gap: 10px; }
  .chat-side .msg-sec { margin: 2px 4px 4px; }
  .chat-main .msg-card { max-width: none; }
  .chat-main .msg-list { max-height: calc(100vh - 330px); }
  .chat-pick { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 20px; gap: 6px; }
  .chat-pick-icon { font-size: 44px; }
  .chat-crumb { display: none; }
}
@media (max-width: 999px) {
  .chat-shell.has-conv .chat-side { display: none; }  /* phones: a conversation takes the whole screen */
}
.chat-main .msg-newgroup { display: block; }
.chat-main .msg-newgroup > summary { list-style: revert; cursor: pointer; }
.chat-side .msg-conv-top .tag { display: none; }  /* the round avatar already marks a group */
.chat-side .msg-conv-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1000px) { main:has(.chat-shell) { max-width: none; } }
.req-mark { color: #b42318; font-weight: 700; }
:root[data-theme="dark"] .req-mark { color: #ff8a80; }

/* ---- Operations → Mail */
.mail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.mail-search { display: flex; gap: 6px; flex: 1 1 280px; max-width: 520px; margin-left: auto; }
.mail-search input[type=search] { flex: 1; min-width: 0; }
.mail-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: start; }
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folders a { padding: 7px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.mail-folders a.on, .mail-folders a:hover { background: var(--line); font-weight: 600; }
/* Gmail labels: under the folders, in conversations and on each row */
.mail-labels-head { margin: 10px 10px 2px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.mail-label-row { display: flex; align-items: center; min-width: 0; }
.mail-label-row[hidden] { display: none; }
.mail-folders a.mail-label { flex: 1; min-width: 0; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.mail-tag { flex: 0 0 15px; width: 15px; height: 15px; color: var(--muted, #6b7280); }  /* Gmail's label icon, in the label's color */
.mail-twisty { flex: 0 0 18px; width: 18px; height: 24px; padding: 0; border: 0; background: none; color: var(--muted, #666); cursor: pointer; font-size: 12px; line-height: 1; }
span.mail-twisty { cursor: default; }
button.mail-twisty:hover { color: var(--ink); }
.mail-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.mail-more summary { padding: 6px 10px; cursor: pointer; }
.mail-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 400; }
.mail-labels { gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 10px; }
.mail-label-tools { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mail-list { padding: 0; overflow: hidden; }
.mail-list > .flash, .mail-list > p { margin: 10px 14px; }
.mail-rows { list-style: none; margin: 0; padding: 0; }
.mail-rows li + li { border-top: 1px solid var(--line); }
.mail-bar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: var(--card); }
.mail-bar button:disabled { opacity: .45; cursor: default; }
.mail-rows li { display: flex; align-items: stretch; }
.mail-rows li.picked { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.mail-check { display: flex; align-items: center; padding: 0 0 0 14px; margin: 0; cursor: pointer; }
.mail-check input { margin: 0; width: 17px; height: 17px; }
.mail-bar .mail-check { padding: 0; }
.mail-rows li > a { flex: 1; min-width: 0; }
.mail-rows a { display: grid; grid-template-columns: 18px minmax(120px, 210px) minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 9px 14px; color: var(--ink); text-decoration: none; }
.mail-rows a:hover { background: var(--bg); }
.mail-rows li:not(.unread) .mail-who, .mail-rows li:not(.unread) .mail-what b { font-weight: 400; }
.mail-rows li.unread .mail-who, .mail-rows li.unread .mail-when { font-weight: 700; }
.mail-who, .mail-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-draft { color: #c5221f; font-weight: 600; }  /* Gmail's red "Draft" in the Drafts folder */
.mail-star { color: #d4a106; }
.mail-when { color: var(--muted); white-space: nowrap; }
.mail-subject { margin-bottom: 6px; overflow-wrap: anywhere; }
.mail-actions { gap: 8px 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.mail-msg { margin-bottom: 12px; }
.mail-msg-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; overflow-wrap: anywhere; }
.mail-frame { width: 100%; min-height: 120px; border: 0; background: #fff; border-radius: 6px; display: block; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; align-items: baseline; }
.mail-att { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.mail-compose label { display: block; margin-bottom: 8px; }
.mail-compose input:not([type=checkbox]):not([type=file]), .mail-compose textarea { width: 100%; }
@media (max-width: 720px) {
  .mail-layout { grid-template-columns: 1fr; }
  .mail-folders { flex-direction: row; flex-wrap: wrap; }
  .mail-rows a { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .mail-what { grid-column: 2 / 4; white-space: normal; }
}
/* external trainings (Learning Academy) */
.learn-desc { white-space: pre-line; }
.learn-facts { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 14px; margin: 10px 0; }
.learn-facts dt { color: var(--muted); font-size: 13px; }
.learn-facts dd { margin: 0; overflow-wrap: anywhere; }
.learn-steps { margin: 6px 0 12px; padding-left: 22px; line-height: 1.6; overflow-wrap: anywhere; }
.learn-wait { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; }
.learn-wait.bad { background: var(--err-bg); color: var(--err); }
.learn-send { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.learn-send summary { cursor: pointer; }
.ext-date { margin: 4px 0; }
.acad-grid label[hidden], #ext-class[hidden] { display: none; }

/* Operations → Caregiver Messages */
.cgm { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 14px; align-items: start; }
.cgm-list { padding: 8px; max-height: 75vh; overflow: auto; }
.cgm-row { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.cgm-row:hover, .cgm-row.on { background: rgba(127, 127, 127, 0.12); }
.cgm-row.unread .cgm-name { font-weight: 700; }
.cgm-name { display: block; }
.cgm-announce { margin: 4px 4px 10px; }
.cgm-announce textarea, .cgm-reply textarea { width: 100%; box-sizing: border-box; }
.cgm-convo { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; margin-bottom: 10px; }
.cgm-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; background: rgba(127, 127, 127, 0.12); }
.cgm-msg.mine { align-self: flex-end; background: rgba(30, 64, 175, 0.12); }
@media (max-width: 760px) { .cgm { grid-template-columns: 1fr; } }
.side-help + .side-help { margin-top: 0; border-top: 0; }
.side-top { display: block; margin-bottom: 6px; font-weight: 700; }
/* Calendar & Schedule: the sidebar forms and clickable visits */
.cal-sched-add { margin-top: 8px; }
.cal-sched-add form label, .cal-filter label { display: block; margin-bottom: 6px; }
.cal-sched-add .two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cal-sched-add input:not([type=checkbox]), .cal-sched-add select { width: 100%; box-sizing: border-box; }
button.cal-chip { width: 100%; text-align: left; font: inherit; font-size: 12px; cursor: pointer; border: 0; border-left: 3px solid var(--c); margin: 0; }
/* Calendar & Schedule: the Schedule board (one week by caregiver or client), like the EMR's */
.sb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sb-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sb-seg { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; width: fit-content; background: var(--card); }
.sb-seg a { padding: 6px 12px; border-radius: 7px; font-weight: 600; text-decoration: none; color: var(--ink); }
.sb-seg a[aria-current] { background: #1e40af; color: #fff; }
.sb-legend { display: flex; gap: 12px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: 13px; }
.sb-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 12px; }
.sb-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.sb-board { min-width: 980px; width: 100%; table-layout: fixed; border-collapse: collapse; }
.sb-board th, .sb-board td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; vertical-align: top; }
.sb-board thead th { font-size: 13px; text-align: left; position: sticky; top: 0; background: var(--card); }
.sb-board thead th span { font-weight: 400; color: var(--muted); }
.sb-board tbody th { text-align: left; width: 150px; position: sticky; left: 0; background: var(--card); }
.sb-board th:first-child { width: 150px; }
.sb-board th:last-child, .sb-board td:last-child { width: 64px; border-right: 0; text-align: right; }
.sb-board .is-today { background: color-mix(in srgb, #f59e0b 10%, var(--card)); }
.sb-board .open-row th, .sb-board .open-row td { background: color-mix(in srgb, #f59e0b 8%, var(--card)); }
.sb-visit { display: block; width: 100%; text-align: left; font: inherit; font-size: 12px; line-height: 1.3; margin: 0 0 5px; padding: 5px 7px;
  border: 1px solid var(--line); border-left: 4px solid #64748b; border-radius: 7px; background: color-mix(in srgb, #64748b 8%, var(--card));
  color: var(--ink); text-decoration: none; cursor: pointer; }
.sb-visit time { display: block; font-weight: 700; }
.sb-visit span { display: block; }
.sb-visit em { display: block; font-style: normal; color: var(--muted); font-size: 11px; }
.sb-visit:hover { filter: brightness(.97); text-decoration: none; }
.sb-visit.s-open, .sb-chip.s-open { border-color: #d97706; border-left-style: dashed; background: color-mix(in srgb, #f59e0b 16%, var(--card)); }
.sb-visit.s-in_progress, .sb-chip.s-in_progress { border-color: #2563eb; background: color-mix(in srgb, #2563eb 10%, var(--card)); }
.sb-visit.s-completed, .sb-chip.s-completed { border-color: #059669; background: color-mix(in srgb, #059669 10%, var(--card)); }
.sb-visit.s-approved, .sb-chip.s-approved { border-color: #1e3a8a; background: color-mix(in srgb, #1e3a8a 12%, var(--card)); }
.sb-visit.s-missed, .sb-chip.s-missed { border-color: #dc2626; background: color-mix(in srgb, #dc2626 10%, var(--card)); }
.sb-off { display: block; margin-bottom: 4px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600;
  color: #b91c1c; background: color-mix(in srgb, #dc2626 10%, var(--card)); border: 1px dashed #dc2626; }
.sb-off.waiting { color: #b45309; border-color: #d97706; background: color-mix(in srgb, #f59e0b 12%, var(--card)); }
.sb-board th { text-transform: none; letter-spacing: normal; }
.sb-board tbody th { font-size: 14px; font-weight: 600; color: var(--ink); }
.sb-board thead th { font-size: 13px; font-weight: 700; color: var(--ink); }

/* Client Care Plan: each day in the weekly chart is a one-click switch */
.day-dot { background: none; border: 0; padding: 2px 6px; font-size: 16px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 6px; }
.day-dot.on { color: #1e40af; }
.day-dot:hover { background: rgba(30, 64, 175, .1); }

/* Phone App Rollout progress bar (width by class: CSP-friendly) */
.ro-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.ro-fill { display: block; height: 100%; background: #059669; width: 0; }
.ro-0 { width: 0%; }
.ro-10 { width: 10%; }
.ro-20 { width: 20%; }
.ro-30 { width: 30%; }
.ro-40 { width: 40%; }
.ro-50 { width: 50%; }
.ro-60 { width: 60%; }
.ro-70 { width: 70%; }
.ro-80 { width: 80%; }
.ro-90 { width: 90%; }
.ro-100 { width: 100%; }

/* ---- Marketing (Office → Marketing) */
.mkt-stats { margin-bottom: 4px; }
a.card.stat { color: inherit; text-decoration: none; display: block; }
a.card.stat:hover { border-color: var(--brand); }
.mkt-two { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.mkt-h { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 0 0 10px; flex-wrap: wrap; }
.mkt-h3 { font-size: 14px; margin: 18px 0 6px; }
.mkt-title { font-size: 20px; margin: 4px 0 2px; }
.mkt-line { padding: 6px 0; border-bottom: 1px solid var(--line); }
.mkt-line:last-child { border-bottom: 0; }
.mkt-date { display: inline-block; min-width: 92px; font-variant-numeric: tabular-nums; font-weight: 600; }
.mkt-st { font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; background: var(--tag-bg); color: var(--brand); }
.st-draft { background: #eceff3; color: #475467; }
.st-pending { background: #fff4d6; color: #8a5a00; }
.st-approved { background: #e3f1ff; color: #175cd3; }
.st-scheduled { background: #efe7ff; color: #5925dc; }
.st-published { background: #e3f8ec; color: #067647; }
.mkt-legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.mkt-cal-bar { align-items: center; gap: 12px; margin-bottom: 10px; }
.mkt-cal-bar .subnav { margin: 0; }
.mkt-cal-nav { display: inline-flex; gap: 8px; align-items: center; }
.mkt-find { margin-left: auto; }
.mkt-pending { border-left: 4px solid var(--gold); }
.mkt-cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); margin-bottom: 16px; }
.mkt-cal-head, .mkt-cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mkt-cal-head div { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.mkt-day { min-height: 104px; padding: 4px 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.mkt-cal-week .mkt-day:last-child { border-right: 0; }
.mkt-day.out { background: var(--bg); opacity: .65; }
.mkt-day.today .mkt-day-n { background: var(--navy); color: #fff; border-radius: 999px; padding: 0 7px; }
.mkt-day-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 3px; }
.mkt-add { opacity: .35; font-weight: 700; text-decoration: none; padding: 0 4px; }
.mkt-day:hover .mkt-add, .mkt-add:focus { opacity: 1; }
.mkt-chip { display: block; font-size: 12px; line-height: 1.3; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; text-decoration: none;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-week .mkt-day { min-height: 260px; }
.mkt-week .mkt-chip { white-space: normal; padding: 6px; }
.mkt-chip-sub { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }
.mkt-chip-cap { display: block; font-size: 11px; margin-top: 4px; font-weight: 400; }
.mkt-time { font-weight: 700; }
.mkt-steps { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.mkt-step { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.mkt-step.on { border-color: transparent; font-weight: 700; }
.mkt-spacer { flex: 1; }
.mkt-approve input { min-width: 220px; }
.mkt-form label { display: block; }
.mkt-form label.inline { display: inline-flex; gap: 4px; align-items: center; margin-right: 12px; }
.mkt-wide, .mkt-caption { width: 100%; }
.mkt-platforms { border: 0; padding: 0; margin: 6px 0 10px; }
.mkt-privacy { border-left: 3px solid var(--gold); padding-left: 8px; }
.mkt-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.mkt-thumb { width: 170px; }
.mkt-thumb img, .mkt-thumb video { width: 170px; height: 130px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.mkt-mats { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 4px 0 8px; }
.mkt-repeat { margin: 12px 0; }
.mkt-touch { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mkt-notes { white-space: pre-wrap; margin-top: 4px; }
.mkt-v { font-size: 18px; }
.mkt-src td, .mkt-src th { text-align: center; white-space: nowrap; }
.mkt-src td:first-child, .mkt-src th:first-child { text-align: left; white-space: normal; }
.mkt-total td { font-weight: 700; border-top: 2px solid var(--line); }
.mkt-mat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 6px; }
.mkt-mat { color: inherit; text-decoration: none; padding: 10px; }
.mkt-mat:hover { border-color: var(--brand); }
.mkt-mat-prev { height: 130px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.mkt-mat-prev img { max-width: 100%; max-height: 130px; object-fit: contain; }
.mkt-mat-icon { font-size: 44px; }
.mkt-preview img, .mkt-preview video { max-width: 100%; max-height: 520px; display: block; border-radius: 8px; background: var(--bg); }
.mkt-preview iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; }
.mkt-del { margin-top: 14px; }
.mkt-review-link { display: flex; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mkt-qr { width: 96px; height: 96px; background: #fff; border-radius: 6px; flex: none; }
.mkt-url { word-break: break-all; }
.mkt-copy-src { width: 1px; height: 1px; opacity: 0; position: absolute; }
.mkt-review { padding: 10px 0; border-bottom: 1px solid var(--line); }
.mkt-stars, .mkt-star { color: #e6a700; letter-spacing: 1px; }
.mkt-response { margin: 6px 0 0 14px; padding-left: 10px; border-left: 3px solid var(--line); }
.mkt-span2 { grid-column: span 2; }
.mkt-inline-form { min-width: 300px; }
@media (max-width: 700px) {
  .mkt-cal-head { display: none; }
  .mkt-cal-week { grid-template-columns: 1fr; }
  .mkt-day { min-height: 0; border-right: 0; }
  .mkt-day.out { display: none; }
  .mkt-two { grid-template-columns: 1fr; }
  .mkt-span2 { grid-column: auto; }
  .mkt-find { margin-left: 0; }
}

/* ---- Marketing dashboard charts. Roles: --mkt-s1 inquiries (blue), --mkt-s2 new clients (orange); validated
   light on #fff and dark on #121b2e. Light orange is under 3:1, so every bar carries a visible number. */
.mkt-viz { --mkt-s1: #257de0; --mkt-s2: #f47230; --mkt-gridc: #e6ebf3; --mkt-track: #f1f4f9; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .mkt-viz { --mkt-s1: #338ced; --mkt-s2: #e76624; --mkt-gridc: #24304a; --mkt-track: #17223a; }
}
:root[data-theme="dark"] .mkt-viz { --mkt-s1: #338ced; --mkt-s2: #e76624; --mkt-gridc: #24304a; --mkt-track: #17223a; }
.mkt-range a { padding: 1px 6px; border-radius: 999px; }
.mkt-range a.on { background: var(--navy); color: #fff; font-weight: 700; }
.mkt-legend-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 2px 0 6px; }
.mkt-key { display: inline-flex; gap: 6px; align-items: center; }
.mkt-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.mkt-viz .mkt-s1 { fill: var(--mkt-s1); background: var(--mkt-s1); }
.mkt-viz .mkt-s2 { fill: var(--mkt-s2); background: var(--mkt-s2); }
.mkt-viz .mkt-f1, .mkt-viz .mkt-f2 { background: var(--mkt-s1); }
.mkt-viz .mkt-f3 { background: var(--mkt-s2); }
.mkt-chart { width: 100%; overflow-x: auto; }
.mkt-trend { width: 100%; height: auto; display: block; }
.mkt-trend .mkt-grid { stroke: var(--mkt-gridc); stroke-width: 1; }
.mkt-trend .mkt-base { stroke: var(--muted); stroke-opacity: .5; }
.mkt-trend .mkt-axis { fill: var(--muted); font-size: 11px; }
.mkt-trend .mkt-val { fill: var(--ink); font-size: 11px; font-weight: 700; }
.mkt-trend .mkt-hit { fill: transparent; }
.mkt-trend .mkt-month:hover .mkt-hit { fill: var(--hover); }
.mkt-charts2 { margin-top: 8px; }
.mkt-hrow { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.mkt-hlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-htrack { background: var(--mkt-track); border-radius: 4px; height: 16px; overflow: hidden; }
.mkt-hbar { display: flex; gap: 2px; height: 100%; min-width: 2px; }
.mkt-seg { display: block; height: 100%; min-width: 3px; }
.mkt-hbar .mkt-seg:last-child { border-radius: 0 4px 4px 0; }
.mkt-hval { white-space: nowrap; font-variant-numeric: tabular-nums; }
.mkt-hrow:hover .mkt-hlabel { font-weight: 700; }
.mkt-mini { display: inline-block; width: 90px; height: 10px; background: var(--mkt-track); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.mkt-mini i { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.mkt-risk { color: var(--warn-ink, #8a5a00); font-weight: 700; }
.mkt-table-view { margin-top: 12px; }
@media (max-width: 700px) {
  .mkt-hrow { grid-template-columns: 1fr auto; }
  .mkt-htrack { grid-column: 1 / -1; order: 3; }
  .mkt-mini { width: 50px; }
  .mkt-trend { min-width: 560px; }  /* keep the numbers readable; the chart scrolls sideways inside its box */
  .mkt-range { width: 100%; }
}
/* Reviews and posting charts: categorical slots 1-3 (blue, orange, aqua), validated light on #fff and dark on #121b2e;
   light orange and aqua are under 3:1, so every column shows its total and each chart has a table view. */
.mkt-viz { --mkt-c1: #257de0; --mkt-c2: #f47230; --mkt-c3: #00b894; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .mkt-viz { --mkt-c1: #338ced; --mkt-c2: #e76624; --mkt-c3: #00a888; }
}
:root[data-theme="dark"] .mkt-viz { --mkt-c1: #338ced; --mkt-c2: #e76624; --mkt-c3: #00a888; }
.mkt-viz .mkt-c1 { fill: var(--mkt-c1); background: var(--mkt-c1); }
.mkt-viz .mkt-c2 { fill: var(--mkt-c2); background: var(--mkt-c2); }
.mkt-viz .mkt-c3 { fill: var(--mkt-c3); background: var(--mkt-c3); }
.web-tiles { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.web-prow .mkt-hlabel a { color: inherit; }
.web-days td, .web-days th { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.web-days td:first-child, .web-days th:first-child { text-align: left; }
.mkt-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 10px; }
.mkt-tile-v { font-size: 22px; font-weight: 750; color: var(--accent-num); font-variant-numeric: tabular-nums; line-height: 1.2; }
#review-stats .mkt-trend, #posting .mkt-trend { max-height: 230px; }
.mkt-two > * { min-width: 0; }  /* let a scrolling chart scroll instead of widening the card */

/* ---- Care → Scheduling: sub-items in the menu, the three tabs, clickable status chips, Open Visits */
.side a.side-sub { padding: 4px 10px 4px 50px; font-size: 13px; color: var(--muted); justify-content: flex-start; }

.side a.side-sub.on { color: var(--brand); }
/* Scheduling's and Marketing's button: hides or shows their pages (remembered in this browser) */
.side-row { display: flex; align-items: center; }
.side-row > a { flex: 1; min-width: 0; }
.side-twisty { flex: none; width: 32px; height: 32px; margin-left: 2px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 0; }
.side-twisty:hover { background: var(--hover); color: var(--ink); }
:root[data-shut-sched] #sched-subs, :root[data-shut-mkt] #mkt-subs { display: none; }
:root:not([data-shut-mkt]) #side-nav .side-total { display: none; }  /* Marketing's total: only while its pages are hidden */
/* Billing and Bookkeeping: one item each, their pages show under it while you're on one of them */
.side a.side-group::after { content: "▸"; font-size: 10px; color: var(--muted); margin-left: auto; transition: transform .15s; }
.side a.side-group .pill { margin-left: auto; }
.side a.side-group:has(.pill)::after { margin-left: 0; }
.side a.side-group[aria-expanded="true"]::after { transform: rotate(90deg); }
.sched-tabs { margin-bottom: 10px; }
button.sb-chip { cursor: pointer; color: var(--ink); font-family: inherit; line-height: 1.5; }
button.sb-chip:hover { box-shadow: 0 0 0 2px var(--line); }
.sb-gone { display: none !important; }
button.sb-chip.is-off { background: var(--card) !important; border-style: dashed; opacity: .55; text-decoration: line-through; }
.ov-range { margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.ov-range.on { background: var(--navy); color: #fff; font-weight: 700; }
.ov-h { margin: 0 0 6px; font-size: 15px; }
.ov-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-top: 1px solid var(--line); }
.ov-time { min-width: 150px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-client { min-width: 160px; }
.ov-row .can-edit { margin-left: auto; }
.ov-late { background: var(--err-bg); color: var(--err); }
.ov-cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); margin-bottom: 14px; }
.ov-cal-head, .ov-cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ov-cal-head div { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.ov-cal-day { min-height: 86px; padding: 4px 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.ov-cal-week .ov-cal-day:last-child { border-right: 0; }
.ov-cal-day.past { background: var(--bg); opacity: .6; }
.ov-cal-day.today .ov-cal-n { background: var(--navy); color: #fff; border-radius: 999px; padding: 0 7px; display: inline-block; }
.ov-cal-n { font-size: 12px; margin-bottom: 3px; }
.ov-chip { display: block; width: 100%; text-align: left; font: inherit; font-size: 11.5px; line-height: 1.3; margin: 0 0 3px; padding: 3px 6px;
  border: 1px solid #d97706; border-left-style: dashed; border-radius: 6px; color: var(--ink);
  background: color-mix(in srgb, #f59e0b 16%, var(--card)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.ov-chip { cursor: pointer; }
button.ov-chip:hover { filter: brightness(.96); }
@media (max-width: 700px) {
  .ov-cal-head { display: none; }
  .ov-cal-week { grid-template-columns: 1fr; }
  .ov-cal-day { min-height: 0; border-right: 0; }
  .ov-cal-day:not(.has) { display: none; }
}

/* ---- Scheduling → Scheduler */
.sch-stats { margin-bottom: 6px; }
.sch-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sch-under { background: var(--warn-bg); color: var(--warn-ink); }
.sch-over { background: var(--err-bg); color: var(--err); }
.sch-ok { background: var(--ok-bg); color: var(--ok); }
.sch-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.sch-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; font-size: 13px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; }
.sch-opt.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--tag-bg); }
.sch-days { border: 0; padding: 0; margin: 0 0 10px; }
.sch-days label.inline { margin-right: 12px; }
.sch-total { font-weight: 700; }
.sch-match { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.sch-match-main { min-width: 0; flex: 1 1 320px; }
.sch-good { color: var(--ok); }
.sch-concern { color: var(--warn-ink); }
.sch-offer { border-left: 4px solid var(--brand); }
.sch-pick { display: block; padding: 3px 0; }

/* Mail → Signatures: the signature as it will look, on the Signatures page and under the compose box */
.mail-sig { margin: -4px 0 12px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.mail-sig .sig-preview { flex-basis: 100%; }
.sig-preview { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.sig-preview img { display: block; margin-bottom: 6px; background: #fff; border-radius: 4px; }
.notice-preview { white-space: pre-line; font-size: 11.5px; }
.ins-doc-list { list-style: none; padding: 0; margin: 0 0 10px; }
.ins-doc-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }

/* Care → Review Visits: one visit's Activity & History, in a pop-up */
.vh-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: inherit; padding: 0; }
.vh-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.vh-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: var(--card); z-index: 1; }
.vh-head h2 { margin: 0; font-size: 17px; }
.vh-head .link { font-size: 18px; }
.vh-body { padding: 4px 18px 16px; }
.vh-sec h3 { margin: 14px 0 8px; font-size: 15px; }
.vh-activity { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 640px) { .vh-activity { grid-template-columns: minmax(0, 1fr); } }
.vh-map { width: 100%; max-width: 220px; height: auto; border: 1px solid var(--line); border-radius: 10px; display: block; }
.vm-bg { fill: var(--bg); }
.vm-grid { stroke: var(--line); stroke-width: 1; }
.vm-ring { fill: var(--ok-bg); fill-opacity: .6; stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 5 4; }
.vm-home circle { fill: var(--card); stroke: currentColor; stroke-width: 1.5; }
.vm-home path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.vm-pin path { stroke: var(--card); stroke-width: 1.5; }
.vm-pin text { font: 800 7px sans-serif; fill: #fff; text-anchor: middle; }
.vm-in path { fill: #1f5673; } .vm-out path { fill: #c8473a; }
.vm-scale path { fill: none; stroke: var(--muted); stroke-width: 1.5; } .vm-scale text { font: 600 10px sans-serif; fill: var(--muted); }
.vh-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.vh-points > li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.vh-points .small { margin-top: 3px; }
.vh-time { float: right; font-weight: 700; }
.vh-mark { display: inline-grid; place-items: center; min-width: 38px; height: 24px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; }
.vh-mark.vm-in { background: #1f5673; } .vh-mark.vm-out { background: #c8473a; }
.vh-list { list-style: none; margin: 0; padding: 0; }
.vh-list > li { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.vh-list > li:first-child { border-top: 0; }
.vh-list > li.vh-many { background: var(--bg); border-radius: 8px; padding: 9px 8px; margin: 0 -8px; border-top-color: transparent; }
.vh-list ul { margin: 4px 0 0; padding-left: 18px; }
.vh-list ul li { margin: 2px 0; }
@media (max-width: 560px) { .vh-list > li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Care → Visit (one ChartHearth visit, changed here) */
.vv-head { justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.vv-title { margin-bottom: 4px; }
.vv-sub { margin-top: 0; }
.vv-actions { gap: 10px; align-items: center; flex-wrap: wrap; }
.vv-flags { border-left: 4px solid var(--warn-ink); background: var(--warn-bg); }
.vv-flags ul { margin: 6px 0 0; padding-left: 20px; }
.vv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 900px) { .vv-grid { grid-template-columns: minmax(0, 1fr); } }
.vv-h { font-size: 17px; margin: 0 0 10px; }
.vv-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 8px; }
.vv-facts dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); align-self: center; }
.vv-facts dt.sub { padding-left: 12px; font-weight: 600; }
.vv-facts dd { margin: 0; }
.vv-tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.vv-form label { display: block; margin: 8px 0; }
.vv-form input:not([type=checkbox]):not([type=radio]), .vv-form select, .vv-form textarea { width: 100%; }
.vv-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vv-form .three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .vv-form .three { grid-template-columns: minmax(0, 1fr); } }
.vv-buttons { gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.vv-fin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .vv-fin { grid-template-columns: minmax(0, 1fr); } }
.vv-fin fieldset, .vv-other { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; margin: 0; min-width: 0; }
.vv-other { margin-top: 14px; }
.vv-fin fieldset[disabled], .vv-other[disabled] { background: var(--bg); }
.vv-fin legend, .vv-other legend { font-weight: 800; padding: 0 6px; }
.vv-rate { display: flex; gap: 8px; margin-top: 4px; }
.vv-rate select { flex: 1 1 auto; }
.vv-rate input { flex: 0 0 7rem; width: 7rem !important; }
.vv-yn { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.vv-yn label { display: inline-flex; gap: 6px; margin: 0; }
.vv-history { margin-top: 16px; }
.vv-form [hidden] { display: none !important; }

/* Chat: the emoji picker (chat.js) */
.emoji-btn { font-size: 18px; line-height: 1; padding: 6px 10px; }
.emoji-btn.small { font-size: 16px; padding: 4px 8px; }
.emoji-pop { position: absolute; z-index: 60; max-height: 300px; overflow-y: auto; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 18%); padding: 8px 10px; }
.emoji-sec + .emoji-sec { margin-top: 6px; }
.emoji-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 2px 2px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; }
.emoji-pick { font-size: 22px; line-height: 1; padding: 6px 0; background: none; border: 0; border-radius: 8px; cursor: pointer; color: inherit; }
.emoji-pick:hover, .emoji-pick:focus-visible { background: var(--bg); }

/* ---- Assessments & Care Plans (care_forms.py): the start menu, what's due, the FASP upload, the forms' own fields */
.care-start { position: relative; margin-left: auto; }
.care-start > summary { list-style: none; cursor: pointer; }
.care-start > summary::-webkit-details-marker { display: none; }
.care-start-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 250px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.care-start-menu form { margin: 0; }
.care-start-menu button.link { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; }
.care-start-menu button.link:hover { background: var(--hover); text-decoration: none; }
.care-start-menu p { margin: 6px 10px; }
.care-due { list-style: none; padding: 0; margin: 4px 0 10px; }
.care-due li { margin: 4px 0; }
.care-fasp-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 8px 14px; margin-top: 8px; }
.care-fasp-form label { display: block; }
.care-wide { grid-column: 1 / -1; }
.asmt-yn label.inline { white-space: nowrap; }
.asmt-note { margin: 0; }
.asmt-grid-table select { min-width: 64px; }

/* Office → Medicaid News */
.mn-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mn-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; margin-top: 12px; max-width: 1200px; }
@media (max-width: 900px) { .mn-wrap { grid-template-columns: minmax(0, 1fr); } }
.mn-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.mn-filter label { display: flex; flex-direction: column; gap: 2px; }
.mn-filter .mn-search { flex: 1 1 180px; }
.mn-item { margin-bottom: 12px; border-left: 4px solid var(--line); }
.mn-item.mn-high { border-left-color: var(--err); }
.mn-item.mn-maybe { border-left-color: var(--warn-ink); }
.mn-item.mn-new .mn-title { font-weight: 700; }
.mn-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mn-title { margin: 6px 0; font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.mn-sum { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 4px; font-size: 14px; }
.mn-sum dt { font-weight: 600; color: var(--muted); }
.mn-sum dd { margin: 0; }
@media (max-width: 560px) { .mn-sum { grid-template-columns: minmax(0, 1fr); } .mn-sum dd { margin-bottom: 4px; } }
.mn-ai { margin: 2px 0 6px; }
.mn-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; }
.mn-actions form.inline { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.mn-side .card { margin-bottom: 14px; }
.mn-h { font-size: 15px; margin: 0 0 8px; }
.mn-dl, .mn-src { list-style: none; padding: 0; margin: 0; }
.mn-dl li, .mn-src li { padding: 5px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.mn-dl li:first-child, .mn-src li:first-child { border-top: 0; }
.mn-set { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.mn-set fieldset { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.mn-set textarea { width: 100%; font-size: 13px; }
