/* 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(380px, 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; }
@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; } }

/* 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; }
.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-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; }
