/* AESOP Tactical — dark design system (standalone, no aesop_ui dependency).
   Same tokens as the AESOP family (aesop_arena, aesop_wargame), amber-keyed:
   the arena is blue because it builds, this is amber because it fights.

   THE TOKENS — every stylesheet of this service (ops.css, plan.css, lobby.css, a page's own) reads these;
   a colour or a font size written as a literal is a defect waiting to drift.
     surfaces   --bg                the page
                --bg-secondary      cards, panels, the rows of a list
                --bg-elevated       what sits on a card: inputs' fill, chips, the explainer, a raised button
                --surface-tooltip   floating things: the (i) bubble, toasts, the map's tooltips
                --map-bg            behind a map while its cells draw
     lines      --border            hairlines between everything
                --border-strong     a bubble's or a key cap's outline
                --border-input      the edge of a field, a select or a switch's track: 3:1 against the page and a card
     text       --text-bright       titles and values · --text-primary  body · --text-secondary  labels, table heads
                --text-muted        meta and hints (4.5:1 on every surface, the amber-tinted cards included)
                --on-accent  text drawn on the amber fill
     accent     --accent · --accent-highlight · --accent-soft   selection, the primary action, the focus ring
     states     --success · --warning · --danger · --danger-text (red that reads as text on the dark surfaces)
                --info              the sensor cyan (a band, a sensor envelope)
                --path              a planned route (lime)
     rows       --row-highlight     the row that matters (the weakest link, the relevant track)
                --row-good          the best row (the recommended COA)
     type       --font (the page, and every control) · --mono (code, key caps, seat codes)
                --fs-2xs .7rem · --fs-xs .72rem · --fs-sm .76rem · --fs-md .85rem   the body is 14px; nothing in px;
                nothing is written under .7rem, the floor of a text that carries information (ui-static-33)
     shape      --radius (cards) · --radius-sm (buttons, inputs, alerts) · --focus (the keyboard ring)
     layout     --navbar-height     zero when the top line is folded away; every layout reads it

   THE SHARED COMPONENTS (defined below, for every page — do not redefine them in a page's stylesheet):
     .btn (-primary, -ghost, -lg, [disabled])   .badge (-ok, -warn, -no, -level) — a status word, never a button
     .alert (-danger, -warn, -ok) — .refuse-card and .warn-card are its two historical names
     .messages / .message-{success,info,warning,error}   Django's messages, announced and dismissable
     .section-title (an h2 that opens a section) · .block-title (an h3 that heads a panel or a block)
     .data-table (every table of figures) · .kv (a key/value table) · .table-wrap (a wide table scrolls in it)
     .card · .panel (folds) · .explainer · .field / .field-row / .segmented / .switch · progress
     utilities: .inline · .mt-s · .mt-1 · .sr-only — a field's width is its page's (gm.css: .w-5, .w-6, .w-full)  */
:root {
  color-scheme: dark;                 /* the browser's own controls (spinners, pickers, scrollbars) are dark too */
  --bg: #0f1117;
  --bg-secondary: #171a23;
  --bg-elevated: #1e222d;
  --surface-tooltip: #262b38;
  --map-bg: #0b0e14;
  --border: #2a2f3d;
  --border-strong: #3a4152;
  --border-input: #636a7d;            /* 3.5:1 on --bg, 3.2:1 on --bg-secondary (browser_admin-15) */
  --text-primary: #e6e8ef;
  --text-secondary: #b8bccb;
  --text-muted: #979daf;              /* ≥ 4.5:1 on --bg-elevated, --surface-tooltip and an --accent-soft card */
  --text-bright: #ffffff;
  --on-accent: #101010;
  --accent: #f59e0b;
  --accent-highlight: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-text: #fca5a5;
  --info: #22d3ee;
  --path: #a3e635;
  --row-highlight: #2a1f14;
  --row-good: #14211a;
  --fs-2xs: .7rem;
  --fs-xs: .72rem;
  --fs-sm: .76rem;
  --fs-md: .85rem;
  --navbar-height: 52px;
  --radius: 8px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  accent-color: var(--accent);        /* checkboxes, radios and range thumbs the page does not draw itself */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-primary); font-family: var(--font); font-size: 14px; line-height: 1.55; }
/* The browser draws controls in its own font (Arial) unless told otherwise: one typeface for a <button class="btn">
   and an <a class="btn"> side by side. */
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-highlight); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text-bright); margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
code { font-family: var(--mono); font-size: .85em; color: var(--text-secondary); }
em { color: var(--text-bright); font-style: italic; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-md); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.inline { display: inline; }
.mt-s { margin-top: .4rem; } .mt-1 { margin-top: 1rem; }

/* Navbar — one line on a wide screen; below 760px the links, the user and Sign out fold into a menu (ui.js). */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-height); z-index: 1000;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg)); border-bottom: 1px solid var(--border); }
.navbar-container { height: 100%; display: flex; align-items: center; gap: 1rem; padding: 0 1.1rem; min-width: 0; }
.navbar-brand { display: flex; align-items: center; gap: .5rem; color: var(--text-bright); white-space: nowrap;
  font-size: .95rem; letter-spacing: .05em; flex: none; }
.navbar-brand:hover { text-decoration: none; }
.brand-icon { color: var(--accent-highlight); font-size: 1.15rem; }
.navbar-sub { color: var(--text-muted); font-size: .78rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.navbar-spacer { flex: 1; }
.navbar-menu { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.navbar-link { color: var(--text-secondary); font-size: .88rem; white-space: nowrap; }
.navbar-user { color: var(--text-muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.navbar-form { margin: 0; }
.navbar-form .btn { white-space: nowrap; }
.navbar-menu-toggle { display: none; width: 2.2rem; height: 2rem; flex: none; place-items: center; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text-secondary);
  cursor: pointer; font-size: 1.05rem; line-height: 1; }
.navbar-menu-toggle:hover, .navbar.is-open .navbar-menu-toggle { color: var(--accent-highlight); border-color: var(--accent-highlight); }

/* Layout */
.main-content { max-width: 1040px; margin: 0 auto; padding: calc(var(--navbar-height) + 2rem) 1.25rem 4rem; }
.section-title { margin-top: 2rem; }
.block-title { color: var(--text-bright); font-size: .95rem; font-weight: 600; margin: 0 0 .4rem; }

/* Hero */
.hero { margin-bottom: 1.8rem; }
.kicker { color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.kicker a { color: inherit; }       /* the way back ("← Games", "← Studies") reads as the page's kicker, everywhere */
.hero h1 { font-size: 2rem; line-height: 1.22; margin: .3rem 0 .9rem; }
.lede { color: var(--text-secondary); font-size: 1.02rem; max-width: 74ch; }

/* The six steps — three by two, every blurb in the same place */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem;
  grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.step { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem .9rem; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr;
  gap: .15rem .7rem; align-items: start; }
.step-n { grid-row: 1 / span 2; color: var(--bg); background: var(--accent); font-weight: 700;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; }
.step-name { grid-column: 2; color: var(--text-bright); font-size: .95rem; }
.step-blurb { grid-column: 2; color: var(--text-muted); font-size: .84rem; }
.steps-caps .step { grid-template-columns: minmax(0, 1fr); }   /* capabilities: no number, the text takes the row */
.steps-caps .step-name, .steps-caps .step-blurb { grid-column: 1; }

/* Tiles — honest empty states */
.tiles { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 1rem 0 0; }
.tile { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.tile-label { color: var(--text-secondary); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; }
.tile-label .info { text-transform: none; letter-spacing: 0; }
.tile-value { color: var(--text-bright); font-size: 1.9rem; font-weight: 700; margin-top: .25rem; }
.tile-empty { color: var(--text-muted); font-size: .85rem; margin-top: .45rem; font-style: italic; }

/* Tables — one system: .data-table for figures, .kv for a key and its value; both from the tokens */
.data-table, .kv { width: 100%; border-collapse: collapse; }
.data-table { font-size: .82rem; margin: .4rem 0 1.1rem; }
.data-table th, .data-table td, .kv th, .kv td { text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th, .data-table td { padding: .35rem .55rem; }
.data-table thead th { color: var(--text-secondary); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .05em; vertical-align: bottom; }
.data-table tbody tr:hover td { background: var(--bg-secondary); }
.data-table .badge { vertical-align: baseline; }
.data-table .small { font-size: .92em; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.kv { margin-top: .6rem; }
.kv th, .kv td { padding: .5rem .6rem; font-weight: 400; }
.kv th { color: var(--text-secondary); width: 16rem; }

/* The explainer (house rule 10) — dismissed once, it folds into "About this page" and opens again on a click */
.explainer { background: var(--bg-elevated); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: .85rem 1rem; margin: 1.2rem 0; }
.explainer-head { display: flex; align-items: center; gap: .6rem; }
.explainer-title { color: var(--text-bright); font-size: .95rem; }
.explainer-dismiss { margin-left: auto; background: none; border: none; color: var(--text-muted);
  font-size: 1.25rem; line-height: 1; cursor: pointer; padding: 0 .25rem; border-radius: 4px; }
.explainer-dismiss:hover { color: var(--text-bright); }
.explainer-purpose { color: var(--text-secondary); margin: .45rem 0 0; }
.explainer-todo { color: var(--text-secondary); margin: .5rem 0 0; padding-left: 1.1rem; }
.explainer-reveal-row { margin: .5rem 0 1rem; }
.explainer-reveal { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .1rem; background: none; border: 0;
  border-radius: 4px; color: var(--text-muted); font-size: .8rem; cursor: pointer; }
.explainer-reveal:hover { color: var(--accent-highlight); }
.explainer-reveal-i { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 1px solid currentColor; font: italic 700 var(--fs-xs)/1 Georgia, serif; }

/* Forms and buttons */
.btn { display: inline-block; border-radius: var(--radius-sm); padding: .4rem .8rem; font-size: .88rem;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-primary); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-ghost { background: none; }
.auth-card { max-width: 25rem; margin: 2rem auto; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; }
.auth-card label { display: block; color: var(--text-secondary); font-size: .85rem; margin: .7rem 0 .25rem; }
.auth-card input { width: 100%; padding: .5rem .6rem; background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border-input); border-radius: var(--radius-sm); font-size: .92rem; }
.auth-card input:hover { border-color: var(--text-muted); }
.auth-card input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-card .btn { width: 100%; margin-top: 1.1rem; }
.auth-card .explainer { margin: .8rem 0 .4rem; }
.errorlist { color: var(--danger-text); list-style: none; padding: 0; margin: .5rem 0; font-size: .85rem; }
.helptext { color: var(--text-muted); font-size: .78rem; }

/* Django's messages: the colour says what kind, the container is announced, the × takes one away (ui.js) */
.messages { display: grid; gap: .4rem; margin-bottom: 1rem; }
.message { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .6rem .5rem .8rem; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border); border-left-width: 3px; }
.message-text { flex: 1; min-width: 0; }
.message-close { flex: none; background: none; border: 0; padding: 0 .2rem; color: var(--text-muted); font-size: 1.15rem;
  line-height: 1.2; cursor: pointer; border-radius: 4px; }
.message-close:hover { color: var(--text-bright); }
.message-success { border-color: rgba(34, 197, 94, .5); border-left-color: var(--success); color: var(--success); }
.message-info { border-left-color: var(--info); }
.message-warning { border-color: rgba(245, 158, 11, .5); border-left-color: var(--warning); color: var(--accent-highlight); }
.message-error { border-color: rgba(239, 68, 68, .5); border-left-color: var(--danger); color: var(--danger-text); }

/* Alerts — a refusal (red), a warning (amber), a confirmation (green); in the page, not a toast */
.alert, .refuse-card, .warn-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem .8rem; margin: .8rem 0; font-size: .88rem; }
.alert-danger, .refuse-card { border-color: var(--danger); }
.alert-warn, .warn-card { border-color: var(--warning); }
.alert-ok { border-color: var(--success); }

/* A bar that fills — the study's progress; the value is also written beside it (.progress-row) */
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: .55rem; border: 0;
  border-radius: 999px; background: var(--bg-elevated); color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--bg-elevated); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .3s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-row { display: flex; align-items: center; gap: .7rem; }
.progress-row progress { flex: 1; }
.progress-pct { flex: none; min-width: 3.2rem; text-align: right; color: var(--text-bright); font-variant-numeric: tabular-nums; font-size: .85rem; }

/* ---------------------------------------------------------------------------------------------
   Shared interface pieces (ui.js): the (i) bubble, folding panels, splitters, dialogs, forms.
   --------------------------------------------------------------------------------------------- */
:root { --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-highlight); }
/* The ring follows each control's own corners (a button keeps its 6px); only a bare link is given soft ones. */
:focus-visible { outline: none; box-shadow: var(--focus); }
a:not([class]):focus-visible { border-radius: 3px; }

/* the (i) */
.info { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; flex: none;
  margin: 0 .15rem; padding: 0; border-radius: 50%; border: 1px solid var(--text-muted);
  background: transparent; color: var(--text-muted); font: italic 700 var(--fs-xs)/1 Georgia, serif;
  cursor: help; vertical-align: middle; transition: color .12s, border-color .12s, background .12s; }
.info:hover, .info:focus-visible { color: var(--bg); background: var(--accent-highlight); border-color: var(--accent-highlight); }
.ui-tip { position: fixed; z-index: 3000; max-width: 22rem; padding: .5rem .65rem; pointer-events: none;
  background: var(--surface-tooltip); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.45); font-size: .8rem; line-height: 1.45; white-space: pre-line; }

/* folding panels */
.panel { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem; min-height: 2rem;
  border-bottom: 1px solid var(--border); flex: none; }
.panel-title { color: var(--accent); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.panel-head .panel-extra { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.panel-toggle { margin-left: auto; background: none; border: 0; color: var(--text-muted); cursor: pointer;
  width: 1.5rem; height: 1.5rem; border-radius: 4px; display: grid; place-items: center; font-size: .8rem; }
.panel-head .panel-extra + .panel-toggle { margin-left: .2rem; }
.panel-toggle:hover { color: var(--text-bright); background: var(--bg-elevated); }
.panel-toggle::before { content: "▾"; transition: transform .15s; }
.panel.is-collapsed > .panel-head .panel-toggle::before { transform: rotate(-90deg); }
.panel-body { padding: .5rem; overflow: auto; min-height: 0; flex: 1; }
.panel.is-collapsed { flex: none !important; }
.panel.is-collapsed > .panel-body { display: none; }
.panel.is-collapsed > .panel-head { border-bottom: 0; }

/* splitters */
.splitter { flex: none; position: relative; cursor: col-resize; touch-action: none; }
.splitter::after { content: ""; position: absolute; inset: 0 2px; border-radius: 2px; transition: background .12s; }
.splitter:hover::after, .splitter.is-dragging::after, .splitter:focus-visible::after { background: var(--accent); opacity: .6; }
.splitter[data-axis="y"] { cursor: row-resize; }
body.is-resizing { user-select: none; cursor: col-resize; }

/* dialogs */
dialog.ui-dialog { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 12px; padding: 0; width: min(46rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem);
  box-shadow: 0 24px 64px rgba(0,0,0,.6); }
dialog.ui-dialog::backdrop { background: rgba(5, 7, 12, .65); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.2rem .6rem; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 1.1rem; }
.dialog-close { margin-left: auto; background: none; border: 0; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.dialog-close:hover { color: var(--text-bright); }
.dialog-body { padding: 1rem 1.2rem 1.2rem; overflow: auto; }
.dialog-body h3 { color: var(--accent-highlight); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin: 1.1rem 0 .4rem; }
.dialog-body h3:first-child { margin-top: 0; }
.how-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; counter-reset: s; }
.how-steps li { counter-increment: s; display: grid; grid-template-columns: 1.7rem 1fr; gap: .6rem; align-items: start; }
.how-steps li::before { content: counter(s); width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent);
  color: var(--on-accent); font-weight: 700; display: grid; place-items: center; font-size: .8rem; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; font-size: .85rem; }
kbd { display: inline-block; min-width: 1.3rem; padding: .05rem .35rem; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--bg-elevated); color: var(--text-bright); font: 600 .75rem var(--mono); text-align: center; }

/* the top line folds away: every layout reads --navbar-height, so zero gives the room back */
html.nav-hidden { --navbar-height: 0px; }
html.nav-hidden .navbar { display: none; }
.navbar-collapse { width: 1.7rem; height: 1.7rem; flex: none; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: .8rem; line-height: 1; }
.navbar-collapse:hover { color: var(--accent-highlight); border-color: var(--accent-highlight); }
.nav-reveal { display: none; position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 1100;
  width: 2.6rem; height: .95rem; padding: 0; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px;
  background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; font-size: var(--fs-2xs); line-height: 1; }
.nav-reveal:hover { color: var(--bg); background: var(--accent-highlight); }
html.nav-hidden .nav-reveal { display: block; }

/* navbar additions */
.navbar-link.is-on { color: var(--text-bright); }
.navbar-help { width: 1.9rem; height: 1.9rem; flex: none; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); cursor: pointer; font-weight: 700; }
.navbar-help:hover { color: var(--bg); background: var(--accent-highlight); border-color: var(--accent-highlight); }
.navbar-help[hidden] { display: none; }
@media (max-width: 1100px) { .navbar-sub { display: none; } }
@media (max-width: 960px) {
  .navbar-container, .navbar-menu { gap: .8rem; }
  .navbar-role { display: none; }
  .navbar-user { max-width: 8rem; }
}
/* A phone or a narrow window: the brand, the help, the menu button and the fold stay on the line; the rest is one tap away. */
@media (max-width: 760px) {
  .navbar-container { gap: .6rem; padding: 0 .8rem; }
  .navbar-menu-toggle { display: grid; }
  .navbar-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    padding: .35rem 1rem .9rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .5); max-height: calc(100vh - var(--navbar-height)); overflow-y: auto; }
  .navbar.is-open .navbar-menu { display: flex; }
  .navbar-menu .navbar-link { padding: .7rem .2rem; font-size: .95rem; border-bottom: 1px solid var(--border); }
  .navbar-menu .navbar-link.is-on { color: var(--accent-highlight); }
  .navbar-menu .navbar-user { max-width: none; padding: .7rem .2rem .5rem; }
  .navbar-menu .navbar-role { display: inline; }
  .navbar-menu .navbar-form .btn, .navbar-menu > .btn { width: 100%; padding: .55rem .8rem; text-align: center; margin-top: .35rem; }
  .main-content { padding-left: 1rem; padding-right: 1rem; }
  .hero h1 { font-size: 1.6rem; }
  .kv th { width: auto; }
}

/* modern form controls — one look for every page */
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: .35rem; }
.field { display: grid; gap: .3rem; min-width: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: end; }
.field-row > .field { flex: 1 1 12rem; }
.field-row > .field-narrow { flex: 0 1 9rem; }
.field-label { display: flex; align-items: center; gap: .2rem; color: var(--text-secondary); font-size: .8rem; font-weight: 600; }
.field-hint { color: var(--text-muted); font-size: .75rem; }
.input, .select, .field input[type="text"], .field input[type="number"], .field input:not([type]), .field select {
  width: 100%; min-width: 0; height: 2.3rem; padding: 0 .7rem; background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border-input); border-radius: 7px; font: inherit; font-size: .9rem; transition: border-color .12s; }
.field select, .select { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:hover, .field select:hover { border-color: var(--text-muted); }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.segmented { justify-self: start; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: .35rem .8rem; border-radius: 6px; color: var(--text-secondary); font-size: .85rem; cursor: pointer; }
.segmented input:checked + span { background: var(--accent-soft); color: var(--text-bright); box-shadow: inset 0 0 0 1px var(--accent); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.segmented input:disabled + span { opacity: .45; cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: .88rem; color: var(--text-secondary); }
.switch input { appearance: none; width: 2.2rem; height: 1.25rem; border-radius: 1rem; background: var(--border-input); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.25rem - 4px); height: calc(1.25rem - 4px); border-radius: 50%; background: var(--text-bright); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(.95rem); }
/* a switch with its (i) beside it — the (i) stays outside the <label>, so it never becomes part of the switch's name */
.switch-row { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.btn { transition: border-color .12s, background .12s, color .12s; }
.btn-primary:hover { background: var(--accent-highlight); border-color: var(--accent-highlight); }
.btn-lg { padding: .6rem 1.2rem; font-size: .95rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .5rem; border-radius: 999px; font-size: .72rem;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--bg-elevated); white-space: nowrap; }
.badge-ok { color: var(--success); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.badge-warn { color: var(--warning); border-color: rgba(245,158,11,.4); background: var(--accent-soft); }
.badge-no { color: var(--danger); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem 1.3rem; min-width: 0; }
.card-title { display: flex; align-items: center; gap: .4rem; font-size: 1.05rem; margin: 0 0 .9rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .lede { margin: .3rem 0 0; font-size: .95rem; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; border: 1px dashed var(--border); border-radius: 10px; }
.empty strong { display: block; color: var(--text-secondary); margin-bottom: .3rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .6rem; margin: -.4rem 0 1.4rem; }
.badge-level { color: var(--accent-highlight); border-color: rgba(251,191,36,.35); background: var(--accent-soft); text-transform: none; }
.levels-card { display: grid; gap: 1rem; justify-items: start; }

/* The error pages (403, 404, 500): one card, what happened in words, and the way back. */
.error-page { max-width: 36rem; margin: 3rem auto; }
.error-code { color: var(--accent); font: 700 .8rem var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.error-page h1 { margin: .35rem 0 .8rem; }
.error-page .explainer { margin: 0 0 1.2rem; }
.error-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.error-shell .navbar-container { justify-content: space-between; }
