/* nbcloud console — the NetBadgers house style (issue #80): Inter self-hosted, a left nav rail and
   a per-page sticky header, content organised into rounded cards. The palette and layout tokens come
   from the sibling app (nbinv/site/app.css); everything below reads the tokens.

   Inter (SIL Open Font License), self-hosted: the console is offline and the CSP is script-src/
   style-src/font-src 'self', so nothing is fetched from Google Fonts. One variable file per script. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Palette. This block is the single source of the console's colours; everything below uses the tokens.
   Precedence: :root is the Light theme; the media block gives the Dark values to Auto (no data-theme
   on <html>, the OS says dark) but not when data-theme="light" is set; :root[data-theme="dark"] forces
   Dark. The two dark blocks must stay identical, and must declare the same token names as Light (a Go
   test checks both). theme.js sets data-theme from the saved choice; without it, Auto follows the OS.
   Charts: series 1 is --accent, series 2 --series-alt (orange); the pair passes the colour-blind
   separation and 3:1 contrast checks on --card in both themes. */
:root {
  --bg: #f7f5f0; --card: #fdfcfa; --text: #23272e; --muted: #5b626d; --line: #e3dfd5; --edge: #cfc9bb;
  --hover: #f1eee7; --accent: #3667c4; --accent-soft: #e4ecfa; --accent-edge: #b9ccf0; --on-accent: #ffffff;
  --brand: #1c387e; --logo: #1c387e; --ok: #2c6b45; --ok-soft: #ddefe3; --warn: #8a4e1f; --warn-soft: #f8e9da;
  --bad: #a33a2c; --bad-soft: #f6deda; --busy: #3667c4; --busy-soft: #e4ecfa; --idle: #5b626d; --idle-soft: #ebe6db;
  --series-alt: #eb6834;
  --shadow: 0 8px 24px -8px rgb(28 25 18 / .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121419; --card: #1a1d24; --text: #e9eaec; --muted: #b3b8c0; --line: #2a2e37; --edge: #3a3f4b;
    --hover: #22262e; --accent: #5b8def; --accent-soft: #1f2a44; --accent-edge: #33456e; --on-accent: #0e1730;
    --brand: #a9c4f7; --logo: #e9eaec; --ok: #7fcb9b; --ok-soft: #1b2e23; --warn: #e6b98c; --warn-soft: #3a2b1e;
    --bad: #f0a096; --bad-soft: #3a2020; --busy: #5b8def; --busy-soft: #1f2a44; --idle: #b3b8c0; --idle-soft: #343a46;
    --series-alt: #d95926;
    --shadow: 0 8px 24px -8px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121419; --card: #1a1d24; --text: #e9eaec; --muted: #b3b8c0; --line: #2a2e37; --edge: #3a3f4b;
  --hover: #22262e; --accent: #5b8def; --accent-soft: #1f2a44; --accent-edge: #33456e; --on-accent: #0e1730;
  --brand: #a9c4f7; --logo: #e9eaec; --ok: #7fcb9b; --ok-soft: #1b2e23; --warn: #e6b98c; --warn-soft: #3a2b1e;
  --bad: #f0a096; --bad-soft: #3a2020; --busy: #5b8def; --busy-soft: #1f2a44; --idle: #b3b8c0; --idle-soft: #343a46;
  --series-alt: #d95926;
  --shadow: 0 8px 24px -8px rgb(0 0 0 / .5);
  color-scheme: dark;
}
/* Theme-invariant tokens live apart so the palette comparison above sees only colours. */
:root {
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rail: 216px;   /* the nav rail on the left */
  --top: 56px;     /* the sticky page header */
  --page: 1400px;  /* content width on wide screens; the rest is margin */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, select, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 4px 0; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--brand); }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.small { font-size: 12px; word-break: break-all; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12.5px; font-weight: normal; }
.sub { color: var(--muted); font-size: 12.5px; }
.bad-text { color: var(--bad); }
.ok-text { color: var(--ok); }
[hidden] { display: none !important; }

/* --- the shell: the rail on the left, the page beside it --- */
body.shell {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  max-width: calc(var(--page) + var(--rail)); margin: 0 auto; min-height: 100vh;
}
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 14px 14px; border-right: 1px solid var(--line); background: var(--bg);
}
.brand {  /* the NetBadgers wordmark: one picture, tinted with the theme's --logo */
  flex: none; width: 168px; height: 29px; margin: 2px 8px 6px; background: var(--logo);
  -webkit-mask: url(brand/logo.png) left center / contain no-repeat;
  mask: url(brand/logo.png) left center / contain no-repeat;
}
.rail .region { margin: 0 10px 20px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
}
.tabs a svg { flex: none; }
.tabs a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--accent-soft); color: var(--brand); }
.rail-spacer { flex: 1; min-height: 12px; }
.rail-foot { display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 2px; border-top: 1px solid var(--line); }
.rail-foot .status { color: var(--muted); font-size: 12px; line-height: 1.4; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--idle); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
form.logout { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
form.logout .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the Auto/Dark/Light switcher, unchanged in behaviour (theme.js), restyled for the rail footer */
.theme { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.theme > span { color: var(--muted); font-size: 12px; }
.theme button.small { color: var(--muted); }
.theme button.small[aria-pressed="true"] { background: var(--accent-soft); color: var(--brand); border-color: var(--accent-edge); font-weight: 600; }

.page { min-width: 0; display: flex; flex-direction: column; }
header.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  min-height: var(--top); padding: 10px 24px; background: var(--bg); border-bottom: 1px solid var(--line);
}
header.top .heading { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; min-width: 0; }
header.top h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: var(--brand); }
.spacer { flex: 1; }
main { padding: 20px 24px 8px; min-width: 0; }
footer { padding: 14px 24px 26px; color: var(--muted); font-size: 12px; }

/* the login / error pages: centred, no rail */
body.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
body.auth footer { text-align: center; }
body.auth .theme { justify-content: center; }

/* --- banners --- */
.banner { padding: 11px 15px; border-radius: 12px; margin: 0 0 16px; border: 1px solid transparent; }
.banner.wide { margin: 0 24px 16px; }
.banner.warn { background: var(--warn-soft); color: var(--text); border-color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--text); border-color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--text); border-color: var(--ok); }
.banner.info { background: var(--busy-soft); color: var(--text); border-color: var(--accent-edge); }

/* --- buttons --- */
button, a.button {
  display: inline-block; border: 1px solid var(--edge); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
button:hover, a.button:hover { background: var(--hover); text-decoration: none; }
button.primary, a.button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button.primary:hover, a.button.primary:hover { background: var(--brand); border-color: var(--brand); }
button.danger { background: var(--bad); color: var(--on-accent); border-color: var(--bad); font-weight: 600; }
button.danger:hover { filter: brightness(.94); background: var(--bad); }
button.small, a.button.small { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
button[disabled], a.button[disabled] { opacity: .55; cursor: default; }
.btn { display: inline-block; border: 1px solid var(--edge); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; text-decoration: none; font: inherit; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--brand); border-color: var(--brand); }

/* --- badges / pills (ok/warn/bad/busy/info/none, default idle) --- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--idle-soft); color: var(--idle);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.busy, .badge.info { background: var(--busy-soft); color: var(--busy); }
.badge.none { background: transparent; color: var(--muted); padding-left: 0; }

/* --- cards --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.card + .card, .card.full + .card.full, .grid + .card.full, .card.full { margin-bottom: 16px; }
.card h2 .hint { font-weight: normal; }
.card table { background: transparent; }
.card th { background: transparent; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; margin-bottom: 16px; }

/* --- the servers stats row (tiles) --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats div {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; border-top: 3px solid var(--line);
  padding: 13px 16px;
}
.stats b { display: block; font-size: 24px; font-weight: 680; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }

/* --- tables --- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
table.servers { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
table.servers th { background: var(--card); }
table.servers tbody tr:hover { background: var(--hover); }
table.mini { margin-top: 12px; }
table.mini th, table.mini td { padding: 5px 8px; }
.empty { padding: 40px; text-align: center; background: var(--card); border: 1px dashed var(--edge); border-radius: 16px; }

/* --- server detail --- */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 4px; }
.crumb { margin: 0; color: var(--muted); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.notes { margin: 0 0 16px; }
.big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.big span { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 8px; }
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* --- screen card --- */
.screen .actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.screen img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #000; }

/* --- History card: charts drawn by the server (history.go), readout by history.js. The plot SVG is
   stretched to the box (non-scaling strokes keep lines 2px), the marks SVG is unscaled and placed in
   percent, and all text is HTML so it stays readable at phone width. --- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px 32px; }
figure.chart { margin: 0; min-width: 0; }
.chart .s1 { --series: var(--accent); }
.chart .s2 { --series: var(--series-alt); }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-height: 1.6em; margin-bottom: 8px; }
.chart-title { font-weight: 600; }
.chart-readout { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart-readout b { color: var(--text); }
.chart-body { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; }
.chart-y { position: relative; height: 140px; min-width: 3.2em; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart-y span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.chart-y span:nth-child(1) { top: 0; }
.chart-y span:nth-child(2) { top: 50%; }
.chart-y span:nth-child(3) { top: 100%; }
.chart-plot { position: relative; height: 140px; border-radius: 2px; touch-action: pan-y; cursor: crosshair; }
.chart-plot:focus-visible { outline-offset: 6px; }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-lines path { fill: none; vector-effect: non-scaling-stroke; }
.chart-lines .grid { stroke: var(--line); stroke-width: 1; }
.chart-lines .line { stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-marks circle { fill: var(--series); stroke: var(--card); stroke-width: 2; }
.chart-marks circle.dot { stroke-width: 0; }
.chart-marks .cross { stroke: var(--muted); stroke-width: 1; }
.chart-x { grid-column: 2; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-top: 6px;
  color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-x span:last-child { text-align: right; }
.chart-stats { list-style: none; margin: 10px 0 0; padding: 0; color: var(--muted); font-size: 12.5px; }
.chart-stats b { color: var(--text); }
.chart .key { display: inline-block; width: 14px; height: 0; margin-right: 6px; vertical-align: middle;
  border-top: 2px solid var(--series); border-radius: 1px; }

/* --- forms (add, login, actions, bios edit) --- */
.lead { max-width: 80ch; color: var(--muted); }
form.login {
  width: min(380px, 100%); padding: 26px 26px 22px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: 14px;
}
form.login h1 { margin: 0; color: var(--brand); }
form.login .hint { margin: 0; }
form.add { max-width: 820px; }
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px 4px; margin: 0 0 16px; background: var(--card); }
legend { font-weight: 700; padding: 0 6px; color: var(--brand); }
.row { margin-bottom: 12px; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label, .label { display: block; font-weight: 600; font-size: 13px; }
label input, label select { display: block; width: 100%; margin-top: 4px; }
input, select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid var(--edge); border-radius: 10px;
  background: var(--bg); color: var(--text); max-width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[disabled] { color: var(--muted); }
input::placeholder { color: var(--muted); opacity: .7; font-weight: normal; }
.choices { display: grid; gap: 4px; margin-top: 4px; }
label.choice { font-weight: normal; display: flex; gap: 8px; align-items: baseline; }
label.choice input { width: auto; display: inline; margin: 0; }
.err { color: var(--bad); margin: 4px 0 0; font-size: 12.5px; }
.row .hint { margin: 4px 0 0; }
details { border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px; margin: 0 0 16px; background: var(--card); }
summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 10px; }
.confirm { padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid var(--warn); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
form.action { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
form.action h3 { margin: 0; color: var(--brand); text-transform: none; letter-spacing: 0; font-size: 14px; }
form.action .hint, form.action .bad-text { margin: 0; }
form.action .confirm { align-self: stretch; display: grid; gap: 6px; }

/* --- probe result (add page) --- */
.probe { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: var(--bg); }
.probe table { background: transparent; }

/* --- discovered BMCs --- */
.discovered { margin-top: 2px; }
.discover-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input { padding: 3px 7px; font-size: 12px; width: 12em; }
details.ignored { margin: 14px 0 0; background: transparent; border: 0; padding: 0; }
details.ignored > summary { font-weight: 600; color: var(--muted); }
td.comment { min-width: 12em; }
.comment-view { overflow-wrap: anywhere; }
.comment-text { font-weight: 600; }
details.comment-edit { margin: 2px 0 0; background: transparent; padding: 0; border: 0; }
details.comment-edit summary { cursor: pointer; display: inline-block; color: var(--muted); font-size: 12.5px; list-style: none; padding: 0 4px; border-radius: 4px; }
details.comment-edit summary::-webkit-details-marker { display: none; }
details.comment-edit summary:hover, details.comment-edit[open] summary { color: var(--accent); margin-bottom: 0; }
form.comment-form { flex-wrap: wrap; margin-top: 4px; }
form.comment-form input[name=comment] { width: 16em; max-width: 100%; }
/* Sortable Discovered table (issue #73): each header is a button; list.js marks the active column
   with aria-sort and an arrow. The main row and its details row read as one: only the details row
   carries the bottom border. */
table.disc-table th button.sort { font: inherit; font-weight: 600; color: var(--muted); background: transparent;
  border: 0; border-radius: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
table.disc-table th button.sort:hover { color: var(--accent); background: transparent; }
table.disc-table th[aria-sort="ascending"] button.sort, table.disc-table th[aria-sort="descending"] button.sort { color: var(--text); }
table.disc-table th .arrow { color: var(--accent); font-size: 10px; }
table.disc-table tbody tr.disc-row > td { border-bottom: 0; }
table.disc-table tbody tr.disc-details-row > td { border-bottom: 1px solid var(--line); padding-top: 0; }
table.disc-table tbody tr.disc-row:hover > td, table.disc-table tbody tr.disc-row:hover + tr.disc-details-row > td { background: var(--hover); }

details.row-details { margin: 0; background: transparent; padding: 0; border: 0; }
details.row-details summary { cursor: pointer; display: inline-block; color: var(--muted); font-size: 12.5px; list-style: none; padding: 0 4px; border-radius: 4px; }
details.row-details summary::-webkit-details-marker { display: none; }
details.row-details summary:hover, details.row-details[open] summary { color: var(--accent); margin-bottom: 0; }
dl.hw-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 6px 0; font-size: 12.5px; }
dl.hw-kv dt { color: var(--muted); }
dl.hw-kv dd { margin: 0; overflow-wrap: anywhere; }
ul.hw-list { margin: 0; padding-left: 1.1em; }
form.hw-readagain { margin-top: 4px; }

/* --- BIOS card --- */
.bios-tools, .fw-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 10px; }
.bios-tools input[type="search"] { min-width: 16em; flex: 0 1 24em; }
.bios-table .marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.bios-table td .bios-attr { font-weight: 600; }
.bios-table td .bios-help { margin-top: 2px; display: block; max-width: 48em; }
.bios-table tr.bios-group td { padding: 0; background: var(--hover); border-top: 1px solid var(--line); }
.bios-table tr.bios-group:first-child td { border-top: 0; }
button.bios-group-toggle { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 0; background: transparent; color: var(--brand); font-weight: 700; }
button.bios-group-toggle:hover { background: transparent; color: var(--accent); }
.bios-caret { width: 1em; color: var(--muted); }
.bios-group-count { font-weight: normal; }
form.bios-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
form.bios-form h3 { color: var(--brand); text-transform: none; letter-spacing: 0; font-size: 14px; }
form.bios-form .tablewrap { align-self: stretch; }
.bios-edit input, .bios-edit select { width: 100%; min-width: 12em; padding: 4px 7px; }

@media (max-width: 860px) {
  body.shell { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
  .rail {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 6px 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { margin: 0 6px 0 0; }
  .rail .region { display: none; }
  .tabs { flex-direction: row; flex: 1 0 100%; order: 3; gap: 4px; }
  .tabs a { padding: 7px 10px; font-size: 14px; }
  .rail-spacer { display: none; }
  .rail-foot { flex: 1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 0; border-top: 0; }
  .rail-foot .status { flex: 1 0 100%; }
  header.top { padding: 10px 16px; }
  header.top h1 { font-size: 22px; }
  main { padding: 16px 16px 8px; }
  .banner.wide { margin-left: 16px; margin-right: 16px; }
  footer { padding: 14px 16px 24px; }
  .grid { grid-template-columns: 1fr; }
  .row.two { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
}
