/* Med Services HQ. One system for every page: change a token here, not a page. */
:root {
  --navy: #0f2a44; --navy-2: #173a5c; --navy-3: #22496f; --green: #2f7d6d; --green-2: #3fa58f;
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f9fafb; --ink: #0f1b2d; --muted: #5f6b7c; --faint: #8a94a3;
  --line: #e5e8ee; --line-strong: #d3d8e0;
  --accent: var(--navy); --accent-ink: #ffffff; --accent-soft: #e9eff6; --link: #1f5f9c;
  --good: #1d7a55; --good-soft: #e3f4ec; --warn: #9a5b00; --warn-soft: #fcf1de; --bad: #c0362c; --bad-soft: #fdebe9;
  --forecast: #a8641a;
  --radius: 14px; --radius-sm: 10px; --radius-xs: 7px; --gap: 16px;
  --shadow: 0 1px 2px rgba(15, 42, 68, .05), 0 1px 1px rgba(15, 42, 68, .03);
  --shadow-lg: 0 12px 40px rgba(15, 42, 68, .12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --text: 15px; --small: 13px; --h1: 28px; --h2: 17px;
  --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1420; --surface: #121e2c; --surface-2: #162434; --ink: #e8edf3; --muted: #9aa7b6; --faint: #6f7d8d;
    --line: #1f2f42; --line-strong: #2b3e54;
    --accent: #e8edf3; --accent-ink: #0b1420; --accent-soft: #1b2d42; --link: #7fb3e8;
    --good: #4cc08f; --good-soft: #10291f; --warn: #e3a54a; --warn-soft: #2a2011; --bad: #f07167; --bad-soft: #2c1517;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--text)/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: var(--h1); margin: 0 0 2px; font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
h2 { font-size: var(--h2); margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: var(--text); margin: 0 0 8px; font-weight: 620; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: var(--small); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sprite { display: none; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid rgba(47, 125, 109, .45); outline-offset: 2px; }

/* ---- App shell: sidebar + content ---------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.side::-webkit-scrollbar { width: 6px; } .side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.side-brand:hover { text-decoration: none; }
.side-brand img { width: 32px; height: 32px; }
.side-brand b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; display: block; line-height: 1.1; }
.side-brand span { font-size: 12px; color: rgba(255, 255, 255, .55); font-weight: 500; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: rgba(255, 255, 255, .72);
  text-decoration: none; font-size: 14px; font-weight: 520; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.side-link[aria-current="page"], .side-link.open { background: rgba(255, 255, 255, .12); color: #fff; }
.side-link .badge { margin-left: auto; }
.side-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .14); }
.side-sub a { padding: 6px 10px; border-radius: 7px; font-size: 13.5px; color: rgba(255, 255, 255, .6); text-decoration: none; }
.side-sub a:hover { color: #fff; background: rgba(255, 255, 255, .06); text-decoration: none; }
.side-sub a[aria-current="page"] { color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 8px; border-top: 1px solid rgba(255, 255, 255, .1); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex: none; }
.side-user .who { min-width: 0; flex: 1; font-size: 13px; line-height: 1.25; }
.side-user .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { color: rgba(255, 255, 255, .5); font-size: 12px; }
.side-user form { margin: 0; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent;
  color: inherit; cursor: pointer; padding: 0; }
.side .icon-btn { color: rgba(255, 255, 255, .65); }
.side .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-close { display: none; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mbar { display: none; }
.scrim { display: none; }
.tabs { display: none; }

/* Site-wide system banner (outages, errors) */
.sysbar { display: flex; align-items: center; gap: 10px; padding: 9px 24px; font-size: 13.5px; font-weight: 550;
  background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid rgba(154, 91, 0, .15); }
.sysbar.bad { background: var(--bad-soft); color: var(--bad); border-bottom-color: rgba(192, 54, 44, .18); }
.sysbar a { color: inherit; margin-left: auto; text-decoration: underline; white-space: nowrap; }

@media (max-width: 960px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow-lg); width: min(84vw, 300px); padding-top: max(18px, env(safe-area-inset-top)); visibility: hidden; }
  body.nav-open .side { transform: none; visibility: visible; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 18, 30, .45); z-index: 30; }
  .side-close { display: grid; margin-left: auto; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; min-height: 56px; padding: 0 10px;
    padding-top: env(safe-area-inset-top); background: rgba(255, 255, 255, .86); border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); }
  .mbar img { width: 28px; height: 28px; }
  .mbar .title { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
  .mbar .icon-btn { color: var(--ink); }
  .mbar .badge { margin-left: auto; margin-right: 6px; }
  .tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 0; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
    font-size: 13.5px; font-weight: 550; white-space: nowrap; text-decoration: none; }
  .tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
  .sysbar { padding: 9px 16px; }
}
@media (max-width: 960px) and (prefers-color-scheme: dark) {
  .mbar { background: rgba(18, 30, 44, .86); }
  .tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
}

/* ---- Page ---------------------------------------------------------------- */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--green); margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: var(--gap);
  box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13.5px; font-weight: 550; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: var(--gap); }
.cols { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .label { font-size: var(--small); color: var(--muted); font-weight: 550; }
.stat .value { font-size: clamp(19px, 1.9vw, 26px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .sub { font-size: var(--small); color: var(--muted); }
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 48px; }
  h1 { font-size: 24px; }
  .page-head { margin-bottom: 16px; }
  .card { padding: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat .value { font-size: 21px; }
}

/* Tiles (areas, ventures, websites, admin) */
.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: var(--gap); }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
a.tile:hover { border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-top .pill { margin-left: auto; }
.tile-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--navy); flex: none; }
.tile b { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.tile-meta { color: var(--muted); font-size: 13.5px; }
.tile-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-foot { display: flex; gap: 14px; margin-top: auto; padding-top: 8px; font-size: 13.5px; font-weight: 550; }
@media (prefers-color-scheme: dark) { .tile-icon { color: var(--ink); } }

/* Lists (to do, deadlines, people) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { text-decoration: none; background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { color: var(--muted); font-size: 13px; }
.list-row > .ic { color: var(--faint); }
.due-bad { color: var(--bad); font-weight: 650; }
.due-warn { color: var(--warn); font-weight: 650; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.chip:hover { color: var(--ink); text-decoration: none; }
.chip[aria-current] { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--bg); } }
.allclear { display: flex; align-items: center; gap: 10px; color: var(--good); font-weight: 600; padding: 6px 0; }

/* Charts (SVG, drawn on the server) */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--navy); }
.chart .bar.cost { fill: #c9d3df; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--faint); font: 11px var(--font); }
@media (prefers-color-scheme: dark) { .chart .bar { fill: #7fb3e8; } .chart .bar.cost { fill: #2b3e54; } }
.key { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--navy); margin-right: 6px; vertical-align: -1px; }
.key i.cost { background: #c9d3df; }
@media (prefers-color-scheme: dark) { .key i { background: #7fb3e8; } .key i.cost { background: #2b3e54; } }

/* Buttons and links */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 8px 15px;
  border-radius: var(--radius-sm); border: 1px solid var(--navy); background: var(--navy); color: #fff;
  font: 600 14px var(--font); text-decoration: none; cursor: pointer; line-height: 1.2; transition: background .15s; }
.btn:hover { background: var(--navy-2); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: rgba(192, 54, 44, .35); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { background: #276b5d; }
.btn.small { min-height: 30px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.full { width: 100%; min-height: 46px; font-size: 15px; }
@media (prefers-color-scheme: dark) {
  .btn { background: #e8edf3; border-color: #e8edf3; color: #0b1420; }
  .btn:hover { background: #fff; }
  .btn.secondary, .btn.danger { background: var(--surface); }
  .btn.secondary { color: var(--ink); border-color: var(--line-strong); }
}
button.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.inline { display: inline; margin: 0; }

/* Pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--accent-soft); color: var(--link); border-color: transparent; }

/* Banners (flash messages) */
.banner { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: var(--gap); background: var(--accent-soft); color: var(--link); font-weight: 520; }
.banner-success { background: var(--good-soft); color: var(--good); }
.banner-error { background: var(--bad-soft); color: var(--bad); }
.banner-warning { background: var(--warn-soft); color: var(--warn); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 650;
  padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data th.num, table.data td.num { text-align: right; }
table.data tr.void td { color: var(--muted); text-decoration: line-through; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* P&L board */
.board { font-size: 13px; }
.board th:first-child, .board td:first-child { position: sticky; left: 0; background: var(--surface); min-width: 230px; z-index: 1; }
.board td.num, .board th.num { min-width: 82px; }
.board tr.group td { font-weight: 650; background: var(--surface-2); }
.board tr.group td:first-child { background: var(--surface-2); }
.board tr.sub td:first-child { padding-left: 22px; }
.board tr.line td:first-child { padding-left: 38px; color: var(--muted); }
.board tr.total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.board tr.key td { font-weight: 700; background: var(--accent-soft); }
.board tr.key td:first-child { background: var(--accent-soft); }
.board td.forecast { color: var(--forecast); font-style: italic; }
.board th.forecast-col { color: var(--forecast); }
.board .neg { color: var(--bad); }
.legend { display: flex; gap: 16px; font-size: var(--small); color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.legend .forecast { color: var(--forecast); font-style: italic; }

/* Forms */
form.stack { display: grid; gap: 14px; max-width: 640px; }
.field { display: grid; gap: 5px; }
.field label, .label { font-size: var(--small); font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=month], input[type=url],
input[type=search], input[type=tel], input[type=file], select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: 15px var(--font);
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(47, 125, 109, .16); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: auto; min-height: 0; }
.lines td { padding: 4px; }
.lines input { padding: 6px 8px; min-height: 34px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; }
.totals { margin-left: auto; max-width: 320px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.qr svg, .qr img { width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 8px; }
code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.w-qty { width: 80px; } .w-unit { width: 140px; } .w-vat { width: 100px; }
.mt { margin-top: 16px; }
.suggest { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.amount-in { color: var(--good); } .amount-out { color: var(--bad); }

/* Old section tabs (kept for any page still using them) */
.subnav { display: flex; gap: 2px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav a { padding: 10px 12px; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); font-weight: 600; }

/* ---- Sign in ------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: minmax(320px, 44%) 1fr; min-height: 100vh; }
.auth-brand { background: var(--navy); color: #fff; padding: 44px 48px 32px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -160px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 165, 143, .35), rgba(63, 165, 143, 0) 70%); }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo img { width: 44px; height: 44px; }
.auth-logo b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-headline { font-size: 34px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin: 40px 0 26px; }
.auth-headline span { color: var(--green-2); }
.auth-areas { display: flex; flex-direction: column; gap: 8px; max-width: 360px; position: relative; z-index: 1; }
.auth-area { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08); font-size: 14px; font-weight: 600; }
.auth-area .ic { color: var(--green-2); }
.auth-foot { margin-top: auto; padding-top: 32px; font-size: 12px; color: rgba(255, 255, 255, .45); position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 30px; }
.auth-card .sub { color: var(--muted); margin: 4px 0 26px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card .qr { margin: 4px 0 6px; }
.auth-card .steps { margin: 0 0 18px; padding-left: 20px; color: var(--muted); font-size: 14px; }
.auth-card .alt { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--muted); }
input.code-input { font-size: 24px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; min-height: 54px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 28px 24px 26px; padding-top: max(28px, env(safe-area-inset-top)); }
  .auth-headline { font-size: 26px; margin: 22px 0 0; }
  .auth-areas, .auth-foot { display: none; }
  .auth-form { place-items: start center; padding: 32px 22px; }
}

/* Error page */
.error-box { max-width: 460px; margin: 12vh auto; text-align: center; }
.error-box .code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--line-strong); line-height: 1; margin-bottom: 8px; }

/* ---- GigRealm-inspired touches ------------------------------------------- */
/* Active area: a green rail, not a fill */
.side-link.open, .side-link[aria-current="page"] { background: rgba(255, 255, 255, .08); box-shadow: inset 3px 0 0 var(--green-2); font-weight: 620; }

/* Phone tab bar: four main areas plus More */
.tabbar { display: none; }
@media (max-width: 960px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--navy);
    height: calc(60px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar-item { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: rgba(255, 255, 255, .6); font: 600 10.5px var(--font); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
  .tabbar-item:hover { text-decoration: none; }
  .tabbar-item.on { color: #fff; }
  .tabbar-item.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--green-2); }
  .tabbar-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--bad); color: #fff; font: 700 10px/16px var(--font); font-style: normal; text-align: center; }
  .page { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  /* iOS: 16px inputs never zoom; 44px touch targets */
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=month], input[type=url],
  input[type=search], input[type=tel], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 36px; }
  .list-row { min-height: 48px; }
}
/* A row of small figures that scrolls sideways on phones (e.g. Following) */
@media (max-width: 960px) {
  .grid.strip { display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px var(--gap); padding: 0 16px 4px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .grid.strip::-webkit-scrollbar { display: none; }
  .grid.strip .stat { flex: 0 0 auto; min-width: 118px; padding: 10px 14px; scroll-snap-align: start; }
  .grid.strip .stat .value { font-size: 18px; }
}

/* Desktop: sidebar collapses to a 68px icon rail */
.side-collapse { display: grid; place-items: center; width: 26px; height: 26px; margin-left: auto; border-radius: 7px; border: 0; background: transparent;
  color: rgba(255, 255, 255, .45); cursor: pointer; transform: rotate(180deg); }
.side-collapse:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@media (min-width: 961px) {
  html.side-narrow .side { width: 68px; padding-left: 10px; padding-right: 10px; }
  html.side-narrow .side-brand span, html.side-narrow .side-link span:not(.badge), html.side-narrow .side-sub,
  html.side-narrow .side-user .who, html.side-narrow .side-user form { display: none; }
  html.side-narrow .side-brand { padding: 4px 4px 10px; }
  html.side-narrow .side > .tile-top { flex-direction: column; gap: 6px; }
  html.side-narrow .side-collapse { transform: none; margin: 0 auto 8px; }
  html.side-narrow .side-link { justify-content: center; padding: 10px 0; position: relative; }
  html.side-narrow .side-link .badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  html.side-narrow .side-user { justify-content: center; padding: 10px 0; }
}
@media (max-width: 960px) { .side-collapse { display: none; } }

/* "A newer version is ready" */
.newbuild { position: fixed; top: 0; left: 0; right: 0; z-index: 99; display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 9px 14px; padding-top: max(9px, env(safe-area-inset-top)); background: var(--navy); color: #fff; font: 600 13px/1.4 var(--font);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.newbuild button { background: var(--green-2); color: #fff; border: 0; border-radius: 7px; padding: 5px 14px; font: 700 13px var(--font); cursor: pointer; }

/* Drag the sidebar edge to resize */
.side-resize { position: absolute; top: 0; right: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.side-resize:hover, html.side-resizing .side-resize { background: rgba(63, 165, 143, .5); }
html.side-resizing, html.side-resizing * { cursor: col-resize !important; user-select: none; }
@media (min-width: 961px) { .side { position: sticky; } .side-resize { position: absolute; } }
@media (max-width: 960px) { .side-resize { display: none; } }

/* Life Admin: separate from Med Services, so its own warm colour */
:root { --life: #e8925a; --life-ink: #3b1d0c; }
.side-life { display: flex; align-items: center; gap: 11px; margin: 0 0 8px; padding: 9px 10px; border-radius: 10px; text-decoration: none;
  background: var(--life); color: var(--life-ink); font-size: 14px; font-weight: 650; }
.side-life:hover { text-decoration: none; filter: brightness(1.06); }
.side-life .ext { margin-left: auto; opacity: .6; transform: rotate(-45deg); }
html.side-narrow .side-life { justify-content: center; padding: 10px 0; }
html.side-narrow .side-life span, html.side-narrow .side-life .ext { display: none; }
.btn.life { background: var(--life); border-color: var(--life); color: var(--life-ink); }
.btn.life:hover { filter: brightness(1.06); background: var(--life); }
