/* AccessGP portal. Base tokens and components copied from everwell-portal/public/styles.css at commit e600b09,
   then owned here. Aller with system fallbacks, no external assets.
   COLOUR: a deep, muted navy, deliberately NOT the Everwell portal's bright blue, so the two are told apart at a
   glance. The chart colours (--series-*, --seq-*) are separate: they are data colours, checked for colour-blind
   safety, and a muted navy fails that check as a data colour. */
:root {
  --now: #d93025;           /* calendar "now" line */
  --blue-1: #2f4f7a;        /* buttons, selected tabs: 8.3:1 with white */
  --blue-2: #5b7ba6;        /* hover outlines */
  --blue-ink: #274566;      /* text and links: 9.9:1 on white */
  --blue-deep: #26426a;     /* pressed and hover button face */
  --blue-soft: #e8edf4;
  --blue-line: #c3cfdf;     /* outline of soft blue panels */
  --top-1: #22364f;         /* the header bar: dark at the left… */
  --top-2: #34547d;         /* …a little lighter at the right */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e1e6ee;
  --border-strong: #c9d2de;
  --text: #1b2430;          /* 15.6:1 */
  --muted: #566070;         /* 6.3:1 on white, 5.6:1 on surface-2 */
  --focus: #2b7de9;

  /* Muted status colours. All text colours ≥ 4.5:1 on their tints. */
  --ok: #1e6b3f;      --ok-bg: #e8f4ec;    --ok-border: #bfe0cb;
  --warn: #7a4b00;    --warn-bg: #fff5e3;  --warn-border: #f1d7a1;
  --bad: #9b2c2c;     --bad-bg: #fbeeee;   --bad-border: #efc6c6;
  --neutral: #4f5968; --neutral-bg: #eef1f5; --neutral-border: #d6dce5;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 1px rgba(16, 24, 40, 0.04), 0 2px 10px rgba(16, 24, 40, 0.05);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.06), 0 6px 18px rgba(16, 24, 40, 0.08);
  --ease: 150ms ease;
  --font: "Aller", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-user-select: none; user-select: none; /* a gentle nudge: this is not for copying */
}
input { -webkit-user-select: text; user-select: text; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { max-width: 1680px; padding: 0 24px; }
main { flex: 1; padding-bottom: 32px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
b { font-weight: 700; }

/* Components */
.top { background: linear-gradient(135deg, var(--top-1), var(--top-2)); color: #fff; box-shadow: 0 2px 10px rgba(24, 40, 62, 0.28); }
.top .wrap { max-width: none; padding: 0 24px; }   /* the bar's content spans its full width */
.top-inner { display: flex; align-items: center; gap: 18px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; min-height: 72px; }
.top-actions { margin-left: 0; }
.brands { display: inline-flex; align-items: stretch; gap: 10px; }
.brand { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 7px 12px; line-height: 0; }
.brand img { height: 32px; width: auto; }
.top-title { flex: 1; min-width: 180px; }
.top h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.who { font-size: 13px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255, 255, 255, 0.12); padding: 5px 10px; border-radius: 999px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.auth { max-width: 460px; margin: 36px auto 0; }
.auth h2 { margin: 0 0 6px; font-size: 22px; }
.auth p { margin: 0 0 16px; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input { width: 100%; font: 18px var(--font); padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color var(--ease), box-shadow var(--ease); }
.field input:hover { border-color: var(--blue-2); }
.field input.shake { animation: shake 0.4s ease; border-color: var(--bad); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.form-msg.ok { color: var(--ok); }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, .check:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .fchip:focus-visible, .seg-btn:focus-visible { border-radius: 999px; }
.btn-primary:focus-visible { border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.btn { appearance: none; cursor: pointer; font: 700 15px var(--font); border-radius: var(--radius-sm); padding: 11px 16px; border: 1px solid transparent; min-height: 44px; transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease), opacity var(--ease); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn:active:not([disabled]) { transform: scale(0.98); }
.btn-primary { background: var(--blue-1); color: #fff; width: 100%; box-shadow: 0 1px 2px rgba(24, 40, 62, 0.25); }
.btn-primary:hover:not([disabled]) { background: var(--blue-deep); }
.btn-primary:active:not([disabled]) { background: var(--blue-ink); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover:not([disabled]) { background: var(--blue-soft); }
.btn-ghost:active:not([disabled]) { background: #d9e1ec; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.btn-ghost.is-busy::after { border-color: rgba(39, 69, 102, 0.25); border-top-color: var(--blue-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.top .btn-ghost { border-color: rgba(255, 255, 255, 0.7); color: #fff; background: rgba(255, 255, 255, 0.08); padding: 7px 12px; min-height: 36px; font-size: 14px; }
.top .btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }
.auth .btn-ghost { width: 100%; margin-top: 10px; color: var(--blue-ink); border-color: var(--border); }
.form-msg { margin: 12px 0 0; font-size: 14px; color: var(--muted); min-height: 1.2em; }
.form-msg.err { color: var(--bad); }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue-1); }
.loading { text-align: center; color: var(--muted); margin: 48px 0; }
.tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 2px solid var(--border); }
.tab { appearance: none; cursor: pointer; font: 700 15px var(--font); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 10px 14px; min-height: 44px; border-radius: 8px 8px 0 0; transition: color var(--ease), background var(--ease), border-color var(--ease); }
.tab:hover { color: var(--blue-ink); background: var(--blue-soft); }
.tab:active { transform: translateY(1px); }
.tab[aria-selected="true"] { color: var(--blue-ink); border-bottom-color: var(--blue-1); }
.tab:focus-visible { outline-offset: -3px; }
.notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { padding: 18px 14px; color: var(--muted); font-size: 14px; }
.empty-card { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg-btn { appearance: none; cursor: pointer; font: 600 13px var(--font); color: var(--blue-ink); background: none; border: 0; padding: 7px 14px; min-height: 36px; transition: background var(--ease), color var(--ease); }
.seg-btn:hover { background: var(--blue-soft); }
.seg-btn[aria-pressed="true"] { background: var(--blue-1); color: #fff; }
.seg-btn:focus-visible { outline-offset: -3px; }
.loading-line { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.loading-line::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--blue-1); animation: spin 0.8s linear infinite; }
.fade-in { animation: fadein 150ms ease; }
@keyframes fadein { from { opacity: 0.35; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; -webkit-user-select: text; user-select: text; }
.table-wrap { overflow-x: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; border: 1px solid; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
footer.foot { padding: 14px 16px 24px; font-size: 13px; text-align: center; }
.foot { font-size: 13px; }
.an-controls { display: flex; align-items: flex-end; gap: 10px 14px; margin: 14px 0 14px; flex-wrap: wrap; }
.an-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.an-field input, .an-field select { font: 15px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px; }
.an-controls .btn-ghost { color: var(--blue-ink); border-color: var(--border-strong); background: var(--surface); padding: 8px 14px; min-height: 40px; font-size: 14px; }
.an-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.an-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.an-card .n { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--blue-ink); }
.an-card .l { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.an-card .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.an-card .info { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: 700 12px/1 var(--font); display: grid; place-items: center; cursor: help; }
.an-card .info:hover, .an-card .info:focus-visible { color: var(--blue-ink); border-color: var(--blue-2); background: var(--blue-soft); outline: none; }
.an-card .info:focus-visible { box-shadow: 0 0 0 3px rgba(43, 125, 233, 0.35); }
.an-card .info .tip { position: absolute; right: 0; top: 28px; z-index: 5; width: 240px; background: var(--text); color: #fff; font: 400 12px/1.45 var(--font); padding: 8px 10px; border-radius: 8px; text-align: left; display: none; box-shadow: var(--shadow-hover); }
.an-card .info:hover .tip, .an-card .info:focus-visible .tip, .an-card .info:focus-within .tip { display: block; }
.an-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; margin: 0 0 16px; }
.table .btn-mini { appearance: none; cursor: pointer; font: 600 12px var(--font); color: var(--blue-ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 10px; min-height: 28px; margin-right: 6px; }
.table .btn-mini:hover { background: var(--blue-soft); }
.table .btn-mini.danger { color: var(--bad); }
.table .btn-mini.danger:hover { background: var(--bad-bg); }
.table .btn-mini[disabled] { opacity: 0.5; cursor: not-allowed; }
.table tr.paused td { color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(16, 24, 40, 0.35); display: grid; place-items: center; padding: 16px; animation: fadein 120ms ease; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { appearance: none; border: 0; background: var(--neutral-bg); color: var(--neutral); width: 30px; height: 30px; border-radius: 50%; font: 20px/1 var(--font); cursor: pointer; }
.modal-body { padding: 14px 18px; overflow: auto; }
.modal-body h4 { margin: 12px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.modal-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .btn { width: auto; min-height: 40px; padding: 8px 16px; }
.modal-foot .btn-ghost { color: var(--blue-ink); border-color: var(--border-strong); }
.mfield { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; position: relative; }
.mfield input { font: 15px var(--font); padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px; -webkit-user-select: text; user-select: text; }
.mfield small { font-weight: 400; font-size: 11px; }
.update-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--blue-soft); border: 1px solid var(--blue-line); color: var(--blue-ink); font-size: 14px; font-weight: 600; }
.update-banner .btn-primary { width: auto; min-height: 36px; padding: 7px 14px; font-size: 14px; }
.btn-danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn-danger:hover:not([disabled]) { filter: brightness(0.92); }

/* ---- AccessGP portal additions ------------------------------------------------------------------------------ */
:root {
  /* Chart colours. Categorical order is fixed (never cycled) and checked with the dataviz validator against a
     light surface: brand blue, orange, aqua, yellow. Text never wears these; it stays in the text tokens. */
  --series-1: #30609f; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  /* One hue, light to dark, for "how many". */
  --seq-0: #f1f4f8; --seq-1: #dbe5f1; --seq-2: #b3c8e2; --seq-3: #85a5cf; --seq-4: #5580b8; --seq-5: #2c568f;
  --grid: #e7ebf1;
}
.table, .table td, .table th, .selectable { -webkit-user-select: text; user-select: text; }
.who b { font-weight: 700; }
.role-chip { display: inline-block; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.92); color: var(--blue-ink); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.banner { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.banner.demo { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); font-weight: 600; }
.banner.info { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-ink); }
.auth .steps { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.auth .steps li { flex: 1; padding: 6px 8px; border-radius: 999px; background: var(--neutral-bg); text-align: center; }
.auth .steps li[aria-current="step"] { background: var(--blue-1); color: #fff; }
.auth .steps li.done { background: var(--ok-bg); color: var(--ok); }
.auth.wide { max-width: 620px; }
.auth .confidential { font-size: 13px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.code-input { letter-spacing: 0.3em; font-size: 24px !important; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin: 12px 0 16px; }
.qr-box svg { width: 190px; height: 190px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; display: block; }
.qr-side { flex: 1; min-width: 200px; font-size: 14px; }
.qr-side ol { margin: 0 0 10px; padding-left: 18px; }
.qr-side li { margin: 0 0 6px; }
.manual-key { display: block; font: 600 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; word-break: break-all; -webkit-user-select: all; user-select: all; }

/* Analytics */
.an-presets { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.an-controls .check { margin: 0; font-size: 14px; font-weight: 600; min-height: 40px; }
.an-controls .check input { width: 18px; height: 18px; }
.an-right { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; }
.an-updated { font-size: 13px; color: var(--muted); align-self: center; }
.an-body.is-loading { opacity: 0.45; transition: opacity var(--ease); pointer-events: none; }
.an-h { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.an-h h2 { margin: 0; font-size: 18px; }
.an-h p { margin: 0; font-size: 13px; color: var(--muted); }
.an-card .n { font-size: 28px; }
.an-card .sub b { color: var(--text); font-weight: 700; }
.an-card .info .tip { display: none; }
.an-card .info { cursor: help; }
.an-charts .chart.span2 { grid-column: span 2; }
@media (max-width: 920px) { .an-charts { grid-template-columns: 1fr; } .an-charts .chart.span2 { grid-column: auto; } }
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 12px; box-shadow: var(--shadow); min-width: 0; }
.chart h3 { margin: 0 0 2px; font-size: 15px; }
.chart .chart-sub { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { font: 11px var(--font); fill: var(--muted); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: rgba(58, 109, 181, 0.07); }
.chart .s1 { fill: var(--series-1); } .chart .s2 { fill: var(--series-2); } .chart .s3 { fill: var(--series-3); } .chart .s4 { fill: var(--series-4); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .viz-tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.sw1 { background: var(--series-1); } .sw2 { background: var(--series-2); } .sw3 { background: var(--series-3); } .sw4 { background: var(--series-4); }
.viz-tip { position: fixed; z-index: 80; pointer-events: none; background: var(--text); color: #fff; font: 400 12px/1.45 var(--font); padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow-hover); max-width: 260px; }
.viz-tip .tt { display: block; font-weight: 700; margin-bottom: 4px; }
.viz-tip .row { display: flex; align-items: center; gap: 7px; }
.viz-tip .row b { font-variant-numeric: tabular-nums; min-width: 2.2em; }
.viz-tip .row span { opacity: 0.85; }
details.figures { margin: 8px 0 0; font-size: 13px; }
details.figures summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; font-size: 12px; }
details.figures .table { margin-top: 8px; box-shadow: none; font-size: 12.5px; }
details.figures .table th, details.figures .table td { padding: 6px 8px; }
/* Horizontal bars: name, a thin bar from one baseline, the value at its tip. */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.hbars li { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 10px; align-items: center; font-size: 13px; border-radius: 6px; outline: none; }
.hbars li:hover, .hbars li:focus-visible { background: var(--surface-2); }
.hbars .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .tr { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbars .br { height: 14px; min-width: 2px; background: var(--series-1); border-radius: 0 4px 4px 0; flex-shrink: 0; }
.hbars .vl { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbars .vl small { font-weight: 400; color: var(--muted); margin-left: 5px; }
.chart .none { font-size: 13px; color: var(--muted); padding: 10px 0; }
/* Busy hours: one hue, light to dark. */
.heat { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }
.heat .hd { text-align: center; padding: 0 0 2px; font-variant-numeric: tabular-nums; }
.heat .dn { padding-right: 6px; display: flex; align-items: center; font-weight: 700; }
.heat .cell { height: 24px; border-radius: 4px; background: var(--seq-0); outline: none; }
.heat .cell:hover, .heat .cell:focus-visible { box-shadow: 0 0 0 2px var(--text); }
.heat .l1 { background: var(--seq-1); } .heat .l2 { background: var(--seq-2); } .heat .l3 { background: var(--seq-3); } .heat .l4 { background: var(--seq-4); } .heat .l5 { background: var(--seq-5); }
.heat-key { display: flex; align-items: center; gap: 4px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.heat-key i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.heat-key .k0 { background: var(--seq-0); } .heat-key .k1 { background: var(--seq-1); } .heat-key .k2 { background: var(--seq-2); } .heat-key .k3 { background: var(--seq-3); } .heat-key .k4 { background: var(--seq-4); } .heat-key .k5 { background: var(--seq-5); }
.heat-key .peak { margin-left: auto; color: var(--text); }

/* Admin */
.adm { display: grid; gap: 16px; margin: 16px 0 0; }
.adm > section > h2 { margin: 0 0 4px; font-size: 18px; }
.adm > section > p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.adm-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 12px; }
.adm-add .mfield { flex: 1 1 180px; }
.adm-add .btn { width: auto; min-height: 40px; padding: 8px 16px; }
.mfield select, .table select { font: 15px var(--font); padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px; }
.table select { font-size: 13px; min-height: 32px; padding: 4px 8px; }
.table .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.table td .sub { display: block; font-size: 12px; color: var(--muted); }
.chip.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.chip.off { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.role { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.role.fixed { background: var(--surface-2); }
.role h3 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.role h3 small { font-weight: 400; font-size: 12px; color: var(--muted); }
.role .check { margin: 0; font-weight: 400; font-size: 14px; align-items: flex-start; }
.role .check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.role .acts { display: flex; gap: 8px; margin-top: auto; }
.role .btn { width: auto; min-height: 36px; padding: 6px 14px; font-size: 14px; }
.role .btn-ghost { color: var(--blue-ink); border-color: var(--border-strong); }
.role .btn-ghost.danger { color: var(--bad); }
.role .form-msg { margin: 0; }
.log-controls { display: flex; gap: 10px; align-items: flex-end; margin: 0 0 12px; flex-wrap: wrap; }
.log-controls .btn { width: auto; min-height: 40px; padding: 8px 14px; color: var(--blue-ink); border-color: var(--border-strong); background: var(--surface); font-size: 14px; }
.table.log td { font-size: 13px; }
.table.log code { font-size: 12px; }
.modal.narrow { width: min(520px, 100%); }
.modal-body p { margin: 0 0 12px; }
.modal-foot .btn-danger { background: var(--bad); color: #fff; }
.acct dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.acct dt { color: var(--muted); } .acct dd { margin: 0; font-weight: 700; }

/* ---- Document tab (consult note). Runs in the browser only; see public/document.js. ---- */
/* The title and the timer stay on screen while the form scrolls, as the tools app's timer bar does. */
.doc-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; margin: 6px 0 4px; padding: 10px 0 8px; background: var(--bg); flex-wrap: wrap; }
.doc-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.doc-title h2 { margin: 0; font-size: 18px; }
.doc-title p { margin: 0; font-size: 13px; color: var(--muted); }
.doc-timer { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); transition: background 1.5s ease, border-color 1.5s ease, color 1.5s ease; }
.doc-time { font: 800 30px/1 var(--font); font-variant-numeric: tabular-nums; min-width: 3.6ch; text-align: right; }
.doc-timer.idle .doc-time, .doc-timer.paused .doc-time { opacity: 0.6; }
/* A quiet tint only, never a word: green, then amber for the last fifth, then red once the appointment has run over. */
.doc-timer.green { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.doc-timer.amber { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.doc-timer.red { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }
.doc-tbtn, .doc-length { appearance: none; cursor: pointer; font: 600 13px var(--font); color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 999px; padding: 5px 12px; min-height: 32px; opacity: 0.85; }
.doc-tbtn:hover, .doc-length:hover { opacity: 1; }
.doc-length { padding-right: 10px; }
@media (prefers-reduced-motion: reduce) { .doc-timer { transition: none; } }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; }
.doc-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 14px; }
.doc-field { display: grid; gap: 6px; min-width: 0; }
.doc-label { font-weight: 700; font-size: 14px; }
.doc-field input[type="text"], .doc-field textarea { width: 100%; font: 16px/1.45 var(--font); padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); -webkit-user-select: text; user-select: text; transition: border-color var(--ease), box-shadow var(--ease); }
.doc-field textarea { resize: vertical; min-height: 44px; }
.doc-field input[type="text"]:hover, .doc-field textarea:hover { border-color: var(--blue-2); }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-chip { appearance: none; cursor: pointer; font: 600 13px var(--font); color: var(--blue-ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 12px; min-height: 34px; text-align: left; transition: background var(--ease), color var(--ease), border-color var(--ease); }
.doc-chip:hover { background: var(--blue-soft); }
.doc-chip[aria-pressed="true"] { background: var(--blue-1); border-color: var(--blue-1); color: #fff; }
.doc-chip[aria-pressed="true"]::before { content: "✓ "; }
.doc-choice .seg { justify-self: start; }
.doc-obs-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.doc-obs-box { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.doc-obs-box input[type="text"] { padding: 8px 9px; font-variant-numeric: tabular-nums; }

.doc-side { position: sticky; top: 74px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; max-height: calc(100vh - 86px); grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.doc-private { margin: 0; font-size: 12px; color: var(--muted); }
.doc-side h3 { margin: 0; font-size: 15px; }
.doc-note { margin: 0; padding: 12px 14px; min-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 var(--font); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); -webkit-user-select: text; user-select: text; }
.doc-note.is-empty { color: var(--muted); }
.doc-acts { display: flex; gap: 8px; }
.doc-acts .btn { width: auto; flex: 1; }
.doc-acts .btn-ghost { color: var(--blue-ink); border-color: var(--border-strong); flex: 0 0 auto; }
.doc-status { margin: 0; font-size: 13px; color: var(--warn); }
.doc-status:empty { display: none; }
.doc-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
@media (max-width: 920px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; max-height: none; }
  .doc-obs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* "Semble has changed" cue beside Refresh, when Semble's webhooks are connected. */
.an-live { font-size: 13px; font-weight: 600; color: var(--blue-ink); background: var(--blue-soft); border: 1px solid var(--blue-line); border-radius: 999px; padding: 4px 10px; align-self: center; }
.an-live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--blue-1); }
.adm .sem { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.adm .sem .sub { color: var(--muted); font-size: 13px; }

/* Narrow screens: the header's buttons wrap under the name instead of running off the edge. */
.top-actions { flex-wrap: wrap; max-width: 100%; min-width: 0; }
.top-actions .who { min-width: 0; flex: 0 1 auto; }
.top-actions .btn { white-space: nowrap; }

/* ---- Reviews tab ---- */
.rv-how { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.rv-note { margin: 10px 0 0; font-size: 13px; }
.table.rv td { vertical-align: middle; }
.table.rv .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; max-width: 46ch; }
.table.rv .sub.err { color: var(--bad); }
.table.rv .btn-mini { min-height: 34px; padding: 6px 14px; font-size: 13px; background: var(--blue-1); border-color: var(--blue-1); color: #fff; }
.table.rv .btn-mini:hover:not([disabled]) { background: var(--blue-deep); }
.rv-body.is-loading { opacity: 0.6; }
.rv-mail { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: 14px; }
.rv-mail dt { color: var(--muted); } .rv-mail dd { margin: 0; -webkit-user-select: text; user-select: text; }
.rv-pick { margin: 0 0 12px; align-self: flex-start; }
.modal-body .doc-label { display: block; margin: 0 0 6px; }
