/* Arbot operator dashboard — token-based stylesheet.
   Light is the default; dark follows prefers-color-scheme. No external fonts. */

/* Base tokens (bg/surface/text/accent/border/status/shadow) plus the fonts come
   from the shared Tidewater design system — /static/design/tidewater.css, linked
   before this file in every shell. Only the dashboard-specific chart palette
   lives here, kept 3-state (system/light/dark) so charts recolour on toggle. */
:root {
  --grid: rgba(58, 40, 24, 0.10);
  /* chart series: outcomes (status-coloured). Waitlist is blue, never the terracotta
     accent: that sits OKLab dE 3.8 from failed, one colour once they are lines (ar-2jx). */
  --c-success: #4f7a3a;
  --c-waitlist: #2a6fb0;
  --c-failed: #c0342a;
  /* User errors, the member's own to fix (ar-jcjt): purple, for marks only (3.58:1 here,
     4.13:1 on the dark surface; never text). Not the Bots detector violet #6250d6/#9085e9:
     against the waitlist blue it is OKLab dE 11.6 / 9.5 to normal vision (floor 15) and
     6.9 / 5.3 under protan/deutan (target 8), and four unstacked lines cross, so every pair
     meets. This step clears blue by 18.8 / 18.4 and 9.2 / 10.6, and green and red by more
     (dataviz validate_palette.js --pairs all on #fffdf8 / #241c15). */
  --c-user-error: #a668e8;
  /* chart series: categorical slots, fixed order */
  --s1: #bb4a2a;
  --s2: #e08a2c;
  --s3: #4f7a3a;
  --s4: #2e7d9a;
  --s5: #c2568e;
  --s-other: #9a8876;
  /* Telegram's blue (ar-if5z), the app's Notifications page values. Light takes its
     deeper #1a78aa: the badge is the only sign of a link, and #229ed9 clears the 3:1
     non-text bar on white by 0.02. */
  --tg: #1a78aa;
  --tg-soft: #e2f1fa;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grid: rgba(220, 190, 160, 0.14);
    --c-success: #7fb86a;
    --c-waitlist: #6aa8f0;
    --c-failed: #f0897e;
    --c-user-error: #a35fd6;
    --s1: #e8815a;
    --s2: #e0a24a;
    --s3: #7fb86a;
    --s4: #6fb6d6;
    --s5: #e58ab5;
    --s-other: #c2b2a0;
    --tg: #2aabee;
    --tg-soft: rgba(42, 171, 238, 0.16);
  }
}

/* Explicit dark (the theme toggle stamps data-theme="dark"), so dark works even
   on a light OS. Mirrors the prefers-dark chart palette above. */
:root[data-theme="dark"] {
  --grid: rgba(220, 190, 160, 0.14);
  --c-success: #7fb86a;
  --c-waitlist: #6aa8f0;
  --c-failed: #f0897e;
  --c-user-error: #a35fd6;
  --s1: #e8815a;
  --s2: #e0a24a;
  --s3: #7fb86a;
  --s4: #6fb6d6;
  --s5: #e58ab5;
  --s-other: #c2b2a0;
  --tg: #2aabee;
  --tg-soft: rgba(42, 171, 238, 0.16);
}

/* Floating theme toggle (System / Light / Dark), injected on every page. */
.theme-fab {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.theme-fab:hover { border-color: var(--accent); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--tw-aurora);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 var(--tw-font-body);
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-family: var(--tw-font-display); font-weight: 500; font-size: 22px; letter-spacing: -.01em; }
h2 { font-family: var(--tw-font-display); font-weight: 500; font-size: 16px; }
h3 { font-size: 13px; color: var(--text-2); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
button { font: inherit; }
input, select { font: inherit; color: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 16px; padding-block: 20px; }

/* ---- top nav ---- */
.nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.nav .wrap { display: flex; align-items: center; gap: 18px; padding-block: 10px; }
.brand { font-family: var(--tw-font-display); font-weight: 500; font-size: 17px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 5px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav-links a:hover { background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.nav-right .btn { white-space: nowrap; } /* Sign out stays one line on a phone */

/* ---- sign-in page (ar-5xd7) ---- */
.login-card { max-width: 360px; margin: 12vh auto 0; display: grid; gap: 14px; }
.login-card p { margin: 0; }

/* ---- page header ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head .spacer { flex: 1; }
.stamp { color: var(--muted); font-size: 12px; }

/* ---- buttons, inputs ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.input, select.input {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); min-width: 0;
}
.input:focus, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 11px; color: var(--text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .label { color: var(--muted); font-size: 12px; }

/* ---- users header counts (ar-v8gh): two of them are filters, pressed when applied ---- */
.head-counts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.count-btn {
  padding: 1px 9px; font: inherit; cursor: pointer;
  background: transparent; color: var(--accent-ink);
  border: 1px solid var(--border); border-radius: 999px;
}
.count-btn:hover, .count-btn[aria-pressed="true"] { background: var(--accent-soft); }
.count-btn[aria-pressed="true"] { border-color: var(--accent); font-weight: 600; }
.count-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- users filter bar (ar-v8gh): selects, and checklists that open like a menu ----
   Compact, and no control is wider than the bar or than what it says (ar-6w08): a select
   sizes to its chosen option where field-sizing is supported (else to its longest, as
   before), and a checklist's picks clip with an ellipsis inside its own border, the
   whole list in the tooltip. The clip is on the bordered summary itself, a plain block,
   so it holds whatever an engine makes of display on a <summary>. */
.filters { position: relative; gap: 6px; }
.filters > * { min-width: 0; max-width: 100%; }
.filters .input { padding: 4px 8px; font-size: 13px; }
.filters select.input { field-sizing: content; }
.filters .on, .filters .on > summary { border-color: var(--accent); }
.flt-multi { position: relative; }
.filters .flt-multi > summary {
  display: block; position: relative; max-width: 200px; padding-right: 22px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer; list-style: none; user-select: none;
}
.flt-multi > summary::-webkit-details-marker { display: none; }
.flt-multi > summary::after { content: "▾"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.flt-multi > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.flt-val { color: var(--accent-ink); }
.flt-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; display: grid; min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.flt-pop label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.flt-pop label:hover { background: var(--surface-2); }
/* A phone opens every checklist full width under the bar, so none runs off the screen. */
@media (max-width: 720px) {
  .flt-multi { position: static; }
  .flt-pop { right: 0; }
}

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.card + .card, .section + .section { margin-top: 16px; }
.section { margin-top: 20px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-head .hint { color: var(--muted); font-size: 12px; }

/* ---- KPI grid ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-family: var(--tw-font-display); font-size: 27px; font-weight: 600; margin-top: 2px; line-height: 1.15; }
.kpi .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi.accent .value { color: var(--accent-ink); }
.kpi.success .value { color: var(--success); }

/* ---- registration delay card (ar-7v4x): the Off/On and Random are the .seg control ---- */
.delay-card { margin-bottom: 20px; }
.delay-card .toolbar { margin-bottom: 0; }
.delay-field { display: inline-flex; align-items: center; gap: 6px; }
/* the member's Registration order switch (ar-z514), on their page: the same .seg */
.order-card .toolbar { margin-bottom: 8px; }
.order-card p { color: var(--text-2); margin: 0; font-size: 13px; }
.order-card .seg button:disabled { opacity: .5; cursor: default; }
#delay-seconds { width: 5em; }
.delay-card .seg button:disabled, .delay-card .input:disabled { opacity: .5; cursor: default; }
#delay-status.err { color: var(--danger); }

/* ---- the first month free (ar-j4oe): a real switch, the good green when on ----
   Track and knob are tokens, so dark follows: off is --muted under a --surface knob
   (3.2:1 light, 3.9:1 dark), on is --success (5.6:1 / 7.6:1). */
.fm-switch { display: flex; align-items: center; gap: 16px; }
.fm-text { flex: 1; min-width: 0; }
.fm-card h3 { font-size: 15px; color: var(--text); }
.fm-text p { margin: 4px 0 0; color: var(--text-2); }
.switch {
  flex: none; display: inline-flex; width: 52px; height: 30px; padding: 3px;
  border: 0; border-radius: 999px; background: var(--muted); cursor: pointer;
}
.switch-knob { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--success); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(22px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:disabled { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .switch-knob { transition: none; } }
.fm-state { flex: none; min-width: 2em; font-weight: 600; color: var(--text-2); }
.fm-state.on { color: var(--success); }
#fm-status { margin: 8px 0 0; }
#fm-status.err { color: var(--danger); }
.fm-going { margin-top: 14px; }
.kpis.fm-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 8px 0; }
#fm-note { margin: 0; }
/* At the top of Users nothing spaces it from the filter bar under it; .delay-card does the same (ar-oou5). */
#free-month { margin-bottom: 20px; }

/* ---- Lover mode (ar-610s): a checkbox per member on Users, a switch on their page ----
   The rose is the aurora's (a token, the same in both themes) taken a fifth toward the
   ink, so the control holds 3:1 on the card in both: 4.0:1 light (3.3:1 on a hovered
   row), 6.7:1 dark; the aurora's rose alone is 2.9:1 on the light card. Text stays in
   its own colours (4.5:1). A browser without color-mix() draws its own accent. The
   checkbox's label fills its cell, at least 44 px wide and the row's height, so the list
   keeps its tight rows (ar-ipl). */
:root { --lover: color-mix(in srgb, var(--tw-aurora-rose) 80%, var(--text)); }
#users-table th.lover-col, #users-table td.lover-cell { text-align: center; }
.lover-pick { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 30px; margin: -4px -6px; cursor: pointer; }
.lover-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--lover); cursor: pointer; }
.lover-pick input:disabled { cursor: progress; }
.switch.lover[aria-checked="true"] { background: var(--lover); }
.lover-note { margin: 8px 0 0; }

/* ---- charts ---- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.charts .span2 { grid-column: 1 / -1; }
.charts > .card + .card { margin-top: 0; } /* the grid's gap spaces them; a grid item's margin does not collapse (ar-n955) */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.chart-card h2 { font-size: 14px; }
.chart-card .sub { color: var(--muted); font-size: 12px; margin: 2px 0 10px; }
.chart-box { position: relative; height: 240px; transition: opacity .15s; }
.busy { opacity: .45; transition: opacity .15s; }
.chart-row { display: flex; gap: 16px; align-items: center; }
.chart-row .chart-box { flex: 1 1 0; min-width: 0; height: 200px; }
.legend-list { list-style: none; margin: 0; padding: 0; min-width: 150px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend-list .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend-list .n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-2); }
details.twin { margin-top: 8px; }
details.twin summary { cursor: pointer; color: var(--muted); font-size: 12px; user-select: none; }
details.twin table { font-size: 12px; margin-top: 6px; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 4px; text-align: center; }
.chart-box .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* ---- windows list (ARB-383: a window names its intents) ----
   The time a window opens is still the row; the intents behind it hang under it on a rule.

   Every colour here is measured against the COMPOSITED card ground (the glass fill
   over the page ground, rgb(253,250,244) light / rgb(36,28,22) dark), not against
   --surface: --text 15.55:1 / 14.01:1, --text-2 7.17:1 / 8.14:1, --accent-ink (the
   member link and the "+N more" pill) 6.72:1 / 8.34:1, and .win-dead's --text on
   --surface-2 13.27:1 / 14.62:1. The pill's hover state is --accent-ink on
   --accent-soft, 5.60:1 / 6.43:1.

   Deliberately NOT used for anything new: --muted, which is only 3.27:1 on this
   ground, and .chip-muted / .chip-warn / .chip-success / .chip-danger, which are
   ARB-382's still-open family (2.79–4.42:1 in light). That is also why the bucket's
   relative time moved off --muted onto --text-2 — same element, one declaration,
   3.27:1 → 7.17:1. .win-dead carries its alarm in a --danger-mark BORDER, which is
   decoration and answers to the 3:1 non-text bar, never in the text colour. */
.win-list { list-style: none; margin: 0; padding: 0; }
.win-bucket { padding: 9px 0; border-bottom: 1px solid var(--grid); }
.win-bucket:last-child { border-bottom: 0; }
.win-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.win-head .win-opens { font-weight: 600; }
.win-list .rel { color: var(--text-2); font-size: 12px; }
.win-head .n { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
/* A date (ar-r52p) is the level above its times: a bolder line on the panel's --grid
   rule, its times indented under it. A gap ends a date, since its last time has no rule. */
.win-date + .win-date { margin-top: 14px; }
.win-date-head { padding: 4px 0 6px; border-bottom: 1px solid var(--grid); font-weight: 700; }
.win-hours { list-style: none; margin: 0; padding: 0 0 0 14px; }
.win-intents { list-style: none; margin: 6px 0 0; padding: 0; }
.win-intents li {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 3px 0 3px 12px; margin-left: 1px; border-left: 2px solid var(--border);
}
.win-who { font-weight: 600; }
.win-class { overflow-wrap: anywhere; }
.win-where, .win-when, .win-tags { color: var(--text-2); font-size: 12px; }
.win-where { overflow-wrap: anywhere; }
.win-tags { margin-left: auto; display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
/* Two classes on purpose: .chip is declared LOWER in this file and sets both
   `color` and a transparent `border`, so a single-class .win-dead would lose the
   ink and the red line to it at equal specificity. */
.chip.win-dead { background: var(--surface-2); color: var(--text); border-color: var(--danger-mark); }
.chip.win-dead::before { background: var(--danger-mark); }
/* A day's user error (ar-jcjt), on the same recipe: the text stays --text, the chart's
   purple is only the line and the dot. */
.chip.user-error { background: var(--surface-2); color: var(--text); border-color: var(--c-user-error); }
.chip.user-error::before { background: var(--c-user-error); }
.win-more {
  margin: 6px 0 0 14px; padding: 1px 9px; font-size: 12px; cursor: pointer;
  background: transparent; color: var(--accent-ink);
  border: 1px solid var(--border); border-radius: 999px;
}
.win-more:hover { background: var(--accent-soft); }
.win-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Registrations per day (ar-bj7): a day with registrations opens to them, listed in
   the window recipe above. The toggle is --accent-ink, the same ink as the member link. */
.day-toggle {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent-ink); white-space: nowrap;
}
.day-toggle .chev { display: inline-block; transition: transform .15s; }
.day-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.day-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
#users-table { min-width: 720px; }
#regs-table { min-width: 760px; }
#users-table td:first-child { white-space: nowrap; }
/* A member's registrations: the gym folded under the class and narrower gutters keep the
   table inside the card at desktop widths (it was 1244 px in 1134 px); narrower, the class
   name wraps before the table scrolls (ar-7lb4). */
#regs-table th, #regs-table td { padding-inline: 6px; }
/* The users list is scanned, not read: tight rows and gutters keep all eleven columns
   inside the card at laptop widths instead of scrolling sideways (ar-ipl). */
#users-table th { padding: 6px; }
#users-table td { padding: 4px 6px; }
#users-table .who-cell { gap: 8px; }
/* Since the badges beside a name, Last seen and its sort arrow, that no longer held: the
   table ran 113 px past the card at every laptop width, cutting off the last headers
   (ar-6w08). Before it scrolls, a header wraps onto two lines (its arrow kept on the last
   word) and a name's badges drop under it. */
#users-table th { white-space: normal; vertical-align: bottom; }
#users-table .who-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
/* A long name or address ends in an ellipsis instead of widening the table, the whole of it
   on hover (a Hebrew name is cut at its own end: dir=auto). A number never breaks. */
#users-table .who-name a, #users-table .clip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#users-table .clip { display: block; }
#users-table td.num { white-space: nowrap; }
#users-table .avatar { width: 22px; height: 22px; font-size: 9px; }
th {
  text-align: left; font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th[aria-sort="ascending"]::after { content: "\00a0\2191"; }
th[aria-sort="descending"]::after { content: "\00a0\2193"; }
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td, tr.row-link:focus-within td { background: var(--surface-2); }
tr.row-link[aria-selected="true"] td { background: var(--accent-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
td.nowrap, .nowrap { white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.pager .spacer { flex: 1; }

/* ---- chips & badges ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 7px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent; background: var(--surface-2); color: var(--text-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip-muted { background: var(--surface-2); color: var(--muted); }
/* A first month free (ar-j4oe), in .badge-beta's info pair: 4.61:1 light, 5.55:1 dark. */
.chip-info { background: var(--info-bg); color: var(--info); }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge-user { color: var(--muted); font-weight: 500; }
.badge-admin { background: var(--accent-soft); color: var(--accent-ink); }
.badge-friend { background: var(--success-soft); color: var(--success); }
.badge-tester { background: var(--warn-soft); color: var(--warn); }
.badge-beta { background: var(--tw-info-soft); color: var(--tw-info); }
.badge-default { background: var(--accent-soft); color: var(--accent-ink); }
/* A member who deleted their own account (ar-gpc). Same recipe as .win-dead: the
   text stays --text on --surface-2 and the alarm is a --danger-mark line, which only
   has to clear the 3:1 non-text bar, never the danger ink ARB-382 left at 2.79:1. */
.badge-deleted, .badge-blocked { color: var(--text); box-shadow: inset 0 0 0 1px var(--danger-mark); }
/* A member nobody has let in yet (ar-eqw6), on the same recipe with the warn line, and
   one whose gym wants its health declaration signed (ar-hbtb). */
.badge-wall, .badge-health { color: var(--text); box-shadow: inset 0 0 0 1px var(--warn-mark); }
.let-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 14px; }
.let-in .hint { color: var(--text-2); font-size: 13px; max-width: 460px; }
/* Telegram linked (ar-if5z): the glyph alone, so it widens a name by one icon instead of
   adding a column to the table. */
.tg-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none; vertical-align: middle;
  width: 18px; height: 18px; border-radius: 50%; background: var(--tg-soft); color: var(--tg);
}
.tg-glyph { width: 11px; height: 11px; fill: currentColor; }
.tg-on { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; } /* a long handle wraps, the page stays put */

/* ---- avatars ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; vertical-align: middle; line-height: 1;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--surface); user-select: none;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-more { background: var(--surface-2); color: var(--muted); font-size: 10px; }
.avatar-placeholder { background: var(--surface-2); color: var(--muted); box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px var(--border); }
.avatar-stack { display: inline-flex; align-items: center; flex: none; vertical-align: middle; }
.avatar-stack.stacked .avatar + .avatar { margin-left: -9px; }
.avatar-stack.stacked .avatar:hover { position: relative; z-index: 1; }
tr.row-link:hover .avatar, tr.row-link:focus-within .avatar { box-shadow: 0 0 0 2px var(--surface-2); }
tr.row-link[aria-selected="true"] .avatar { box-shadow: 0 0 0 2px var(--accent-soft); }
.who-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ---- banners & toast ---- */
.banner {
  border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center;
}
.banner .spacer { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(8px);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 100; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: var(--danger-on); }

/* ---- user page ---- */
.user-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.user-head .who h1 { font-size: 20px; overflow-wrap: anywhere; }
.who-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who-row > .avatar-slot { display: inline-flex; width: 64px; height: 64px; flex: none; }
.who-text { min-width: 0; }
.user-head .who .email { color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.user-head .who .sub-id { color: var(--muted); margin-top: 4px; }
.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 13px; align-items: center; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; }
.role-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 20px; font-weight: 600; }
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acct { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.acct .head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acct .head-text { min-width: 0; flex: 1; }
.acct .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.acct .gym { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.acct .meta { margin-top: 8px; }
.acct .counts { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.acct .counts b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.danger-zone { border-color: var(--danger-mark); }
.danger-zone h2 { color: var(--danger); }
.danger-zone p { color: var(--text-2); margin: 6px 0 12px; font-size: 13px; }

/* ---- drawer & timeline ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  z-index: 50; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease-out;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 15px; overflow-wrap: anywhere; }
.drawer-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.drawer-head .close { margin-left: auto; }
.drawer-body { overflow-y: auto; padding: 14px 16px 24px; flex: 1; }
.drawer-body .meta { margin-bottom: 16px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 18px 28px; }
.tl li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--grid); }
.tl li:last-child::before { display: none; }
.tl .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--muted); }
.tl .k-accent .dot { border-color: var(--accent); }
.tl .k-success .dot { border-color: var(--success-mark); background: var(--success-mark); }
.tl .k-warn .dot { border-color: var(--warn-mark); }
.tl .k-danger .dot { border-color: var(--danger-mark); background: var(--danger-mark); }
.tl .k-now .dot { border-color: var(--text); border-style: dashed; }
.tl .when { font-size: 12px; color: var(--muted); }
.tl .when .rel { margin-left: 6px; }
.tl .lbl { font-weight: 600; }
.tl .lbl .chip { margin-left: 6px; }
.tl .why { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.tl details { margin-top: 4px; }
.tl summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.tl pre { margin: 4px 0 0; padding: 8px; background: var(--surface-2); border-radius: 6px; font-size: 11px; overflow-x: auto; }

/* ---- dialog ---- */
dialog {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  padding: 20px; max-width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog p { margin: 8px 0 16px; color: var(--text-2); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
#block-reason { display: block; width: 100%; margin: 4px 0 16px; }

/* ---- phone ---- */
@media (max-width: 720px) {
  .charts { grid-template-columns: 1fr; }
  .user-head { grid-template-columns: 1fr; }
  .chart-row { flex-direction: column; align-items: stretch; }
  .nav .wrap { gap: 10px; }
  .nav-right .stamp { display: none; }
  .nav-ci { display: none; } /* the tabs already fill a phone's nav (ar-vs7.3) */
  /* The tabs do not fit beside the brand on a phone (ar-z824): they wrap to a second
     row instead of pushing the page sideways at 320px or breaking "Bots Detector"
     over two lines at 390px, every tab in sight. */
  .nav-links { flex-wrap: wrap; row-gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .toast, .chart-box { transition: none; }
}

.btn-xs { font-size: 11px; padding: 2px 8px; line-height: 1.4; vertical-align: middle; margin-left: 4px; }

/* Build-version footer injected by the server into every page shell. */
.app-version {
  margin: 2.5rem auto 1.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted, #6b7280);
  opacity: 0.65;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* New-users-per-week: who signed up + modal list. */
.wk-who .wk-user { color: var(--accent); text-decoration: none; }
.wk-who .wk-user:hover { text-decoration: underline; }
.wk-more {
  margin-left: 6px;
  background: var(--bg-2, rgba(124,108,255,.12));
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .78em;
  font-weight: 600;
  cursor: pointer;
}
.wk-more:hover { background: var(--accent); color: var(--accent-on); }
.wk-user-list { list-style: none; margin: 8px 0 16px; padding: 0; max-height: 50vh; overflow-y: auto; }
.wk-user-list li { padding: 6px 0; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.wk-user-list a { color: var(--accent); text-decoration: none; }
.wk-user-list a:hover { text-decoration: underline; }

/* ---- Tidewater glass surfaces (match the app) ----
   Placed last so it wins over the solid var(--surface) backgrounds above. */
.nav {
  background: var(--tw-glass-strong);
  -webkit-backdrop-filter: blur(var(--tw-glass-blur)) saturate(1.3);
  backdrop-filter: blur(var(--tw-glass-blur)) saturate(1.3);
  border-bottom: 1px solid var(--tw-glass-border);
}
.kpi, .card, .chart-card {
  background: var(--tw-glass-bg);
  -webkit-backdrop-filter: blur(var(--tw-glass-blur)) saturate(1.3);
  backdrop-filter: blur(var(--tw-glass-blur)) saturate(1.3);
  border-color: var(--tw-glass-border);
  border-radius: var(--tw-radius);
  box-shadow: var(--tw-shadow-sm);
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav, .kpi, .card, .chart-card { background: var(--surface); }
}

/* --- Tabs on the user page (ARB-282) ------------------------------------- */
.tabs { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  font: inherit; font-size: 14px; font-weight: 600; padding: 10px 16px; border: 0; background: none;
  cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* The tabs overflow a phone (ar-usbu). Tighter, the first four share one row from 375px
   up and Audit log (ar-so0h) wraps to a second; nothing hides off the edge. */
@media (max-width: 720px) {
  .tabs { gap: 0; flex-wrap: wrap; }
  .tab { padding: 10px 8px; font-size: 13px; }
}

/* --- Finance tab --------------------------------------------------------- */
.stat .stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.mem-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mem-plan { font-family: var(--font-display, inherit); font-size: 19px; font-weight: 600; }
.mem-bar { height: 7px; border-radius: 999px; background: var(--surface-2); margin: 14px 0 6px; overflow: hidden; }
.mem-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.mem-bar-ends { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.mem-meta { margin-top: 14px; }
tr.row-muted td { color: var(--muted); }

/* --- Membership history (ARB-284) --------------------------------------- */
.periods { list-style: none; margin: 0; padding: 0; }
.periods li { display: grid; grid-template-columns: 12px 1fr auto; gap: 14px; padding: 12px 0; align-items: start; border-bottom: 1px solid var(--border); }
.periods li:last-child { border-bottom: 0; }
.periods .mark { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--success); }
.periods .mark.comp { background: var(--accent); }
.periods .mark.grant { background: var(--muted); }
.periods .p-title { font-weight: 600; font-size: 14px; }
.periods .p-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.periods .p-amt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; white-space: nowrap; }

/* ---- finance (Option B of the finance mock, 2026-10-10) ----
   Chart series: revenue is the accent, spend a saturated blue; the pair was run through
   the colourblind validator on this dashboard's light and dark surfaces (the softer teal
   slot --s4 fails the chroma floor, hence its own token). Dark steps are selected, not
   flipped. */
:root { --c-revenue: #bb4a2a; --c-spend: #2b7bb0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-revenue: #d06a44; --c-spend: #4a9bd4; } }
:root[data-theme="dark"] { --c-revenue: #d06a44; --c-spend: #4a9bd4; }
.fin-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 760px) { .fin-hero { grid-template-columns: 1fr; } }
.fin-figure .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fin-figure .big { font-family: var(--tw-font-display); font-size: 44px; font-weight: 600; line-height: 1.05; margin-top: 4px; overflow-wrap: anywhere; }
.fin-figure.pos .big { color: var(--success); }
.fin-figure.neg .big { color: var(--danger); }
.fin-figure .eq { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.fin-figure .eq b { color: var(--text); }
.fin-figure .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.fin-figure .mini .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fin-figure .mini .v { font-weight: 600; }
.fin-statement h2 { font-size: 14px; margin: 0 0 6px; }
.fin-statement .line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.fin-statement .line b { font-variant-numeric: tabular-nums; }
.fin-statement .line.total { font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }
.fin-board .kpi .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fin-board .kpi.net.pos .value { color: var(--success); }
.fin-board .kpi.net.neg .value { color: var(--danger); }
.delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--success); }
.delta.bad { color: var(--danger); }
.delta.flat { color: var(--muted); }
.spark { display: block; width: 100%; height: 26px; margin-top: 6px; }
.meter { margin-top: 8px; }
.meter .track { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 999px; background: var(--accent); }
.meter.warn .track { background: var(--tw-warn-soft); }
.meter.warn .fill { background: var(--tw-warn); }
.meter .cap { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 5px; }
.meter .cap b { color: var(--text); }
.fin-gaps { margin-top: 8px; font-size: 12px; color: var(--text-2); }
/* tableHTML right-aligns every column after the first (.num); the ledger's Note is prose. */
#vendors th:last-child, #vendors td:last-child { text-align: left; }

/* ---- Audit log (ar-dbpf): the approved mock, Main.dc.html, in the dashboard's tokens.
   No inline style anywhere (the CSP forbids it): a category's colour is its class. ---- */
:root {
  --cat-signin: #bb4a2a; --cat-booking: #296f89; --cat-rules: #7a4f9a; --cat-account: #8f5e15;
  --cat-payments: #4a7337; --cat-admin: #2a1e15; --cat-notifications: #1a78aa;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cat-signin: #e8815a; --cat-booking: #6fb6d6; --cat-rules: #c29be0; --cat-account: #e0a24a;
    --cat-payments: #7fb86a; --cat-admin: #f3e9dc; --cat-notifications: #2aabee;
  }
}
:root[data-theme="dark"] {
  --cat-signin: #e8815a; --cat-booking: #6fb6d6; --cat-rules: #c29be0; --cat-account: #e0a24a;
  --cat-payments: #7fb86a; --cat-admin: #f3e9dc; --cat-notifications: #2aabee;
}
.cat-signin { background: var(--cat-signin); }
.cat-booking { background: var(--cat-booking); }
.cat-rules { background: var(--cat-rules); }
.cat-account { background: var(--cat-account); }
.cat-payments { background: var(--cat-payments); }
.cat-admin { background: var(--cat-admin); }
.cat-notifications { background: var(--cat-notifications); }
.res-ok { background: var(--success); }
.res-refused { background: var(--warn); }
.res-limited, .res-error { background: var(--danger); }

main.audit { max-width: 1376px; display: flex; flex-direction: column; gap: 18px; }
main.audit > .banner { margin: 0; }
main.audit.loading .audit-tiles, main.audit.loading .audit-events { opacity: .45; transition: opacity .15s; }
.audit-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.audit-title { display: flex; flex-direction: column; gap: 4px; }
.audit-title h1 { font-size: 34px; font-weight: 600; line-height: 1.15; }
.audit-title p { margin: 0; color: var(--text-2); font-size: 15px; }
.audit-tools, .audit-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.audit-custom { flex-basis: 100%; justify-content: flex-end; color: var(--text-2); font-size: 13px; }
.audit-range, .audit-custom label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.audit-tools .input, .audit-custom .input { height: 44px; padding: 0 12px; border-radius: 12px; border-color: var(--tw-gray-line); color: var(--text); }
.audit-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 500; }
.audit-btn.btn-primary { font-weight: 600; }

.audit-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.audit-tiles .kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.audit-tiles .kpi .label { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); }
.audit-tiles .kpi .value { margin-top: 0; font-size: 28px; font-variant-numeric: tabular-nums; }
.audit-tiles .kpi .sub { margin-top: 0; font-size: 13px; }

.audit-filters { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.af-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.audit-filters > .af-row:first-child { gap: 10px 16px; }
.af-label { width: 84px; margin-right: 8px; color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.af-search { position: relative; flex: 1 1 300px; min-width: 0; max-width: 560px; }
.af-search svg { position: absolute; left: 13px; top: 14px; color: var(--text-2); pointer-events: none; }
.af-search .input { width: 100%; height: 44px; padding: 0 12px 0 38px; border-radius: 12px; border-color: var(--tw-gray-line); background: var(--bg); }
.af-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.af-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.af-member { display: inline-flex; align-items: center; gap: 2px; padding-left: 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.af-member button { min-width: 36px; min-height: 36px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.af-clear { margin-left: auto; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.af-member button:focus-visible, .af-clear:focus-visible, .pill:focus-visible, .ag-sort:focus-visible, .ag-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--tw-gray-line); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer;
}
.pill[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.pill:disabled { cursor: default; border-style: dashed; background: transparent; color: var(--text-2); }
.pill-n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.pill[aria-pressed="true"] .pill-n { color: inherit; opacity: .8; }
.pill-dot, .cat-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.pill[aria-pressed="true"] .pill-dot { box-shadow: 0 0 0 1px var(--surface); } /* the Admin dot is the pill's own ink */

.audit-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.audit-body > .card { margin-top: 0; }
.audit-events { flex: 999 1 640px; min-width: 0; padding: 0; overflow: hidden; scroll-margin-top: 72px; }
.audit-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ag { min-width: 1000px; }
.ag-row {
  display: grid; grid-template-columns: 104px minmax(150px, 1.1fr) 104px minmax(250px, 2.2fr) 128px minmax(170px, 1.2fr) 92px;
  align-items: center; padding: 0 8px; border-top: 1px solid var(--grid);
}
.ag-head { background: var(--surface-2); border-top: 0; }
.ag-row.sel { background: var(--accent-soft); }
.ag-cell { padding: 10px 8px; min-width: 0; }
.ag-head .ag-cell { padding: 0; }
.ag-sort {
  width: 100%; min-height: 44px; padding: 0 8px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); cursor: pointer;
}
.ag-head [aria-sort="ascending"] .ag-sort, .ag-head [aria-sort="descending"] .ag-sort { color: var(--text); }
.ag-head .ag-took .ag-sort { justify-content: flex-end; }
.ag-time { font-weight: 500; font-variant-numeric: tabular-nums; }
.ag-sub { font-size: 12px; font-weight: 400; color: var(--text-2); }
.ag-who { font-weight: 500; overflow-wrap: anywhere; }
.ag-action { display: flex; align-items: flex-start; gap: 10px; }
.ag-action .cat-dot { margin-top: 7px; }
.ag-what { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ag-pick {
  padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--tw-gray-line); text-underline-offset: 3px;
}
.ag-req { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.ag-took { padding-right: 16px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.site-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--tw-gray-line); font-size: 12px; font-weight: 500; }
.chip-status { font-weight: 500; font-variant-numeric: tabular-nums; }
.audit-events > .empty { padding: 40px 24px; }
.audit-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.audit-pager { display: flex; gap: 8px; }

.audit-details { flex: 1 1 340px; min-width: min(300px, 100%); padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 72px; }
.audit-details h2 { font-size: 20px; font-weight: 600; }
.ad-head { display: flex; flex-direction: column; gap: 8px; }
.ad-head h2 { font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.ad-kicker { color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ad-chips, .ad-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-chips { gap: 6px; }
.ad-fields { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ad-fields > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--grid); }
.ad-fields dt { color: var(--text-2); font-size: 13px; }
.ad-fields dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.ad-empty { margin: 0; color: var(--text-2); }
.audit-attrib { margin: 0; text-align: center; font-size: 12px; color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { main.audit.loading .audit-tiles, main.audit.loading .audit-events { transition: none; } }

/* ---- a member's Audit log tab (ar-so0h): the mock UserAuditTab.dc.html. The pills, dots,
   site pill, result chips and checkboxes are the Audit log page's own classes above. ---- */
:root { --by-worker: #1f5a70; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --by-worker: var(--info); } }
:root[data-theme="dark"] { --by-worker: var(--info); }
.ua { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.ua > .banner { margin: 0; }
.ua-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.ua-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ua-title h2 { font-size: 22px; font-weight: 600; }
.ua-title span, .ua-kept, .ua-note { color: var(--text-2); font-size: 13px; }
.ua-full { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.ua-controls { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ua-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ua-row + .ua-row { gap: 4px 20px; }
.ua-range { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--text-2); font-size: 13px; }
.ua-range .input { height: 44px; padding: 0 12px; border-radius: 12px; border-color: var(--tw-gray-line); color: var(--text); }
.ua-note { margin: 0; }
.ua-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.ua-body.loading .ua-list, .ua-body.loading .ua-glance { opacity: .45; transition: opacity .15s; }
.ua-list { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ua-list > .empty { padding: 40px 24px; }
.ua-day { display: flex; flex-direction: column; gap: 8px; }
.ua-day-head { display: flex; align-items: baseline; gap: 10px; padding: 0 4px; }
.ua-day-head h3 { font-size: 15px; color: var(--text); }
.ua-day-head span { color: var(--text-2); font-size: 13px; }
.ua-items { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.ua-item + .ua-item { border-top: 1px solid var(--grid); }
.ua-item.open { background: var(--surface-2); }
.ua-main { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 16px; }
.ua-time { font-weight: 500; font-variant-numeric: tabular-nums; padding-top: 1px; }
.ua-what { min-width: 0; display: flex; gap: 10px; align-items: flex-start; }
.ua-what .cat-dot { margin-top: 7px; }
.ua-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ua-line { font-weight: 600; overflow-wrap: anywhere; }
.ua-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ua-src { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.by-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.by-worker { background: var(--info-bg); color: var(--by-worker); }
.by-owner { background: var(--accent-soft); color: var(--accent-ink); }
.ua-end { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.ua-toggle { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; justify-content: center; font-size: 13px; font-weight: 500; }
.ua-details {
  margin: 0 16px 14px 102px; padding: 12px 14px; border-radius: 12px; background: var(--bg);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px;
}
.ua-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ua-field .k { color: var(--text-2); font-size: 12px; }
.ua-field .v { font-size: 13px; overflow-wrap: anywhere; }
.ua-trace { align-self: end; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
button.ua-trace:not(.btn) { padding: 0; border: 0; background: none; color: var(--accent-ink); cursor: pointer; }
button.ua-trace:not(.btn):hover { text-decoration: underline; }
.ua-toggle:focus-visible, .ua-trace:focus-visible, .ua-full:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ua-glance { flex: 1 1 300px; min-width: min(280px, 100%); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.ua-glance h3 { font-family: var(--tw-font-display); font-size: 19px; color: var(--text); }
.ua-glance dl { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.ua-glance dl > div { display: flex; flex-direction: column; gap: 3px; padding-bottom: 12px; border-bottom: 1px solid var(--grid); }
.ua-glance dt { color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ua-glance dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
/* A phone: the time and the result share the top line, and the event takes the width under it. */
@media (max-width: 600px) {
  .ua-main { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 12px; }
  .ua-time { grid-area: 1 / 1; align-self: center; }
  .ua-end { grid-area: 1 / 2; }
  .ua-what { grid-area: 2 / 1 / 3 / 3; }
  .ua-details { margin: 0 12px 12px; }
}
@media (prefers-reduced-motion: reduce) { .ua-body.loading .ua-list, .ua-body.loading .ua-glance { transition: none; } }

/* ---- Arbox requests (ar-kwap) ----
   A purpose keeps its colour on every range: the dataviz reference slots 1-6 in the page's
   order, then Release red (slot 8) and the Bots detector violet (slot 7, ar-irpc), and the
   neutral grey for Other and any purpose the page does not know. Red clears both modes only
   beside blue or violet, and not beside the grey, so Release sits between Gym linking and the
   Bots detector. Validated as a stack on this dashboard's surfaces (#fffdf8 / #241c15), the
   grey's own low chroma aside: worst adjacent CVD dE 7.2 (green/red, light: the 6-8 band, held
   by the 2px gaps, the legend, the key and the table twin) / 8.4, normal vision 19.6 / 16.1.
   Light aqua, yellow and magenta sit under 3:1 on the surface, so the chart keeps its legend
   and its table twin. Green and the grey hold in dark. */
:root {
  --purpose-rule_sync: #2a78d6; --purpose-overview: #eb6834; --purpose-roster_sweep: #1baf7a;
  --purpose-worker_book: #eda100; --purpose-probe: #e87ba4; --purpose-link: #008300;
  --purpose-rule_sync_release: #e34948; --purpose-bot_detector: #6250d6; --purpose-other: #898781;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --purpose-rule_sync: #3987e5; --purpose-overview: #d95926; --purpose-roster_sweep: #199e70;
    --purpose-worker_book: #c98500; --purpose-probe: #d55181;
    --purpose-rule_sync_release: #e66767; --purpose-bot_detector: #9085e9;
  }
}
:root[data-theme="dark"] {
  --purpose-rule_sync: #3987e5; --purpose-overview: #d95926; --purpose-roster_sweep: #199e70;
  --purpose-worker_book: #c98500; --purpose-probe: #d55181;
  --purpose-rule_sync_release: #e66767; --purpose-bot_detector: #9085e9;
}
/* What each purpose counts (ar-irpc): every label the page knows, its colour and one line.
   Plain text, so it reads the same with a keyboard, a tap or a screen reader. --text-2, never
   --muted: the explanation is the news here. */
.purpose-key { columns: 17rem; column-gap: 24px; margin-top: 12px; }
.purpose-key li { align-items: flex-start; break-inside: avoid; }
.purpose-key .sw { margin-top: 3px; }
.purpose-key .what, .key-note { color: var(--text-2); }
.key-note { font-size: 12px; margin: 6px 0 0; }
.arbox-tiles { margin-bottom: 12px; }
/* Over the budget is the arbot-arbox-reads alert firing, a warning (its severity label). */
.arbox-tiles .kpi.over .value { color: var(--warn); }
/* tableHTML right-aligns every column after the first; these last columns are prose. */
#t-result th:last-child, #t-result td:last-child, #t-endpoint th:last-child, #t-endpoint td:last-child { text-align: left; }

/* ---- Gyms and Memberships (ar-spgd): a list, and one gym's or plan's rules. Secondary
   text is --text-2, never --muted: the line of what applies is the page's news. ---- */
.rules-intro { color: var(--text-2); margin: 0 0 12px; max-width: 72ch; }
.rules-table td { vertical-align: top; }
/* Narrow gutters keep the gym list's four columns inside a 360 px phone. */
.rules-table th, .rules-table td { padding-inline: 6px; }
.rules-table td:first-child { overflow-wrap: anywhere; }
.applies-line { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.gym-id { margin-left: 6px; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.rules-head { display: grid; gap: 12px; }
.rules-head .meta dt { color: var(--text-2); }
.applies { margin: 0; display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--grid); }
.applies-label { color: var(--text-2); font-size: 12px; }
#applies { font-weight: 600; overflow-wrap: anywhere; }
.rules-form { display: grid; gap: 18px; margin-top: 12px; }
.rules-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.rules-form legend, .rules-form .legend { display: block; font-weight: 600; padding: 0; margin-bottom: 6px; }
.rules-form .hint { color: var(--text-2); font-size: 12px; margin: 0 0 8px; }
.rules-form .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.rules-form fieldset:disabled, .rules-form .input:disabled { opacity: .5; }
.num-in { width: 6em; }
.day-boxes { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.day-boxes label { display: inline-flex; align-items: center; gap: 5px; }
.lims { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.lim { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-bottom: 8px; border-bottom: 1px solid var(--grid); }
.lim .lim-count { width: 5em; }
.lim .lim-type { flex: 1 1 10em; }
.lim .badge { white-space: normal; }
.lim-note { flex-basis: 100%; color: var(--text-2); font-size: 12px; }
.ctype .ct-name { flex: 0 1 12em; }
.ctype .ct-default { display: inline-flex; align-items: center; gap: 4px; }
.badge-arbox { background: var(--tw-info-soft); color: var(--tw-info); }
.badge-here { background: var(--accent-soft); color: var(--accent-ink); }
/* A dashboard count the gym's refusal named otherwise: the .badge-wall recipe. */
.badge-mismatch { color: var(--text); box-shadow: inset 0 0 0 1px var(--warn-mark); }
.notes { display: block; }
.notes textarea { width: 100%; resize: vertical; font: inherit; }
.save-row { margin: 0; }
#save-status.err { color: var(--danger); }

/* ---- Watchdog (ar-v1qz): boards 9 (Rules) and 10 (Activity) ----
   Tokens only, so dark follows. Text stays --text or --text-2 (ARB-382's chip inks are
   too faint); a level's or the pill's colour is a mark or a dot beside its text. */
.wd-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; }
.wd-pill[data-state="watching"] { background: var(--success-soft); }
.wd-pill[data-state="watching"] .wd-dot { background: var(--success); }
.wd-pill[data-state="stopped"] { box-shadow: inset 0 0 0 1px var(--danger-mark); }
.wd-pill[data-state="stopped"] .wd-dot { background: var(--danger-mark); }
.wd-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.wd-dot.ok { background: var(--success); }
.wd-dot.wait { background: var(--warn-mark); }
.wd-dot.error { background: var(--danger-mark); }
.wd-tabs { display: inline-flex; gap: 6px; }
.wd-tabs a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; }
.wd-tabs a[aria-current="page"] { background: var(--text); color: var(--surface); }
.wd-telegram { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.wd-rules, .wd-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wd-rule, .wd-entry { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.wd-rule-text, .wd-entry-body { flex: 999 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wd-rule-when { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.wd-thresholds { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.wd-thresholds input { width: 5.5em; margin-left: 4px; }
.wd-rule-status { font-size: 12px; color: var(--text-2); }
.wd-rule-status:empty { display: none; }
.wd-acts { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 6px; }
/* An action is a switch (ar-jvkq): off is muted and struck through, on wears its kind's
   colour (board 9's chips), each pair one the dashboard's chips already use. */
.wd-act { padding: 4px 10px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; text-decoration: line-through; cursor: pointer; }
.wd-act[aria-pressed="true"] { text-decoration: none; color: var(--text); }
.wd-act[aria-pressed="true"][data-act="telegram"] { background: var(--tg-soft); }
.wd-act[aria-pressed="true"][data-act="rca"] { background: var(--warn-soft); color: var(--warn); }
.wd-act[aria-pressed="true"][data-act="claude"] { background: var(--accent-soft); color: var(--accent-ink); }
.wd-act[aria-pressed="true"][data-act="member"] { background: var(--danger-soft); color: var(--danger); }
.wd-act:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wd-act:disabled { opacity: .6; cursor: default; }
.wd-claude-key { margin-top: 6px !important; }
.wd-claude-cap { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.wd-claude-cap input { width: 5.5em; margin: 0 4px; }
.wd-notes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.wd-notes .card { flex: 1 1 360px; }
.wd-notes .card + .card { margin-top: 0; }
.wd-notes h2 { margin: 0 0 4px; font-size: 14px; }
.wd-notes p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.wd-entry:target { box-shadow: 0 0 0 2px var(--accent); }
.wd-entry-when { flex: 0 0 96px; display: flex; flex-direction: column; gap: 2px; }
.wd-entry-when span { font-size: 12px; color: var(--text-2); }
.wd-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wd-level { padding: 1px 8px; border-radius: 5px; background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 800; }
.wd-level.failed { box-shadow: inset 0 0 0 1px var(--danger-mark); }
.wd-level.late { box-shadow: inset 0 0 0 1px var(--warn-mark); }
.wd-level.unknown { box-shadow: inset 0 0 0 1px var(--accent); }
.wd-level.ok { box-shadow: inset 0 0 0 1px var(--success-mark); }
.wd-saw { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.wd-links { margin: 0; font-size: 13px; }
.wd-did { flex: 1 1 240px; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.wd-did li { display: flex; align-items: center; gap: 8px; }
.wd-kept { margin: 12px 0 0; font-size: 13px; color: var(--text-2); }

/* ---- Messages (ar-pjaa): compose and the Sent log, the mocks Compose.dc.html and Log.dc.html ----
   The ticks are tokens: sent is the faint ink (3.3:1 on the light card, 4.1:1 dark, over the
   3:1 a mark needs), read is the waitlist blue (5.2:1 / 6.8:1). OK is --success on
   --success-soft (4.6:1 / 5.4:1); Urgent is --danger-on on --danger and Pinned the
   .badge-tester pair (4.6:1 / 5.6:1). The CSP takes no style attribute, so every look is here. */
:root { --tick-sent: var(--muted); --tick-read: var(--c-waitlist); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.msg-views { display: inline-flex; gap: 6px; }
.msg-views a { padding: 6px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 700; }
.msg-views a:hover { text-decoration: none; }
.msg-views a[aria-current="page"] { background: var(--text); color: var(--surface); }
.msg-compose { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.msg-compose > .card + .card { margin-top: 0; }
.msg-form { flex: 999 1 520px; min-width: 0; display: grid; gap: 16px; padding: 20px; }
.msg-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.msg-label { display: block; padding: 0; font-family: var(--tw-font-body); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.msg-optional { font-weight: 500; text-transform: none; letter-spacing: 0; }
.msg-desc { font-size: 13px; color: var(--text-2); }
.msg-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.msg-opt:has(input:checked) { border: 1.5px solid var(--text); font-weight: 700; }
.msg-opt input, .msg-pin input { accent-color: var(--text); }
.msg-kind { flex: 1 1 220px; align-items: flex-start; padding: 10px 14px; }
.msg-kind > span, .msg-pin > span { display: grid; gap: 2px; }
.msg-kind .msg-desc, .msg-pin .msg-desc { font-weight: 400; }
.msg-kind.urgent b { color: var(--danger); }
.msg-kind.urgent input { accent-color: var(--danger); }
.msg-pin { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); cursor: pointer; }
.msg-pin input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.msg-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.msg-picks:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
#pick-chips { display: contents; }
.msg-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 3px 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.msg-chip button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; }
.msg-chip button:hover { background: var(--border); }
.msg-chip button:focus-visible { outline: 2px solid var(--accent); }
.msg-pick-add { flex: 1 1 200px; min-width: 0; }
.msg-pick-add input { width: 100%; min-height: 32px; border: 0; background: transparent; padding: 0 6px; outline: none; }
.msg-gym select { width: 100%; max-width: 420px; min-height: 40px; }
.msg-field { display: grid; gap: 6px; }
.msg-field .input { width: 100%; min-height: 42px; font-size: 15px; }
textarea.input { resize: vertical; line-height: 1.5; font: inherit; font-size: 15px; }
.msg-count { justify-self: end; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.msg-send { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.msg-send .btn { min-height: 44px; padding: 0 20px; font-weight: 700; }
#send-note.err { color: var(--danger); font-weight: 600; }
.msg-preview { flex: 1 1 280px; min-width: 0; display: grid; gap: 12px; background: var(--surface-2); }
.msg-preview p { margin: 0; }
.msg-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.msg-card.pinned { background: var(--warn-soft); border-color: var(--warn-mark); }
.msg-card.urgent { background: var(--danger-soft); border-color: var(--danger-mark); }
.msg-card-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.msg-card-text b, .msg-card-text span { overflow-wrap: anywhere; }
.msg-card-text span { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-card-btn { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 700; }
.msg-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; padding: 0; font-size: 13px; color: var(--text-2); }
.msg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tick { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tick-sent { color: var(--tick-sent); }
.tick-read { width: 20px; color: var(--tick-read); }
.msg-ok { padding: 1px 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 800; white-space: nowrap; }
.msg-log { padding: 0; overflow: hidden; }
#sent-table { min-width: 860px; font-size: 14px; }
#sent-table th { padding: 11px 14px; background: var(--surface-2); }
#sent-table td { padding: 11px 14px; vertical-align: top; }
.msg-row.open td { background: var(--surface-2); border-bottom: 0; }
.msg-toggle { padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 700; text-align: start; cursor: pointer; overflow-wrap: anywhere; }
.msg-toggle::after { content: " \25B8"; color: var(--text-2); }
.msg-toggle[aria-expanded="true"]::after { content: " \25BE"; }
.msg-toggle:hover { text-decoration: underline; }
.msg-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg-from { display: block; font-size: 12px; color: var(--text-2); }
.msg-withdrawn { color: var(--text); font-weight: 600; }
.badge-urgent { background: var(--danger); color: var(--danger-on); }
.badge-pinned { background: var(--warn-soft); color: var(--warn); }
.msg-regular, .msg-not-asked { color: var(--text-2); }
.msg-owed { color: var(--danger); font-weight: 700; }
.msg-detail td { background: var(--surface-2); padding: 0 14px 14px; }
.msg-people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.msg-people li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 9px 14px; border-top: 1px solid var(--grid); }
.msg-people li:first-child { border-top: 0; }
.msg-who { flex: 0 1 200px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.msg-when { font-size: 13px; color: var(--text-2); }
.msg-detail-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.msg-capped, .msg-foot { margin: 10px 0 0; }
.msg-capped { padding: 0 14px 12px; }
/* By email (ar-hk1k, EmailCompose.dc.html and EmailLog.dc.html). Send it's checkboxes are
   kind cards; the preview's email is the mock's card, its button the ink pill (--surface on
   --text); Email only is .badge in --text. An email sent is --text-2 and a failed one
   --danger, as .msg-owed. */
.msg-kind input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.msg-pv { display: grid; gap: 10px; }
.msg-pv h3 { margin: 0; }
.msg-email { display: grid; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.msg-email-head { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--grid); font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.msg-email-head b { color: var(--text); }
.msg-email-title { margin-top: 4px; font-size: 15px; }
.msg-email-body { display: grid; gap: 12px; padding: 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-email-text { white-space: pre-line; }
.msg-email-btn { justify-self: start; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--surface); font-weight: 700; }
.msg-email-foot { font-size: 12px; color: var(--text-2); }
.badge-email { color: var(--text); font-weight: 800; }
.msg-row.open .badge-email { background: var(--surface); } /* the open row is --surface-2 itself */
.mail { width: 20px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.msg-mail { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.msg-mail-failed { color: var(--danger); font-weight: 700; }
.msg-email-failed { display: block; font-size: 12px; color: var(--danger); font-weight: 700; }
.msg-when:has(+ .msg-mail) { min-width: 200px; }

/* ---- RCAs of failed registrations (ar-dxo9, boards 7 and 8 of the approved mocks) ----
   Tokens only, so dark follows. A Failed dot's popover sits at the dot inside the chart box
   (app.js places it, under the sticky nav); its RCA is the mock's ink pill, --bg on --text. */
.rca-link { font-weight: 700; }
.rca-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rca-pop {
  position: absolute; z-index: 10; box-sizing: border-box; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.rca-pop[hidden] { display: none; }
.rca-pop:focus { outline: none; } /* focused when it opens, so Esc and a screen reader find it; its links keep their ring */
.rca-pop h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.rca-pop-note, .rca-pop-msg { margin: 0; color: var(--text-2); font-size: 12px; }
.rca-pop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rca-pop li { display: flex; align-items: center; gap: 10px; }
.rca-pop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; overflow-wrap: anywhere; }
.rca-pop-text span { color: var(--text-2); font-size: 12px; }
.rca-pop .rca-link {
  flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  border-radius: 999px; background: var(--text); color: var(--bg); font-size: 12px;
}
.rca-pop .rca-link:hover { text-decoration: none; opacity: .88; }
/* The RCA page: one column of the mock's cards, a phone's width included. */
.rca-page { max-width: 760px; }
.rca-back { display: inline-block; margin-bottom: 12px; font-weight: 600; }
.rca { display: flex; flex-direction: column; gap: 14px; }
.rca .card + .card { margin-top: 0; } /* the column's gap spaces them */
.rca-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Who wrote it and when: --text-2 (7.17:1 / 8.14:1 on the card), never .stamp's --muted (3.27:1). */
.rca-by { color: var(--text-2); font-size: 12px; }
.rca h1 { font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.rca-meta { margin: 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.rca-sec { display: flex; flex-direction: column; gap: 6px; }
.rca-sec h2 { font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.rca-sec p { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.rca-tl { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.5; }
.rca-done { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.rca-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--grid); }
.rca-add label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; min-width: 0; }
.rca-add .label { color: var(--text-2); font-size: 12px; }
#rca-add-status.err { color: var(--danger); }
.rca-evidence { background: var(--surface-2); border-radius: 10px; padding: 12px 16px; }
.rca-evidence summary { cursor: pointer; font-weight: 600; }
.rca-evidence p { margin: 8px 0 0; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.rca-kb { margin: 0; font-size: 14px; }
@media (max-width: 720px) { .rca h1 { font-size: 22px; } }
