/* Cpp Studio's look: the house style of the NOD Backoffice (light working pages, only the sidebar dark), in the
   platform's own colours, so nobody mistakes the platform for a gym's back office. Every colour is defined once, here. */

:root {
  /* brand */
  --accent: #3fb68b;          /* the platform's green: buttons, the current menu item, highlights */
  --accent-ink: #1f6f52;      /* the green dark enough to read as text and links on a light page */
  --sidebar: #10181d;         /* a blue-black, for the sidebar only */
  /* surfaces */
  --page: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --line: #dde3e3;
  --line-strong: #c3cccc;
  /* text */
  --ink: #141a1d;
  --muted: #5d686d;
  --on-sidebar: #e8eef0;
  --on-sidebar-muted: #9aa8ad;
  --on-accent: #0b1a14;
  /* states */
  --good: #2e7a4c;
  --good-soft: #e5f2ea;
  --warn: #9a620f;
  --warn-soft: #fbf0dc;
  --bad: #b02a22;
  --bad-soft: #fbe7e5;
  --info-soft: #e6eeee;
  /* type */
  --heading: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 29, 0.05), 0 2px 8px rgba(20, 26, 29, 0.04);
  --sidebar-width: 236px;
  /* Buttons beside the main one: a tint that stands out from the words around them. */
  --button: #dff1ea;
  --button-hover: #c9e8dc;
  --button-line: #93cdb6;
  --button-ink: #12392b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--heading); font-weight: 600; line-height: 1.15; margin: 0 0 0.4em; color: var(--ink); }
h1 { font-size: 2.1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.8em; }
small, .muted { color: var(--muted); }
.mono, code, kbd { font-family: var(--mono); font-size: 0.86em; }
.eyebrow { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- The frame: sidebar and page ---------------------------------------------------------------------- */

.frame { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh;
  /* The sidebar's black runs the page's whole height, however long the page. */
  background: linear-gradient(to right, var(--sidebar) var(--sidebar-width), transparent var(--sidebar-width)); }
.sidebar { background: var(--sidebar); color: var(--on-sidebar); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: block; padding: 22px 22px 18px; }
.sidebar .brand img { display: block; max-width: 132px; height: auto; }
.sidebar .brand .name { font-family: var(--heading); font-size: 1.6rem; color: var(--on-sidebar); text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; padding: 4px 12px; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--on-sidebar-muted); text-decoration: none; font-size: 0.95rem; }
.sidebar nav a svg { width: 19px; height: 19px; flex: none; }
.sidebar nav a:hover { color: var(--on-sidebar); background: rgba(232, 238, 240, 0.07); }
.sidebar nav a.on { color: var(--on-accent); background: var(--accent); }
.sidebar .who { margin-top: auto; padding: 16px 22px 20px; border-top: 1px solid rgba(232, 238, 240, 0.1); font-size: 0.85rem; }
.sidebar .who strong { display: block; color: var(--on-sidebar); font-weight: 600; }
.sidebar .who span { color: var(--on-sidebar-muted); }
.sidebar .who .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }
.sidebar .who a, .sidebar .who button.link { color: var(--on-sidebar-muted); font-size: 0.82rem; }
.sidebar .who a:hover, .sidebar .who button.link:hover { color: var(--accent); }

main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; max-width: 1400px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 18px; }
.pagehead h1 { margin: 0; }
.pagehead .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
/* The trail back from wherever a person has drilled to (pages/layout.tsx Breadcrumbs), on every page but home. */
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; list-style: none; margin: 0 0 14px; padding: 0; font-size: 0.86rem; color: var(--muted); }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "›"; margin: 0 9px; color: var(--line-strong); }
.breadcrumb li.back::before { content: none; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumb li[aria-current="page"] { color: var(--ink); max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.breadcrumb li.back { margin-left: auto; padding-left: 16px; }
.breadcrumb li.back a { color: var(--accent-ink); font-weight: 500; }

/* A phone or a small tablet: the sidebar becomes a bar on top with a menu that slides sideways. */
@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; background: none; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .brand { padding: 12px 16px; }
  .sidebar .brand img { max-width: 76px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; width: 100%; padding: 0 8px 8px; scrollbar-width: none; }
  .sidebar nav a { flex: none; padding: 7px 11px; }
  .sidebar nav a svg { display: none; }
  .sidebar .who { display: none; }
  main { padding: 18px 16px 48px; }
  h1 { font-size: 1.7rem; }
}

/* ---- Cards, grids, facts ---------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card > h2:first-child, .card > header:first-child { margin-top: 0; }
.card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.card header h2 { margin: 0; }
.card header .actions { margin-left: auto; display: flex; gap: 8px; }
.stack { display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.split { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--accent); }
.tile .eyebrow { display: block; margin-bottom: 6px; }
.tile .figure { display: block; font-family: var(--heading); font-size: 2.3rem; line-height: 1; }
.tile .sub { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.tile.alert { border-left: 4px solid var(--bad); }
.tile.watch { border-left: 4px solid var(--warn); }

dl.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px 22px; margin: 0; }
dl.fields div { min-width: 0; }
dl.fields dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
dl.fields dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 0.9rem; margin: 0 0 10px; }

/* ---- Badges ----------------------------------------------------------------------------------------- */

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font: 500 0.74rem/1.6 var(--mono); letter-spacing: 0.03em; background: var(--info-soft); color: var(--ink); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.badge.good, .badge.s-active, .badge.ai-ready, .badge.ai-done, .badge.allow, .badge.clean, .badge.joined { background: var(--good-soft); color: var(--good); }
.badge.watch, .badge.s-cancelling, .badge.s-trial, .badge.s-past_due, .badge.ai-queued, .badge.ai-running, .badge.ai-starting, .badge.warn, .badge.suspicious, .badge.waiting, .badge.trial, .badge.contacted, .badge.new { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge.s-frozen, .badge.s-cancelled, .badge.ai-failed, .badge.deny, .badge.hostile, .badge.lost, .badge.turned_away { background: var(--bad-soft); color: var(--bad); }
.badge.plain::before, .badge.s-no_plan::before { display: none; }
.badge.s-frozen { background: #e6eef6; color: #2c5a85; }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 0.78rem; color: var(--muted); }

/* ---- Tables ----------------------------------------------------------------------------------------- */

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font: 500 0.7rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td, tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 0.86rem; }
td .who { display: flex; align-items: center; gap: 10px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---- Filters: a row of tabs with counts, as Gymdesk's ------------------------------------------------- */

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 0.92rem; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a .n { font-family: var(--mono); font-size: 0.75rem; margin-left: 6px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 360px; }
.toolbar form > * { width: auto; }
.toolbar input[type="search"] { flex: 1 1 240px; }
.toolbar select { flex: 0 1 220px; }

/* ---- Forms and buttons ------------------------------------------------------------------------------ */

form.form { display: grid; gap: 14px; }
.fieldset { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
label { display: grid; gap: 5px; font-size: 0.86rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 0.92rem; }
label.wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; min-height: 40px; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent-ink); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184, 164, 122, 0.3); }
[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.82rem; }
.hint { font-size: 0.8rem; color: var(--muted); }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 500 0.92rem/1 var(--sans); padding: 10px 16px; min-height: 40px; border-radius: 8px;
  border: 1px solid var(--button-line); background: var(--button); color: var(--button-ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .button:hover { background: var(--button-hover); border-color: var(--accent-ink); color: var(--ink); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .button.primary:hover { background: #a99567; border-color: #a99567; }
button.dark, .button.dark { background: var(--ink); border-color: var(--ink); color: var(--on-sidebar); }
button.danger, .button.danger { color: var(--bad); border-color: #e6b3ae; background: #fdf3f2; }
button.danger:hover, .button.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-ink); text-decoration: underline; font: inherit; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }
ul.bare { list-style: none; padding: 0; margin: 0; }
ul.bare li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.bare li:last-child { border-bottom: 0; }

.error, .notice, .ok { padding: 11px 14px; border-radius: 8px; margin: 0 0 12px; font-size: 0.92rem; }
.error { background: var(--bad-soft); color: var(--bad); }
.notice { background: var(--warn-soft); color: var(--warn); }
.ok { background: var(--good-soft); color: var(--good); }
.secret { font-family: var(--mono); font-size: 0.9rem; background: var(--surface-2); border: 1px dashed var(--accent); padding: 12px 14px; border-radius: 8px; overflow-wrap: anywhere; }

/* ---- A list of what happened ---------------------------------------------------------------------------- */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .when { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.feed li.new { animation: arrive 1.6s ease-out; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--good); }
.dot.warn { background: #d4a03c; }
.dot.deny { background: var(--bad); }

/* ---- The AI server panel ---------------------------------------------------------------------------- */

.gauge { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--info-soft); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.gauge i { display: block; height: 100%; background: var(--good); }
.gauge.high i { background: #d4a03c; }
.gauge.full i { background: var(--bad); }
.ai-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ai-steps li { display: grid; gap: 2px; padding: 8px 12px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.ai-steps li.step-tool { border-left-color: var(--accent); }
.ai-steps li.step-answer { border-left-color: var(--good); }
.ai-steps li.failed { border-left-color: var(--bad); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; font-size: 0.82rem; }

/* ---- Sign-in ---------------------------------------------------------------------------------------- */

body.plain { display: grid; place-items: center; min-height: 100vh; padding: 20px 16px; }
.signin { width: min(420px, 100%); }
.signin .logo { display: block; margin: 0 auto 26px; max-width: 170px; }
.signin h1 { text-align: center; font-size: 1.9rem; }
.signin .card { padding: 26px; }

/* ---- Toasts and the modal, from the shared script (client/ui.ts) ----------------------------------------- */

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: var(--on-sidebar); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); font-size: 0.92rem; }
.toast a { color: var(--accent); }
.toast.error { background: var(--bad); color: #fff; }
.toast.error a { color: #fff; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.2rem; padding: 0 4px; min-height: 0; }
dialog#modal { border: 0; border-radius: 14px; padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
dialog#modal::backdrop { background: rgba(14, 14, 12, 0.45); }
.modal-body { padding: 22px 24px; }
.just-changed { animation: arrive 1.6s ease-out 3; }

.public-form { max-width: 560px; margin: 0 auto; }
/* ---- Michael's walk-through of the sandbox (27 Oct) ---- */
/* A filter bar: the search and its dropdowns on one line, each only as wide as it needs. */
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.filters input[type="search"] { flex: 1 1 260px; width: auto; max-width: 440px; }
form.filters select { flex: 0 1 auto; width: auto; max-width: 300px; }
.toolbar input[type="search"] { max-width: 560px; }
/* A form on one line: its fields side by side, the button at their foot. */
form.row-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 10px; }
form.row-form label { flex: 1 1 220px; }
form.row-form button { flex: none; }
table.automations td.name { min-width: 14em; }
/* Two dates (or ages) that make a range, each labelled, side by side where there's room. */
fieldset.range { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-content: start; }
fieldset.range > legend { float: left; width: 100%; padding: 0; margin: 0 0 3px; font: inherit; font-size: 0.86rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
/* Who a bulk action is done to. */
.who-gets { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0 0 14px; }
/* A form's fields, then its buttons a little below them; a bulk action's fields keep their width when only one shows. */
.fieldset + .actions { margin-top: 16px; }
section.bulk .fieldset { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
/* While members or leads are checked, a bar at the foot of the window says how many and leads to what can be done. */
.bulk-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px;
  background: var(--ink); color: var(--on-sidebar); border-radius: 999px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25); font-size: 0.92rem; }
.bulk-bar .button { min-height: 34px; padding: 6px 14px; border-radius: 999px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* The menu folded down to its icons (Michael, 27 Oct: "more horizontal space"); the person's choice, in a cookie. */
.sidebar .brand-row { display: flex; align-items: center; justify-content: space-between; }
.sidebar .fold { background: transparent; border: 1px solid rgba(232, 238, 240, 0.2); color: var(--on-sidebar-muted); min-height: 0; width: 28px; height: 28px; padding: 0; margin-right: 14px; border-radius: 6px; font-size: 1rem; flex: none; }
.sidebar .fold:hover { color: var(--accent); border-color: var(--accent); background: transparent; }
body.nav-folded { --sidebar-width: 72px; }
body.nav-folded .sidebar .brand-row { flex-direction: column; gap: 10px; padding-bottom: 6px; }
body.nav-folded .sidebar .brand { padding: 16px 10px 0; }
body.nav-folded .sidebar .brand img { max-width: 50px; }
body.nav-folded .sidebar .fold { margin: 0; }
body.nav-folded .sidebar nav { padding: 4px 10px; }
body.nav-folded .sidebar nav a { justify-content: center; padding: 10px 0; }
/* A grid's or stack's items may be narrower than their widest content, so a wide table scrolls inside its card
   instead of pushing the whole page wider than the window. */
.stack > *, .grid > *, .split > * { min-width: 0; }
.card:has(> table), .card:has(> form > table) { overflow-x: auto; }
/* A file to copy as it is, such as a virtual host: its lines kept whole, scrolled across rather than wrapped. */
pre.config { white-space: pre; overflow-x: auto; overflow-wrap: normal; }
/* An uploaded logo or icon, as it will look: the dark sidebar's logo on the dark. */
.brand-preview { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: 48px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.brand-preview.on-dark { background: var(--sidebar); border-color: var(--sidebar); }
.brand-preview img { display: block; max-width: 160px; max-height: 48px; }
/* ---- Charlie (pages/charlie.tsx): the chat, with the person's other chats beside it ---- */
.charlie-split { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .charlie-split { grid-template-columns: 1fr; } }
.chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.chat:empty { display: none; }
.said { display: grid; gap: 4px; max-width: 86%; }
.said.me { justify-self: end; }
.said .who { font: 0.72rem var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.said.me .who { text-align: right; }
.bubble { padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.said.me .bubble { background: var(--ink); color: var(--on-sidebar); border-color: var(--ink); }
.said.me .bubble p { margin: 0; white-space: pre-wrap; }
.said.me.pending { opacity: 0.7; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 1.02rem; margin: 1em 0 0.35em; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 0.8em; }
.prose table { margin: 0 0 0.8em; font-size: 0.86rem; }
.prose th, .prose td { padding: 6px 8px; }
.chat-intro .examples { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.chat-intro .examples button.link { text-align: left; white-space: normal; }
/* The box stays at the foot of the window while a long chat is read. */
.chat-ask { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 10px; margin-top: 16px; padding: 12px 0 4px; background: var(--surface); }
.chat-ask textarea { min-height: 48px; resize: vertical; }
.chat-ask select { width: auto; max-width: 200px; }
.chat-list h2 { font-size: 1.05rem; }
.chat-list li a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: var(--ink); }
.chat-list li a:hover { color: var(--accent-ink); text-decoration: underline; }
.chat-list li.on a { font-weight: 600; color: var(--accent-ink); }
.chat-list li small { display: block; }
/* Charlie at work: the robot breathing, the dots, and the clock. */
.charlie-working { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--surface)); color: var(--ink); }
.charlie-working svg { width: 22px; height: 22px; flex: none; color: var(--accent-ink); animation: charlie-breathe 1.6s ease-in-out infinite; }
.charlie-working .dots { display: inline-flex; gap: 4px; }
.charlie-working .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); animation: blink 1.2s infinite both; }
.charlie-working .dots i:nth-child(2) { animation-delay: 0.2s; }
.charlie-working .dots i:nth-child(3) { animation-delay: 0.4s; }
.charlie-working .clock { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
/* On the menu, while he answers a question asked on another page. */
.sidebar nav a { position: relative; }
.sidebar nav a.busy::after { content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite both; }
.sidebar nav a.on.busy::after { background: var(--on-accent); }
body.nav-folded .sidebar nav a.busy::after { right: 6px; top: 8px; margin-top: 0; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes charlie-breathe { 0%, 100% { transform: scale(1); opacity: 0.75; } 50% { transform: scale(1.12); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .charlie-working svg, .charlie-working .dots i, .sidebar nav a.busy::after { animation: none; } }
.badge.held { background: #e6eef6; color: #2c5a85; }
/* The look (pages/tenant.tsx Looks): a sketch of each of NOD's themes, in the gym's own colours, to pick from. */
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.look { position: relative; display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--ink); }
.look input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.look:hover { border-color: var(--line-strong); }
.look:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.look:has(input:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.sketch { display: grid; grid-template-columns: 26% 1fr; height: 116px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.sketch .side { display: flex; flex-direction: column; gap: 6px; padding: 12px 8px; background: var(--sketch-sidebar); }
.sketch .side i { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.sketch .side i:first-child { background: var(--sketch-accent); }
.sketch .main { position: relative; display: flex; flex-direction: column; gap: 7px; padding: 12px; background: #f4f5f3; }
.sketch .main b { position: relative; width: 45%; height: 7px; border-radius: 3px; background: #1d1f1e; opacity: 0.75; }
.sketch .main span { position: relative; flex: 1; border-radius: 5px; background: #fff; border: 1px solid #e1e3df; }
.sketch.lightning { border-color: #2a2a2a; }
.sketch.lightning .side { background: #050505; }
.sketch.lightning .main { background: #0b0b0b; }
.sketch.lightning .main b { background: #f1f1ef; }
.sketch.lightning .main span { background: rgba(22, 22, 22, 0.88); border-color: #2b2b2b; }
.sketch .bolts { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--sketch-accent); opacity: 0.55; }
/* Pick-up points (pages/tenant.tsx PickupPoints): one list per gym, the first the usual one. */
ol.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ol.points li { display: flex; align-items: center; gap: 6px; }
ol.points li input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; }
ol.points li:first-child::after { content: "usual"; order: 1; flex: none; padding: 2px 9px; border-radius: 999px; font: 500 0.72rem/1.6 var(--mono); background: var(--good-soft); color: var(--good); }
ol.points .point-tools { order: 2; display: flex; gap: 4px; flex: none; }
ol.points .point-tools button { min-height: 32px; width: 32px; padding: 0; font-size: 1rem; }
ol.points li:first-child [data-point-move="-1"], ol.points li:last-child [data-point-move="1"] { visibility: hidden; }
/* The checklist (pages/tenant.tsx StepRow): one quiet line a step, its status pill the control (Michael, 12 Nov). */
.step-group { margin-top: 18px; }
.step-group h3 { margin: 0 0 4px; }
ul.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 8.2em minmax(0, 1fr) auto; align-items: start; gap: 2px 14px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-body { display: grid; gap: 2px; min-width: 0; }
.step-body .hint, .step-note { font-size: 0.8rem; }
.step-note { color: var(--ink); }
.step-note a, .step-add, .note-editor a { color: var(--accent-ink); font-size: 0.8rem; }
.step-add { padding-top: 2px; white-space: nowrap; text-decoration: none; }
.step-add:hover { text-decoration: underline; }
.step-pick { margin: 0; }
.step-state { appearance: none; -webkit-appearance: none; width: auto; max-width: 100%; min-height: 0; padding: 3px 24px 3px 11px; border: 1px solid transparent; border-radius: 999px;
  font: 500 0.75rem/1.6 var(--mono); letter-spacing: 0.02em; cursor: pointer; white-space: nowrap;
  background: var(--warn-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235d686d' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 9px center / 9px; }
/* Every pill the same width, whatever its choices, so the column reads straight down. */
.step-pick, .step-pick .step-state, span.step-state { width: 100%; }
span.step-state { display: inline-block; padding-right: 11px; background-image: none; cursor: default; }
.step-state.s-todo { background-color: var(--warn-soft); color: var(--warn); }
.step-state.s-waiting { background-color: #e6eef6; color: #2c5a85; }
.step-state.s-done { background-color: var(--good-soft); color: var(--good); }
.step-state.s-not_needed { background-color: var(--info-soft); color: var(--muted); }
.step-state:hover { border-color: var(--line-strong); }
.step-state:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; box-shadow: none; }
.note-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 4px 0 0; }
.note-editor[hidden] { display: none; }
.note-editor input { flex: 1 1 220px; width: auto; min-height: 32px; padding: 4px 8px; font-size: 0.86rem; }
.note-editor button.link { font-size: 0.8rem; }
@media (max-width: 640px) {
  .step { grid-template-columns: 7.6em minmax(0, 1fr); }
  .step-add { grid-column: 2; padding-top: 0; }
}
