/* admin_backend_ConnectApiWarmupServer — base.css: the tokens, the base, the frame, the cards,
 * the badges, the notices and the sign-in pages. Loaded first on every page (src/shared/partials/head.php);
 * after it come the component sheets shared/components/*.css, then the page's own
 * <page>/page.css where one exists (docs/design.md, "Die Dateien").
 *
 * Form follows function (operator, 09.10.2026): every visual means has a job — hierarchy,
 * orientation, status, legibility — and nothing is decoration. The rules and the numbers are
 * written up in docs/design.md; change them there and here together.
 *
 *   1. Tokens: type scale, spacing, one radius, colour roles (dark is the standard, then the
 *      light values under :root[data-theme="light"]).
 *   2. Base: body, links (outside the tables every link is a small button since 1.11.0; inside
 *      a table it stays a link), focus, buttons and inputs.
 *   3. Frame: header with navigation (full-size buttons, the brand as text, theme toggle), page
 *      head, footer.
 *   4. Cards, badges, notices, the sign-in pages (login, code, authenticator set-up).
 *   5. Narrow widths of the frame and the cards.
 *
 * Panel kinds carry a 3 px edge at the left of the head — bans, connects, settings, servers,
 * info — set through the custom property --k on .panel-<kind> / .kind-<kind>; the rest of the
 * panel is grey. Colour otherwise means one of three things: a link or the thing you can act
 * on (--accent), a status (--ok / --warn / --bad), or nothing.
 *
 * Dark is the standard (operator 09.10.2026, 1.4.0). The light theme is chosen by the "Light"
 * link in the navigation (js/shared/app.js), kept in localStorage (connectadmin.theme) and
 * applied as <html data-theme="light"> by /assets/js/shared/theme.js in the <head>, before the
 * first paint. The system preference (prefers-color-scheme) is deliberately NOT consulted.
 */

/* ── 1. Tokens ──────────────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* type scale: size / line height — one role each (docs/design.md) */
  --fs-11: 11px; --lh-11: 16px;   /* labels above a value (profile card), hover-panel bar */
  --fs-12: 12px; --lh-12: 16px;   /* meta: table head, panel meta, footer, badges, mono */
  --fs-13: 13px; --lh-13: 20px;   /* table body, filters, pager, panel actions */
  --fs-14: 14px; --lh-14: 20px;   /* body text, navigation, panel and card titles, buttons */
  --fs-16: 16px; --lh-16: 24px;   /* the main search field on the start page */
  --fs-20: 20px; --lh-20: 28px;   /* page title, the one-time-code field */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* spacing: the 8 px grid, with 4 and 12 for cells and small gaps */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px;
  --radius: 6px;                  /* the one radius */
  --edge: 3px;                    /* the kind edge of panels, cards and notices */
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .5);    /* floating layers only (hover panel) */

  /* surfaces and text — dark, the standard (contrast values: docs/design.md) */
  --bg: #101317;                  /* page */
  --surface: #181c22;             /* panels, cards, header, inputs, odd rows */
  --surface-2: #1f252d;           /* even rows (zebra), hovered summary */
  --hover: #263349;               /* hovered row, active filter / nav link */
  --head-bg: #0b0e12;             /* table head: darker than page and rows, so the head reads as one band */
  --line: #2c333d;                /* hairlines */
  --line-soft: rgba(230, 233, 238, .08);   /* the column lines of a table (1.6.0): ink at 8 % — 1.18–1.25 on every table surface, quiet on purpose */
  --control: #6b7582;             /* borders of inputs, secondary buttons, pager; the 2 px rule under the head (>= 3:1) */
  --ink: #e6e9ee;                 /* text */
  --muted: #9aa4b1;               /* meta text */

  /* the one interaction colour: links, active nav link, primary button, focus ring */
  --accent: #8ab4ff;
  --accent-hover: #a4c4ff;
  --on-accent: #0d1521;

  /* status: badges, notices, yes/no, warnings — nowhere else */
  --ok: #5ccf92;   --ok-bg: #15311f;
  --warn: #e9b35a; --warn-bg: #33291a;
  --bad: #f28b88;  --bad-bg: #381d1d;
  --on-bad: #1a0d0d;
  --open-bg: #3a3115;             /* a visit row whose update has not finished — a warm tint both zebra tones lack */
  --selected-bg: #1e3a5f;         /* a selected visit row (1.8.0): the second blue of the table — deeper and more saturated than --hover, a state rather than a moment */

  /* the server-population reading of the selection summary (1.9.0): the two averages are
     coloured by the operator's rule (app.js populationClass, reference src/shared/components/selection-summary.php
     population_class()) — level within 1.5 players (yellow), more at join (green), more at
     disconnect (red). Three tokens of their own, so the reading can be tuned without touching
     the status badges; today they equal --ok / --warn / --bad (contrasts: docs/design.md) */
  --pop-join: #5ccf92; --pop-level: #e9b35a; --pop-disc: #f28b88;

  /* panel kinds — the edge only */
  --k-bans: #f08264; --k-connects: #8ab4ff; --k-settings: #bca3f5; --k-servers: #5ccf92; --k-info: #8d98a6;
}
/* the light theme: the same roles, chosen with the "Light" link (html[data-theme="light"]) */
:root[data-theme="light"] {
  color-scheme: light;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .18);
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f2f4f7; --hover: #e8effa; --head-bg: #e3e7ec;
  --line: #d9dee5; --line-soft: rgba(27, 32, 39, .10); --control: #7a8390; --ink: #1b2027; --muted: #5c6673;
  --accent: #1f5cc0; --accent-hover: #1a4fa6; --on-accent: #ffffff;
  --ok: #1a7a45;   --ok-bg: #e4f3ea;
  --warn: #8f5400; --warn-bg: #fbf1dc;
  --bad: #b82020;  --bad-bg: #fbe9e9;
  --on-bad: #ffffff;
  --open-bg: #fdf7df;
  --selected-bg: #d6e4fb;
  --pop-join: #1a7a45; --pop-level: #8f5400; --pop-disc: #b82020;
  --k-bans: #c8441f; --k-connects: #2f6fd0; --k-settings: #7a4fd1; --k-servers: #1e8c52; --k-info: #7b8794;
}

/* ── 2. Base ────────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-14)/var(--lh-14) var(--font); }
h1 { font-size: var(--fs-20); line-height: var(--lh-20); font-weight: 600; margin: 0; overflow-wrap: anywhere; }
h2 { font-size: var(--fs-14); line-height: var(--lh-14); font-weight: 600; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
/* Links outside the tables are buttons (1.11.0, operator 09.10.2026: "Das Link-Styling in den
   Tabellen ist mega. Außerhalb würde ich die Links bitte lieber wie Buttons haben (gilt für
   alle Seiten)"): every <a> that is not inside a table.data takes the look of the secondary
   .button — the surface, the --control frame (>= 3:1, like every secondary button and input),
   the one radius, 600 — in the SMALL size (.button.small: 12/16 px, 20 px tall, the height of
   a text line), so a link in a lead, a card, a panel head or a list sits in its line. The
   navigation (below) and anything that already carries .button keep the full 32 px. Inside a
   table a link stays a link: a column of underlined accents reads as a column, a column of
   boxes as a form. The brand name in the navigation is the one other exception (a name, not
   an action — .top .brand below). The selector: :where() keeps the specificity at that of a
   plain `a`, so every contextual rule further down (navigation, pager, panel head) wins as it
   did; :not(table.data a) needs the complex :not() (Firefox 84, Chrome 88, Safari 9) — an older
   engine drops the rule and shows links, nothing breaks. */
a:where(:not(table.data a)) {
  display: inline-block; vertical-align: middle;
  font-weight: 600; font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink); background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--radius);
  padding: 1px var(--s2); text-decoration: none; white-space: nowrap; text-align: center;
}
a:where(:not(table.data a)):hover { color: var(--ink); background: var(--surface-2); border-color: var(--muted); }
/* the one "current" state of a button group (the active nav link, the current page of the
   pager, the active status chip, the N of "Last N connects"): filled with --hover, the text in
   the accent — the fill of the active nav link of 1.2.0, now inside the frame. The non-link
   members (<strong>, <span>) get the same box here; they are not links and never were. */
nav.filters > strong, .n-links strong, .pager span {
  display: inline-block; vertical-align: middle;
  font-weight: 600; font-size: var(--fs-12); line-height: var(--lh-12);
  border: 1px solid var(--control); border-radius: var(--radius); padding: 1px var(--s2); white-space: nowrap;
}
.top nav > a.active, nav.filters > strong, .n-links strong, .pager span { color: var(--accent); background: var(--hover); }
code, .mono { font-family: var(--mono); font-size: var(--fs-12); }
strong { font-weight: 600; }
.dim { color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }
.error { color: var(--bad); font-weight: 600; }
.yes { color: var(--ok); font-weight: 600; }
.no { color: var(--muted); }
.empty { color: var(--muted); font-size: var(--fs-13); line-height: var(--lh-13); }
.lead { margin: 0 0 var(--s3); }

/* keyboard focus: one ring, everywhere */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
summary:focus-visible { outline-offset: -2px; }
input:focus-visible { outline-offset: 0; border-color: var(--accent); }

/* inputs (the ban form, 1.7.0, adds url, number, datetime-local, select and textarea — the
   same frame for every control) */
input[type=search], input[type=text], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  font: inherit; line-height: var(--lh-14); color: var(--ink); background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--radius);
  padding: 5px var(--s2); margin: 0; vertical-align: middle;
}
textarea { display: block; resize: vertical; min-height: 64px; }
select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
label { font-weight: 600; }

/* buttons: secondary (frame) by default, .primary filled with the accent, .danger filled red —
   only the buttons that write a ban change ("Ban player", "Issue ban", "Lift ban").
   Inline blocks with a fixed line height (no flex): the same 32 px in every engine. */
button, .button {
  display: inline-block; vertical-align: middle;
  font: inherit; font-weight: 600; line-height: var(--lh-14); color: var(--ink); background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--radius);
  padding: 5px var(--s3); margin: 0;
  cursor: pointer; text-decoration: none; white-space: nowrap; text-align: center;
}
button:hover, .button:hover { color: var(--ink); background: var(--surface-2); border-color: var(--muted); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.danger, .button.danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
button.danger:hover, .button.danger:hover { background: var(--bad); border-color: var(--ink); color: var(--on-bad); }
.button.small { padding: 1px var(--s2); font-size: var(--fs-12); line-height: var(--lh-12); }
/* a disabled button (1.9.0: "Unban" without an active ban) is muted and inert; its title says
   why — no hover change, no pointer */
button:disabled, button:disabled:hover { color: var(--muted); background: var(--surface); border-color: var(--line); cursor: not-allowed; }

/* ── 3. Frame ───────────────────────────────────────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
/* (flex rows are spaced with margins, not gap: wkhtmltoimage's WebKit, which takes the
   screenshots of the acceptance tests, knows no gap) */
.top nav { max-width: 1600px; margin: 0 auto; padding: var(--s2) var(--s4); display: flex; align-items: center; flex-wrap: wrap; }
/* the brand: the one link of the bar that is NOT a button (1.11.0) — a name is not an action;
   the frame and the fill of the button rule are taken off again */
.top .brand { font-weight: 600; color: var(--ink); text-decoration: none; font-size: var(--fs-14); line-height: var(--lh-14); padding: var(--s1) 0; margin-right: var(--s4); border: 0; background: transparent; }
.top .brand:hover { color: var(--ink); background: transparent; }
/* the navigation links are full-size buttons (1.11.0): the 32 px of "Player" and "Sign out"
   beside them, 8 px apart; the active one is filled (rule above) */
.top nav > a:not(.brand) { font-size: var(--fs-14); line-height: var(--lh-14); padding: 5px var(--s3); margin-right: var(--s2); }
.top nav > a.active { border-color: var(--control); }
.top .search { margin-left: auto; display: flex; align-items: center; }
.top .search input { width: 14em; margin-right: var(--s2); }      /* a 17-digit SteamID64 fits with room to spare */
.top .logout { display: flex; align-items: center; margin-left: var(--s4); }
.top .logout .dim { margin-right: var(--s2); }
/* the theme toggle (app.js): last in the bar; on the sign-in pages it is the only thing right
   of the brand. The link names the theme it switches TO — both labels are in the markup, the
   active theme hides one, so no script has to rewrite the text. A button like the others. */
.top .theme-toggle { margin-left: var(--s4); margin-right: 0; }
.top .brand + .theme-toggle { margin-left: auto; }
/* "Settings" (1.10.0) stands between the player search and "Sign out" */
.top .search + a { margin-left: var(--s4); }
.theme-toggle .to-dark { display: none; }
:root[data-theme="light"] .theme-toggle .to-light { display: none; }
:root[data-theme="light"] .theme-toggle .to-dark { display: inline; }

main { max-width: 1600px; margin: 0 auto; padding: var(--s4) var(--s4) var(--s8); }
/* the footer (statement count) sits at the bottom of the window even on a short page — a
   stable place to look; guarded so that an engine without grid keeps the plain flow */
@supports (display: grid) {
  body { min-height: 100vh; display: flex; flex-direction: column; }
  main { flex: 1 0 auto; width: 100%; }
  footer { width: 100%; }   /* a flex item with margin auto would shrink to its content */
}
.page-head { display: flex; align-items: baseline; flex-wrap: wrap; margin: var(--s2) 0 var(--s4); }
.page-head h1 { margin-right: var(--s4); }
/* "collapse all" / "expand all": two small buttons, 8 px apart (1.11.0; before, text links with a dot between) */
.panel-tools { margin-left: auto; font-size: var(--fs-12); line-height: var(--lh-12); color: var(--muted); white-space: nowrap; }
.panel-tools a + a { margin-left: var(--s2); }

footer {
  max-width: 1600px; margin: 0 auto; padding: var(--s3) var(--s4) var(--s6);
  display: flex; justify-content: space-between; flex-wrap: wrap;
  color: var(--muted); font-size: var(--fs-12); line-height: var(--lh-12); font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line);
}
footer span { margin-right: var(--s4); }
footer span:last-child { margin-right: 0; }

/* ── 4. Cards, badges, notices, sign-in ─────────────────────────────────────────────────── */
/* cards (start page, profile, login, unban): the panel shell without a head */
.card { --k: var(--k-info); background: var(--surface); border: 1px solid var(--line); border-left: var(--edge) solid var(--k); border-radius: var(--radius); padding: var(--s3) var(--s4); margin: 0 0 var(--s4); }
.kind-bans { --k: var(--k-bans); }
.kind-connects { --k: var(--k-connects); }
.kind-settings { --k: var(--k-settings); }
.kind-servers { --k: var(--k-servers); }
.kind-info { --k: var(--k-info); }
/* flex first for engines without grid (wkhtmltoimage); grid wins where it exists */
.profile { display: flex; flex-wrap: wrap; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3) var(--s4); font-variant-numeric: tabular-nums; }
.profile > div { flex: 1 1 180px; margin: 0 var(--s4) var(--s2) 0; min-width: 0; overflow-wrap: anywhere; }
.profile .label { display: block; font-size: var(--fs-11); line-height: var(--lh-11); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
/* the SteamID64 and "Steam profile" of the profile card: two small buttons side by side (1.11.0) */
.profile a + a { margin-left: var(--s1); }

.badge { display: inline-block; padding: 0 var(--s2); border-radius: var(--radius); font-size: var(--fs-12); line-height: 20px; font-weight: 600; }
.badge.active { background: var(--bad-bg); color: var(--bad); }
.badge.expired { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); line-height: 18px; }
.badge.lifted { background: var(--ok-bg); color: var(--ok); }
/* the admin list (1.5.0): a badge named by its status role, not by the state word — "active"
   is red for a ban and green for an admin */
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* notices: one line with a status edge — the flash after an unban, errors, sign-in messages */
.flash, p.error, p.ok, p.warn {
  margin: 0 0 var(--s4); padding: var(--s2) var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-left: var(--edge) solid var(--muted); border-radius: var(--radius);
  font-weight: 400; color: var(--ink);
}
.flash.ok, p.ok { border-left-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
p.error { border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
p.warn { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.card p.error, .card p.ok, .card p.warn { margin-bottom: var(--s3); }

/* sign-in: the two steps, visible on both pages */
.login { max-width: 480px; }
.steps { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 var(--s3); font-size: var(--fs-12); line-height: var(--lh-12); color: var(--muted); counter-reset: step; }
.steps li { display: flex; align-items: center; margin-right: var(--s4); }
.steps li::before { counter-increment: step; content: counter(step); display: inline-block; width: 20px; height: 20px; margin-right: var(--s2); line-height: 18px; text-align: center; border: 1px solid var(--control); border-radius: var(--radius); font-weight: 600; }
.steps li.current { color: var(--ink); font-weight: 600; }
.steps li.current::before { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps li.done::before { content: "\2713"; color: var(--ok); border-color: var(--ok); }
.code-form { display: flex; align-items: center; flex-wrap: wrap; }
.code-form label { margin-right: var(--s2); }
/* the "Remember this browser" box of the code page (1.11.0, src/remember.php): its own line
   under the code field, the whole width of the form, muted like a hint */
.code-form .remember-box { flex-basis: 100%; margin: var(--s2) 0 0; font-weight: 400; color: var(--muted); }
.code-form .remember-box input { width: auto; margin: 0 var(--s1) 0 0; padding: 0; font-size: inherit; letter-spacing: 0; vertical-align: -1px; }
.code-form input { width: 7.5em; margin-right: var(--s2); padding: 7px var(--s3); font-size: var(--fs-20); line-height: var(--lh-20); font-variant-numeric: tabular-nums; letter-spacing: .2em; text-align: center; }
.ok { color: var(--ok); }

/* the authenticator set-up (1.5.0, /auth/enroll): the QR code (qrencode's SVG, its own white
   quiet zone — a code on a dark page needs it) beside the typed key and the otpauth link */
.enrol { max-width: 640px; }
.enrol-keys { display: flex; flex-wrap: wrap; align-items: flex-start; margin: 0 0 var(--s3); }
.qr { flex: none; margin: 0 var(--s4) var(--s3) 0; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.qr svg { display: block; width: 200px; height: 200px; }
.enrol-keys > div:last-child { flex: 1 1 240px; min-width: 0; }
.enrol .label { display: block; font-size: var(--fs-11); line-height: var(--lh-11); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.enrol .secret { display: block; font-size: var(--fs-14); line-height: var(--lh-16); letter-spacing: .06em; word-break: break-all; }

/* ── 5. Narrow widths ───────────────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .top nav { padding: var(--s2) var(--s3); }
  .top .brand { margin-right: var(--s1); }
  .top .logout { margin-left: auto; }
  .top .search { order: 9; flex: 1 1 100%; margin: var(--s1) 0 0; }
  .top .search input { flex: 1 1 auto; width: auto; min-width: 0; }
  main { padding: var(--s3) var(--s3) var(--s6); }
  .page-head { margin-top: var(--s1); }
  .profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile > div { margin-right: 0; }
}
@media (max-width: 520px) {
  .profile { grid-template-columns: minmax(0, 1fr); }
}
