/* BrightBots panel. The tokens and the rules behind them are documented in DESIGN.md; change a value there
   and here. The palette, the type pair and the restraint are the BrightBots site's (brightdev-web/DESIGN.md):
   a warm neutral ground, ink, Schibsted Grotesk for headings and Geist for text. The hub uses the brand's
   marigold; each bot's own site (html[data-site]) swaps the accent for the bot's colour, so the person always
   knows which bot they are working on. Product modules use only these tokens. Discord previews are the one
   exception and live in discord.css. */

/* Self-hosted fonts (SIL Open Font License, licences in ../fonts). Split into latin and latin-ext like the site. */
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/assets/fonts/schibsted-grotesk-latin-wght-normal.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; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/assets/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/fonts/geist-latin-wght-normal.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; }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/fonts/geist-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Noto Sans'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/fonts/noto-sans-latin-wght-normal.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; }
@font-face { font-family: 'Noto Sans'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/fonts/noto-sans-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Surfaces and text (the site's palette) */
  --paper: #f7f7f4;
  --paper-sunk: #eeeeea;
  --surface: #fdfdfb;
  --ink: #16171a;
  --ink-2: #474a52;
  --ink-3: #62666f;
  --rule: #e1e1db;
  --rule-strong: #c4c4bc;
  /* Accent: marigold on the hub, the bot's colour on a bot's site */
  --accent: #f2b33d;
  --accent-hover: #e8a52a;
  --on-accent: #16171a;
  --accent-text: #8a5400;
  --accent-tint: #f6e7c6;
  --focus: #16171a;
  /* States: a text colour and a quiet tint (AA on paper and on the tint) */
  --ok: #1d6b3a;
  --ok-tint: #e0ebdf;
  --warn: #8a5400;
  --warn-tint: #f5e8cc;
  --danger: #a3271c;
  --danger-tint: #f5e0da;
  /* Chart series follow the accent */
  --series-1: var(--accent-text);
  --series-1-fill: color-mix(in srgb, var(--accent) 20%, transparent);
  --series-2: #4f6b7d;
  /* One light source above; only menus, dialogs, Discord windows and the save bar use it */
  --shadow: 0 1px 2px rgb(22 23 26 / 0.06), 0 12px 32px -12px rgb(22 23 26 / 0.22);
  --shadow-up: 0 -1px 0 var(--rule), 0 -8px 24px -16px rgb(22 23 26 / 0.18);
  --scrim: rgb(22 23 26 / 0.42);

  --font-display: 'Schibsted Grotesk', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-text: 'Geist', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-code: ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Type scale: five steps for the UI, two display steps */
  --step--2: 0.75rem;     /* 12px chips, tags */
  --step--1: 0.8125rem;   /* 13px help, captions, table heads */
  --step-0: 0.9375rem;    /* 15px body and controls */
  --step-1: 1.0625rem;    /* 17px section headings, metric values */
  --step-2: 1.25rem;      /* 20px feature and dialog headings */
  --step-3: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);   /* page titles */
  --step-4: clamp(2.25rem, 1.8rem + 1.8vw, 3rem);      /* the focal figure */

  /* Space: a 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 150ms;
  --base: 220ms;
  --slow: 300ms;

  --content: 1200px;
  --gutter: 16px;
  --bar-h: 56px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #0f1012;
  --paper-sunk: #17181c;
  --surface: #1b1c21;
  --ink: #ededef;
  --ink-2: #b5b8bf;
  --ink-3: #8e929b;
  --rule: #26282d;
  --rule-strong: #3a3d44;
  --accent: #f2b33d;
  --accent-hover: #f6c35f;
  --on-accent: #16171a;
  --accent-text: #f5c566;
  --accent-tint: #2e2617;
  --focus: #f5c566;
  --ok: #86cf9c;
  --ok-tint: #17261c;
  --warn: #f5c566;
  --warn-tint: #2c2416;
  --danger: #f2907f;
  --danger-tint: #301a17;
  --series-2: #8fb3c9;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 40px -16px rgb(0 0 0 / 0.6);
  --shadow-up: 0 -1px 0 var(--rule), 0 -12px 32px -16px rgb(0 0 0 / 0.5);
  --scrim: rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* Each bot's own accent on its site. Fills carry white text in light (AA) and ink in dark. */
:root[data-site='ticketpost'] { --accent: #2563eb; --accent-hover: #1d4ed8; --on-accent: #ffffff; --accent-text: #1d4ed8; --accent-tint: #e2eafb; --focus: #1d4ed8; }
:root[data-site='ruleguard'] { --accent: #15803d; --accent-hover: #166534; --on-accent: #ffffff; --accent-text: #166534; --accent-tint: #dcece1; --focus: #166534; }
:root[data-site='watchfire'] { --accent: #c2410c; --accent-hover: #9a3412; --on-accent: #ffffff; --accent-text: #9a3412; --accent-tint: #f6e1d4; --focus: #9a3412; }
:root[data-theme='dark'][data-site='ticketpost'] { --accent: #4f8ff7; --accent-hover: #78a9f9; --on-accent: #0f1012; --accent-text: #93bbfb; --accent-tint: #172235; --focus: #93bbfb; }
:root[data-theme='dark'][data-site='ruleguard'] { --accent: #2fbf63; --accent-hover: #4fd17e; --on-accent: #0f1012; --accent-text: #86e0a6; --accent-tint: #13261a; --focus: #86e0a6; }
:root[data-theme='dark'][data-site='watchfire'] { --accent: #f07a35; --accent-hover: #f5955c; --on-accent: #0f1012; --accent-text: #f9b689; --accent-tint: #2d1c12; --focus: #f9b689; }

@media (min-width: 768px) { :root { --gutter: 32px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; interpolate-size: allow-keywords; }
body {
  margin: 0; min-height: 100vh; overflow-x: clip;
  background: var(--paper); color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font-text);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, ul, ol, dl, figure, blockquote { margin: 0; }
h1 { font: 650 var(--step-3)/1.15 var(--font-display); letter-spacing: -0.022em; text-wrap: balance; }
h2 { font: 600 var(--step-1)/1.3 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
h3 { font-size: var(--step-0); line-height: 1.35; font-weight: 600; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .code { font-family: var(--font-code); font-size: 0.875em; }
strong { font-weight: 600; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; stroke-width: 1.75; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.small { font-size: var(--step--1); line-height: 1.5; }
.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; }
.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 80;
  background: var(--ink); color: var(--paper); padding: var(--space-3) var(--space-4); border-radius: var(--radius-s);
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: var(--space-3); }
.text-link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; transition: text-decoration-color var(--fast) var(--ease); }
.text-link:hover { text-decoration-color: var(--accent); }

/* ---------- Buttons: one accent primary per view, everything else quiet ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-s);
  border: 1px solid transparent; background: none; color: var(--ink);
  font: 550 var(--step-0)/1.1 var(--font-text); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-primary:not(:disabled):active { transform: translateY(1px); }
.btn-ghost, .btn-quiet { border-color: var(--rule-strong); background: var(--surface); }
.btn-ghost:not(:disabled):hover, .btn-quiet:not(:disabled):hover { border-color: var(--ink-3); }
.btn-danger { border-color: var(--rule-strong); color: var(--danger); background: var(--surface); }
.btn-danger:not(:disabled):hover { border-color: var(--danger); background: var(--danger-tint); }
.btn-plain { padding: 0 8px; color: var(--ink-2); }
.btn-plain:not(:disabled):hover { color: var(--ink); background: var(--paper-sunk); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: var(--step--1); gap: 6px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: var(--step-1); }
.btn .icon { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-s); border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.icon-btn:hover:not(:disabled) { color: var(--ink); background: var(--paper-sunk); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-tint); }
.icon-btn.tiny { width: 24px; height: 24px; }
.icon-btn.tiny .icon { width: 14px; height: 14px; }
.icon-btn.bordered { border-color: var(--rule-strong); }

/* ---------- Shell: one top bar, the bot's page tabs under it, then the page ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.topbar-row { max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter); height: var(--bar-h); display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.topbar-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1 1 auto; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand-name { font: 650 var(--step-1)/1 var(--font-display); letter-spacing: -0.015em; white-space: nowrap; }
.brand-name span { color: var(--ink-3); font-weight: 500; margin-left: 5px; }
.brand-link { text-decoration: none; border-radius: var(--radius-s); }
/* A bot's mark: its icon on the bot's colour, then its name. */
.bot-mark { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: var(--ink); border-radius: var(--radius-s); }
.bot-mark-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.bot-mark-icon .icon { width: 16px; height: 16px; stroke-width: 2; }
.bot-mark-name { font: 650 var(--step-1)/1 var(--font-display); letter-spacing: -0.015em; white-space: nowrap; }
.hub-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: var(--step--1); font-weight: 500; text-decoration: none; padding: 6px 8px; border-radius: var(--radius-s); white-space: nowrap; }
.hub-link:hover { color: var(--ink); background: var(--paper-sunk); }
.hub-link img { width: 18px; height: 18px; border-radius: 5px; }
.bar-divider { width: 1px; height: 20px; background: var(--rule-strong); flex: none; }
.demo-tag { font-size: var(--step--2); font-weight: 600; color: var(--accent-text); background: var(--accent-tint); padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }

/* The server switch in the bar */
.switcher { min-width: 0; }
.switcher > .btn { max-width: 280px; min-width: 0; gap: 8px; padding: 0 8px 0 6px; border-color: transparent; background: none; font-weight: 550; }
.switcher > .btn:hover { background: var(--paper-sunk); }
.switcher > .btn .guild-icon { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.popover-item.server-option { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.server-option .guild-icon { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.server-option[aria-current='page'] { background: var(--paper-sunk); }
.server-option .check { color: var(--accent-text); }
.popover-scroll { max-height: min(60vh, 420px); overflow-y: auto; display: grid; gap: 2px; }

/* Page tabs of a bot */
.tabs { max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter); display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; flex: none;
  color: var(--ink-3); text-decoration: none; font-weight: 550; font-size: var(--step-0); white-space: nowrap;
  transition: color var(--fast) var(--ease);
}
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab[aria-current='page'] { color: var(--ink); }
.tab[aria-current='page'] .icon { color: var(--accent-text); }
.tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform var(--base) var(--ease); }
.tab[aria-current='page']::after { transform: scaleX(1); }

/* Language, theme and account */
.prefs { display: flex; align-items: center; gap: var(--space-2); }
.flag { display: block; width: 20px; height: 15px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12); flex: none; }
.lang-btn { gap: 6px; padding: 0 8px; }
.lang-code { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.popover-item.lang-option { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; }
.lang-option[aria-checked='true'] { background: var(--paper-sunk); font-weight: 600; }
.lang-option .check { color: var(--accent-text); }
.avatar-btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--surface); display: grid; place-items: center; overflow: hidden; cursor: pointer; color: var(--ink-2); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-btn:hover { border-color: var(--ink-3); }
.me-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 8px 10px 10px; }
.me-card img, .me-card .avatar { width: 36px; height: 36px; border-radius: 50%; grid-row: span 2; }
.me-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-card small { color: var(--ink-3); font-size: var(--step--1); }
.menu-note { padding: 8px 10px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: var(--step--1); }
.menu-note strong { display: block; color: var(--ink); }
.avatar { display: grid; place-items: center; background: var(--paper-sunk); color: var(--ink-2); border: 1px solid var(--rule); }

.main { flex: 1; width: 100%; max-width: var(--content); margin: 0 auto; min-width: 0; padding: var(--space-6) var(--gutter) var(--space-8); outline: none; }
.page { display: grid; gap: var(--space-5); align-content: start; min-width: 0; }
.page > *, .settings-body > *, .section > * { min-width: 0; }
.view-enter { animation: view-in var(--base) var(--ease) both; }
@keyframes view-in { from { opacity: 0; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); flex-wrap: wrap; }
.page-head > div { display: grid; gap: 6px; min-width: 0; }
.page-head p { color: var(--ink-2); max-width: 72ch; }
.page-head > .btn, .page-head > .popover-wrap { flex: none; }
.eyebrow-server { display: none; align-items: center; gap: 8px; color: var(--ink-3); font-size: var(--step--1); font-weight: 500; }
.eyebrow-server .guild-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--step--1); justify-self: start; }
.back-link:hover { color: var(--ink); }

/* ---------- Sections: a heading over a rule, never a box ---------- */
.section { display: grid; gap: var(--space-4); min-width: 0; align-content: start; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--rule); }
.section-head > div { display: grid; gap: 2px; min-width: 0; }
.section-head h2 { font-size: var(--step-1); }
.section-head p { color: var(--ink-3); font-size: var(--step--1); }
.section-actions { display: flex; gap: var(--space-2); flex: none; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-7); }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-7); align-items: start; }
.band { padding: var(--space-4) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.empty { color: var(--ink-2); padding: var(--space-3) 0; max-width: 64ch; }
.empty.small { padding: var(--space-2) 0; font-size: var(--step--1); color: var(--ink-3); }

/* Empty states that teach the next step */
.teach { display: grid; gap: var(--space-3); justify-items: start; padding: var(--space-4) 0; max-width: 60ch; }
.teach h3 { font: 600 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.teach p { color: var(--ink-2); }

/* ---------- Focal metrics and the dense secondary row ---------- */
.focal { display: grid; gap: var(--space-4); }
.focal-figures { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-7); align-items: flex-end; }
.figure { display: grid; gap: 2px; }
.figure-value { font: 650 var(--step-4)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: lining-nums tabular-nums; }
.figure-value small { font: 600 var(--step-2)/1 var(--font-display); color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.figure-label { font-weight: 600; }
.figure-note { color: var(--ink-3); font-size: var(--step--1); max-width: 44ch; }
.figure.is-quiet .figure-value { font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem); color: var(--ink-2); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0; }
.metric { display: grid; gap: 2px; padding: var(--space-3) var(--space-4) var(--space-3) 0; min-width: 0; }
.metric + .metric { padding-left: var(--space-4); border-left: 1px solid var(--rule); }
.metric dt { font-size: var(--step--1); color: var(--ink-3); font-weight: 500; }
.metric dd { margin: 0; font-size: var(--step-1); font-weight: 600; }
.metric dd small { font-size: var(--step--1); font-weight: 500; color: var(--ink-3); margin-left: 4px; }

/* ---------- Charts ---------- */
.chart { position: relative; min-width: 0; overflow: hidden; }
.chart svg { display: block; overflow: visible; }
.legend { display: flex; gap: var(--space-4); font-size: var(--step--1); color: var(--ink-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.key-s1 { background: var(--series-1); }
.key-s2 { background: var(--series-2); }
.grid { stroke: var(--rule); stroke-width: 1; }
.grid.base { stroke: var(--rule-strong); }
.axis { fill: var(--ink-3); font: 500 11px var(--font-text); font-variant-numeric: tabular-nums; }
.line-s1, .line-s2 { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-s1 { stroke: var(--series-1); }
.line-s2 { stroke: var(--series-2); stroke-dasharray: 4 3; }
.area-s1 { fill: var(--series-1-fill); }
.crosshair { stroke: var(--ink-3); stroke-width: 1; }
.dot-s1, .dot-s2 { stroke: var(--paper); stroke-width: 2; }
.dot-s1 { fill: var(--series-1); }
.dot-s2 { fill: var(--series-2); }
.chart:has(.tooltip) { overflow: visible; }
.tooltip {
  position: absolute; top: 28px; transform: translateX(-50%); pointer-events: none; z-index: 2;
  display: grid; gap: 4px; min-width: 180px; padding: 10px 12px; font-size: var(--step--1);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); box-shadow: var(--shadow);
  animation: pop-in var(--fast) var(--ease);
}
.tooltip span { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tooltip b { margin-left: auto; color: var(--ink); }
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.barlist li { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr) 44px; align-items: center; gap: 12px; font-size: var(--step--1); }
.barlist-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.barlist-track { height: 6px; border-radius: 3px; background: var(--paper-sunk); overflow: hidden; }
.barlist-bar { display: block; height: 100%; border-radius: 0 3px 3px 0; transition: width var(--slow) var(--ease); }
.bar-s1 { background: var(--series-1); }
.bar-s2 { background: var(--series-2); }
.barlist-value { text-align: right; font-weight: 600; }

/* ---------- Tables and ruled lists ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: var(--step--1); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; }
.table .rank { color: var(--ink-3); width: 32px; }
.table td.wrap { white-space: normal; min-width: 220px; }
.table tr.clickable { cursor: pointer; transition: background-color var(--fast) var(--ease); }
.table tr.clickable:hover td { background: var(--paper-sunk); }
.table td.current { font-weight: 700; color: var(--ink); background: var(--accent-tint); }
.table th.current { color: var(--ink); }
.ticket-no { font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em; }
.ticket-no:hover { text-decoration-color: var(--accent); }
.rating-cell { display: inline-flex; align-items: center; gap: 8px; font-size: var(--step--1); }
.user { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.user-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-id { font-size: var(--step--1); color: var(--ink-3); }
.stars { display: inline-flex; gap: 1px; }
.star { width: 14px; height: 14px; color: var(--rule-strong); }
.star.on { color: var(--warn); fill: #f2b33d; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: var(--step--1); font-weight: 550; white-space: nowrap; line-height: 1.45; }
.badge .icon { width: 13px; height: 13px; }
.badge-ok { color: var(--ok); background: var(--ok-tint); }
.badge-neutral { color: var(--ink-2); background: var(--paper-sunk); }
.badge-muted { color: var(--ink-3); background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.badge-warn { color: var(--warn); background: var(--warn-tint); }
.badge-danger { color: var(--danger); background: var(--danger-tint); }
.badge-gold { color: #6b4300; background: #f6e2b5; }
:root[data-theme='dark'] .badge-gold { color: #f5c566; background: #2e2617; }

/* ---------- Server list ---------- */
.server-table { width: 100%; border-collapse: collapse; }
.server-table th { text-align: left; font-size: var(--step--1); font-weight: 600; color: var(--ink-3); padding: 0 16px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.server-table td, .server-table tbody th { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; text-align: left; font-weight: inherit; }
.server-table td:last-child { padding-right: 0; }
.server-table thead .bot-col { width: 22%; }
.server-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.server-name strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.server-name small { display: block; color: var(--ink-3); font-size: var(--step--1); }
.guild-icon { width: 36px; height: 36px; border-radius: 10px; flex: none; object-fit: cover; }
span.guild-icon { display: grid; place-items: center; background: var(--paper-sunk); color: var(--ink-2); font-weight: 600; font-size: var(--step--2); border: 1px solid var(--rule); }
.bot-th { display: inline-flex; align-items: center; gap: 8px; }
.bot-th a { color: inherit; text-decoration: none; }
.bot-th a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }
.bot-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
/* One bot on one server: a single line with its state, and the one action at its end. */
.bot-cell { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.bot-state { display: grid; gap: 0; min-width: 0; font-size: var(--step--1); line-height: 1.4; }
.bot-state b { font-weight: 550; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.bot-state span { color: var(--ink-3); }
a.bot-open { color: var(--ink); text-decoration: none; border-radius: var(--radius-s); padding: 6px 8px; margin: -6px -8px; flex: 1; transition: background-color var(--fast) var(--ease); }
a.bot-open:hover { background: var(--paper-sunk); }
a.bot-open .icon { color: var(--ink-3); width: 16px; height: 16px; transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
a.bot-open:hover .icon { color: var(--ink); transform: translateX(2px); }
.state-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--rule-strong); }
.state-dot.on { background: var(--ok); }
.state-dot.premium { background: #e1a22a; }
.state-dot.unknown { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.state-line { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); color: var(--ink-2); }
.product-state { display: grid; gap: 6px; justify-items: start; }
.server-filter { max-width: 320px; }
.list-foot { color: var(--ink-3); font-size: var(--step--1); max-width: 72ch; }

/* Popover menus: scale and fade from the edge they open from */
.popover-wrap { position: relative; display: inline-block; min-width: 0; }
.popover {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: min(340px, calc(100vw - 24px));
  display: grid; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: var(--shadow);
  transform-origin: top left; animation: pop-in 180ms var(--ease);
}
.popover.align-end { left: auto; right: 0; transform-origin: top right; }
.popover.narrow { width: 220px; }
.popover-item { display: grid; gap: 2px; padding: 9px 10px; border-radius: var(--radius-s); text-decoration: none; color: var(--ink); text-align: left; border: 0; background: none; cursor: pointer; width: 100%; font: inherit; transition: background-color var(--fast) var(--ease); }
.popover-item:hover, .popover-item:focus-visible { background: var(--paper-sunk); }
.popover-item strong { display: flex; align-items: center; gap: 8px; }
.popover-item span { color: var(--ink-2); font-size: var(--step--1); }
.popover-item.row { display: flex; align-items: center; gap: 10px; }
.popover-item.row span { color: inherit; font-size: inherit; }
.popover-note { padding: 8px 10px 6px; border-top: 1px solid var(--rule); margin-top: 4px; color: var(--ink-3); font-size: var(--step--1); }
.popover-sep { height: 1px; background: var(--rule); margin: 4px 0; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } }

/* ---------- Callouts: a ruled note, never a filled box ---------- */
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 2px 0 2px 14px; border-left: 2px solid var(--rule-strong); font-size: var(--step-0); max-width: 80ch; }
.callout > .icon { margin-top: 2px; color: var(--ink-3); width: 17px; height: 17px; }
.callout > div { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.callout p { color: var(--ink-2); }
.callout p:first-child strong, .callout > div > p:first-child { color: var(--ink); }
.early-note .callout { max-width: 72ch; }
.early-link { color: var(--accent-text); font-weight: 600; text-underline-offset: 3px; }
.early-link:hover { text-decoration-thickness: 2px; }
.callout-ok { border-left-color: var(--ok); }
.callout-ok > .icon { color: var(--ok); }
.callout-gold, .callout-info { border-left-color: var(--accent); }
.callout-gold > .icon, .callout-info > .icon { color: var(--accent-text); }
.callout-danger { border-left-color: var(--danger); }
.callout-danger > .icon { color: var(--danger); }
.callout-warn { border-left-color: var(--warn); }
.callout-warn > .icon { color: var(--warn); }
.steps { margin: 2px 0 0; padding-left: 20px; list-style: decimal outside; display: grid; gap: 2px; color: var(--ink-2); }
.steps li { padding-left: 2px; }

/* ---------- Loading: skeletons shaped like the content ---------- */
.skeleton { display: grid; gap: var(--space-5); animation: view-in var(--base) var(--ease) 120ms both; }
.sk { display: block; background: var(--paper-sunk); border-radius: 4px; }
.sk-title { height: 32px; width: min(320px, 70%); }
.sk-line { height: 12px; width: 100%; }
.sk-line.short { width: 45%; }
.sk-figure { height: 52px; width: 120px; }
.sk-chart { height: 200px; width: 100%; border-radius: var(--radius-s); }
.sk-row { display: flex; gap: var(--space-4); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.sk-dot { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.sk-field { height: 38px; width: 100%; border-radius: var(--radius-s); }
.sk-group { display: grid; gap: var(--space-3); }
.sk-split { display: grid; grid-template-columns: 200px minmax(0, 640px); gap: var(--space-7); }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--ink-3); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: var(--gutter); bottom: 88px; display: grid; gap: 8px; z-index: 70; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 8px 12px 14px; border-radius: var(--radius-s); background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-size: var(--step--1); animation: toast-in var(--base) var(--ease); }
.toast p { flex: 1; padding-top: 1px; }
.toast > .icon { margin-top: 1px; }
.toast-ok > .icon { color: #86cf9c; }
.toast-danger > .icon { color: #f2907f; }
.toast .icon-btn { width: 26px; height: 26px; color: inherit; opacity: 0.7; }
.toast .icon-btn:hover { background: rgb(255 255 255 / 0.1); opacity: 1; }
:root[data-theme='dark'] .toast .icon-btn:hover { background: rgb(0 0 0 / 0.1); }
:root[data-theme='dark'] .toast-ok > .icon { color: #1d6b3a; }
:root[data-theme='dark'] .toast-danger > .icon { color: #a3271c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Dialog ---------- */
.dialog-layer { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--gutter); background: var(--scrim); animation: fade-in var(--base) var(--ease); }
.dialog {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  display: grid; gap: var(--space-4); padding: var(--space-5);
  background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow);
  animation: dialog-in var(--base) var(--ease);
}
.dialog h2 { font: 650 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.dialog p { color: var(--ink-2); }
.dialog-items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); border-top: 1px solid var(--rule); padding-top: var(--space-3); }
.dialog-items > li { display: grid; gap: 2px; font-size: var(--step--1); }
.dialog-items strong { font-size: var(--step-0); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } }

/* ---------- Form ---------- */
input, select, textarea {
  width: 100%; min-width: 0; min-height: 38px; padding: 7px 11px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-s);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2362666f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; text-overflow: ellipsis; }
textarea { resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus, .icon-select-button:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
input[aria-invalid='true'], textarea[aria-invalid='true'], select[aria-invalid='true'] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
input.code, textarea.code, input.mono, textarea.mono { font-family: var(--font-code); font-size: var(--step--1); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--space-5); align-items: start; }
.form-grid > .local { grid-column: 1 / -1; }
.form-field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; align-content: start; }
.form-field .label, legend.label { font-weight: 600; font-size: var(--step-0); padding: 0; line-height: 1.35; }
legend.label { margin-bottom: 6px; }
.help { color: var(--ink-3); font-size: var(--step--1); line-height: 1.5; max-width: 68ch; }
.field-errors { display: grid; gap: 4px; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--danger); font-size: var(--step--1); animation: fade-in var(--fast) var(--ease); }
.field-error .icon { width: 15px; height: 15px; margin-top: 2px; }
.field-error > div { display: grid; gap: 2px; }
.field-error .steps { color: var(--ink-2); }
.local-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.local-input { position: relative; display: block; }
.local-input input, .local-input textarea { padding-left: 42px; }
.lang-tag { position: absolute; left: 11px; top: 11px; pointer-events: none; }
.num-input { max-width: 180px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.toggle-field { align-self: start; }
.switch { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: inherit; padding: 2px 0; cursor: pointer; text-align: left; }
.switch-track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--paper-sunk); box-shadow: inset 0 0 0 1px var(--rule-strong); position: relative; transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform var(--base) var(--ease), background-color var(--fast) var(--ease); }
.switch[aria-checked='true'] .switch-track { background: var(--accent); box-shadow: none; }
.switch[aria-checked='true'] .switch-thumb { transform: translateX(16px); background: var(--on-accent); }
.switch-text { display: grid; gap: 0; }
.switch-state { font-size: var(--step--1); color: var(--ink-3); }

/* Lists of entries (categories, panels, menus): ruled rows that expand smoothly, no boxes */
.stack-lg { display: grid; gap: var(--space-6); }
.stack-lg:has(> .item) { gap: 0; border-bottom: 1px solid var(--rule); }
.item { border-top: 1px solid var(--rule); background: none; }
.item > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 4px; cursor: pointer; border-radius: var(--radius-s); }
.item > summary::-webkit-details-marker { display: none; }
.item > summary:hover { background: var(--paper-sunk); }
.item::details-content { block-size: 0; overflow: clip; transition: block-size var(--base) var(--ease), content-visibility var(--base) allow-discrete; }
.item[open]::details-content { block-size: auto; }
.item-icon { width: 30px; height: 30px; border-radius: var(--radius-s); display: grid; place-items: center; color: var(--ink-2); background: var(--paper-sunk); flex: none; }
.item-icon .icon { width: 16px; height: 16px; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chev { margin-left: auto; color: var(--ink-3); transition: transform var(--base) var(--ease); }
.item[open] > summary .chev { transform: rotate(90deg); }
.item-body { display: grid; gap: var(--space-5); padding: var(--space-2) 0 var(--space-5) 46px; }
.item-flat { padding: 12px 0; display: grid; gap: var(--space-4); }
.item-foot { display: flex; justify-content: flex-end; gap: 4px; align-items: center; }
.key-chip { font-family: var(--font-code); font-size: var(--step--2); color: var(--ink-3); background: var(--paper-sunk); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.subsection { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.subsection > .btn { justify-self: start; }
.question { border-left: 2px solid var(--rule); padding: 2px 0 2px 16px; display: grid; gap: var(--space-3); }
.question-head { display: flex; align-items: center; gap: 10px; }
.row-actions { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.add-key { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding-top: var(--space-4); }
.add-key .form-field { flex: 1 1 260px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--rule); }
.pick-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.pick-list label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.pick-list input { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); flex: none; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 2px 2px 10px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--rule-strong); font-size: var(--step--1); animation: pop-in var(--fast) var(--ease); }
.chip-missing { border-color: var(--danger); color: var(--danger); }
.chip-warn { border-color: var(--warn); }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }

/* Permission status next to a picked channel or role */
.perm { display: flex; gap: 6px; align-items: flex-start; font-size: var(--step--1); }
.perm .icon { width: 15px; height: 15px; margin-top: 2px; flex: none; }
.perm-ok { color: var(--ok); }
.perm-warn { color: var(--warn); }
.perm-warn > div { display: grid; gap: 2px; }
.perm-warn .steps { color: var(--ink-2); }
.perm-named { display: grid; gap: 2px; font-size: var(--step--1); }

/* Send to channel, and the repair of the permissions: a plain row with a rule above */
.send-panel { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; padding-top: var(--space-3); border-top: 1px solid var(--rule); }
.send-panel > div { display: grid; gap: 2px; min-width: 0; flex: 1 1 240px; }
.send-state { display: flex; gap: 8px; align-items: center; font-size: var(--step--1); color: var(--ink-2); flex-wrap: wrap; font-weight: 500; }
.send-state .icon { width: 16px; height: 16px; }
.send-state a { display: inline-flex; gap: 4px; align-items: center; }
.send-live { color: var(--ok); }

/* Problems, server checks, paused features and the setup report above the form: a ruled list, no box */
.problems, .setup-notice { display: grid; gap: var(--space-2); padding-left: 14px; border-left: 2px solid var(--danger); }
.problems h2, .setup-notice h2 { display: flex; gap: 8px; align-items: center; font: 600 var(--step-0)/1.35 var(--font-text); color: var(--ink); }
.problems h2 .icon, .setup-notice h2 .icon { width: 17px; height: 17px; color: var(--danger); }
.problems > p, .setup-notice > p { color: var(--ink-2); font-size: var(--step--1); }
.problems ul, .setup-notice ul { margin: 0; padding: 0; list-style: none; display: grid; }
.problems ul > li, .setup-notice ul > li { display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: var(--step--1); padding: var(--space-2) 0; border-top: 1px solid var(--rule); }
.problems ul > li > div, .setup-notice ul > li > div { display: grid; gap: 2px; min-width: 0; }
.problems ul > li .btn, .setup-notice ul > li .btn { flex: none; }
.problems-checks { border-left-color: var(--warn); }
.problems-checks h2 .icon { color: var(--warn); }
.setup-notice.tone-ok { border-left-color: var(--ok); }
.setup-notice.tone-ok h2 .icon { color: var(--ok); }
.setup-notice.tone-warn { border-left-color: var(--warn); }
.setup-notice.tone-warn h2 .icon { color: var(--warn); }
.setup-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.setup-group { display: grid; gap: 2px; padding-top: var(--space-1); }
.setup-group h3 { display: flex; gap: 6px; align-items: center; font-size: var(--step--1); color: var(--ink-3); font-weight: 600; }
.setup-group h3 .icon { width: 14px; height: 14px; }
.setup-item-text { display: flex; gap: 8px; align-items: flex-start; }
.setup-item-text .icon { width: 15px; height: 15px; margin-top: 2px; }
.setup-done .icon { color: var(--ok); }
.setup-failed .icon { color: var(--danger); }
.setup-suggested .icon { color: var(--warn); }
.duration-field { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Repair permissions inside the general settings */
.repair-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.repair-row > p { flex: 1 1 260px; }

/* ---------- Settings: section navigation on the side, one column of fields, the save bar at the bottom ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.subnav { position: sticky; top: calc(var(--bar-h) + 44px + var(--space-5)); display: grid; gap: var(--space-4); max-height: calc(100vh - 180px); overflow-y: auto; padding-bottom: var(--space-4); }
.subnav-group { display: grid; gap: 1px; }
.subnav-heading { font-size: var(--step--2); font-weight: 600; color: var(--ink-3); padding: 0 10px 4px; }
.subnav button { position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-s); background: none; color: var(--ink-2); font-weight: 500; font-size: var(--step-0); cursor: pointer; text-align: left; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.subnav button .icon { width: 16px; height: 16px; color: var(--ink-3); }
.subnav button:hover { background: var(--paper-sunk); color: var(--ink); }
.subnav button[aria-current='true'] { background: var(--paper-sunk); color: var(--ink); font-weight: 600; }
.subnav button[aria-current='true']::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.subnav button[aria-current='true'] .icon { color: var(--accent-text); }
.subnav .count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--surface); background: var(--danger); }
.subnav .on-dot { margin-left: auto; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.subnav .on-dot + .count { margin-left: 6px; }
.subnav-select { display: none; }
.settings-body { display: grid; gap: var(--space-6); min-width: 0; max-width: 680px; }
/* One column of field groups: every field is as wide as the column, numbers stay short. */
.settings-body .form-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
.settings-body .item-body .form-grid { gap: var(--space-4); }
.settings-intro { display: grid; gap: var(--space-2); }
.settings-intro h2 { font: 650 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.settings-intro p { color: var(--ink-2); }
.feature-head { display: flex; justify-content: space-between; gap: var(--space-4); align-items: flex-start; padding-bottom: var(--space-4); border-bottom: 1px solid var(--rule); }
.feature-head > div:first-child { display: grid; gap: var(--space-1); }
.feature-head h2 { font: 650 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.feature-head p { color: var(--ink-2); max-width: 64ch; }
.feature-off { color: var(--ink-3); font-size: var(--step--1); }
.settings-page .page-head + .callout { margin-top: calc(var(--space-2) * -1); }
/* The save bar is always at the bottom of the window on a page that saves, so it is never out of reach. */
.savebar {
  /* As wide as the window, its content lined up with the page column. */
  position: sticky; bottom: 0; z-index: 40; margin: var(--space-5) calc(50% - 50vw) calc(var(--space-8) * -1);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 10px max(var(--gutter), calc(50vw - var(--content) / 2 + var(--gutter))) calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-up);
}
.savebar-text { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: var(--step--1); min-width: 0; flex: 1 1 auto; }
.savebar-text > p { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-3); }
.savebar-text > p::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; transition: background-color var(--fast) var(--ease); }
.savebar.is-shown .savebar-text > p { color: var(--ink); }
.savebar.is-shown .savebar-text > p::before { background: var(--accent); }
.savebar-actions { display: flex; gap: var(--space-2); flex: none; }

/* Previews */
.preview { display: grid; gap: var(--space-3); }
.preview-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.preview-head > div { display: grid; gap: 2px; }
.preview-head h3 { display: flex; align-items: center; gap: 8px; }
.preview-head .icon { color: var(--ink-3); }
.preview-note { color: var(--ink-3); font-size: var(--step--1); }
.segmented { display: inline-flex; padding: 2px; border-radius: var(--radius-s); border: 1px solid var(--rule-strong); background: var(--surface); }
.segmented button { border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: var(--step--1); padding: 5px 11px; border-radius: 6px; cursor: pointer; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.segmented button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.segmented-langs button { padding: 5px 9px; min-width: 38px; display: grid; place-items: center; }
.appearance { border: 0; padding: 0; margin: 0; min-width: 0; }
.appearance[disabled] { opacity: 0.6; }
.appearance-layout { display: grid; gap: var(--space-7); grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.appearance-layout .preview { position: sticky; top: calc(var(--bar-h) + 44px + var(--space-5)); }
.image-preview { display: grid; place-items: center; min-height: 96px; border: 1px dashed var(--rule-strong); border-radius: var(--radius-s); padding: 10px; }
.image-preview img { max-width: 100%; max-height: 160px; border-radius: var(--radius-s); }
.image-avatar img { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; }
.file-btn { cursor: pointer; }

/* Filters on list pages */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-field { position: relative; flex: 1 1 280px; display: block; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search-field input { padding-left: 36px; }
.select-field { flex: 0 1 220px; display: block; }
.result-count { font-size: var(--step--1); color: var(--ink-3); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; font-size: var(--step--1); color: var(--ink-2); }
.is-loading { opacity: 0.55; transition: opacity var(--fast) var(--ease); }

/* Ticket detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.detail-main { display: grid; gap: var(--space-6); }
.facts, .answers { margin: 0; display: grid; }
.facts div, .answers div { display: grid; grid-template-columns: minmax(120px, 36%) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.answers div { grid-template-columns: 1fr; gap: 4px; }
dt { color: var(--ink-3); font-size: var(--step--1); font-weight: 500; }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.stack { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.rating-box { display: flex; gap: 18px; align-items: flex-start; }
.rating-score { display: flex; align-items: baseline; gap: 4px; font-family: var(--font-display); }
.rating-score strong { font-size: 44px; font-weight: 650; line-height: 1; }
.rating-score span { color: var(--ink-3); }
.rating-box > div:last-child { display: grid; gap: 6px; }
blockquote { padding: 2px 0 2px 14px; border-left: 2px solid var(--accent); color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.ev { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 14px; }
.ev:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 1px; background: var(--rule-strong); }
.ev-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-sunk); color: var(--ink-2); }
.ev-icon .icon { width: 14px; height: 14px; }
.ev-claimed .ev-icon, .ev-helperJoined .ev-icon { color: var(--ok); background: var(--ok-tint); }
.ev-closed .ev-icon, .ev-channelGone .ev-icon { color: var(--danger); background: var(--danger-tint); }
.ev-rated .ev-icon, .ev-warned .ev-icon, .ev-alerted .ev-icon, .ev-priority .ev-icon { color: var(--warn); background: var(--warn-tint); }
.ev p { padding-top: 3px; }

/* Overview lists: recent cases and alerts */
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.feed-no { font-weight: 600; color: var(--ink-3); font-size: var(--step--1); min-width: 40px; }
.feed-main { display: grid; gap: 2px; min-width: 0; }
.feed-main p { color: var(--ink-2); font-size: var(--step--1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { color: var(--ink-3); font-size: var(--step--1); white-space: nowrap; }
.feed-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; }
.alerts > li { display: grid; gap: 4px; padding: 10px 0 10px 14px; border-left: 2px solid var(--warn); font-size: var(--step--1); color: var(--ink-2); }
.alerts > li + li { margin-top: var(--space-2); }
.alerts > li.is-danger { border-left-color: var(--danger); }
.alerts > li > strong { font-size: var(--step-0); color: var(--ink); }
.alerts > li > .btn { justify-self: start; margin-top: 4px; }
.all-clear { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); padding: 10px 0; }
.all-clear .icon { color: var(--ok); margin-top: 2px; }

/* First-run guide: one ruled row of numbered steps, the next one marked with the accent */
.guide { display: grid; gap: var(--space-4); padding: var(--space-4) 0 var(--space-5); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.guide-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.guide-head > div { display: grid; gap: 4px; }
.guide-head h2 { font: 650 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.guide-head p { color: var(--ink-2); max-width: 64ch; }
.guide-progress { font-size: var(--step--1); color: var(--ink-3); font-weight: 600; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-4) var(--space-5); counter-reset: step; }
.guide-steps li { counter-increment: step; display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-2); padding-top: var(--space-3); border-top: 2px solid var(--rule-strong); }
.guide-steps li::before { content: counter(step); font: 650 var(--step-1)/1 var(--font-display); color: var(--ink-3); }
.guide-steps li.is-next { border-top-color: var(--accent); }
.guide-steps li.is-next::before { color: var(--accent-text); }
.guide-steps li.is-done { border-top-color: var(--ok); }
.guide-steps li.is-done::before { content: none; }
.guide-steps li > p { font-weight: 500; }
.guide-steps li > .btn { justify-self: start; }
.guide-steps .done { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: var(--step--1); font-weight: 600; }

/* ---------- Plan page: comparison and prices on the left, one purchase panel on the right ---------- */
.plan-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); gap: var(--space-7); align-items: start; }
.plan-grid-single { grid-template-columns: minmax(0, 1fr); }
.plan-main { display: grid; gap: var(--space-6); min-width: 0; }
.page-head > .plan-head-side { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.plan-table th, .plan-table td { white-space: normal; }
.plan-table tbody th { font-weight: 500; color: var(--ink); padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); font-size: var(--step-0); }
.plan-table thead th { vertical-align: bottom; }
.plan-table .plan-premium { background: color-mix(in srgb, var(--accent-tint) 55%, transparent); padding-left: 12px; }
.plan-table thead .plan-premium { color: var(--accent-text); }
.plan-table td.is-current { color: var(--ink); font-weight: 600; }
.plan-table th.is-current { color: var(--ink); }
.plan-current { display: block; font-size: var(--step--2); font-weight: 500; color: var(--ink-3); }
.plan-yes { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.plan-yes .icon { width: 15px; height: 15px; }
.plan-no { color: var(--ink-3); font-weight: 400; }
.plan-prices th[scope='row'] { font-weight: 500; color: var(--ink); padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); font-size: var(--step-0); text-align: left; }
.plan-how { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--ink-2); font-size: var(--step--1); max-width: 70ch; }
/* The purchase panel is the page's one framed object: a hairline frame, one primary button, no shadow. */
.plan-buy { position: sticky; top: calc(var(--bar-h) + 44px + var(--space-5)); display: grid; gap: var(--space-4); padding: var(--space-5); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); min-width: 0; }
.plan-buy-head { display: grid; gap: 4px; }
.plan-buy-head h2 { font: 650 var(--step-2)/1.25 var(--font-display); letter-spacing: -0.01em; }
.plan-buy-head p { color: var(--ink-2); }
.plan-choice, .plan-consent { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--space-2); }
.plan-choice legend, .plan-consent legend { padding: 0; margin-bottom: var(--space-2); font-weight: 600; }
.plan-choice-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-2); }
.plan-option {
  position: relative; display: grid; gap: 2px; align-content: center; min-height: 46px; padding: 8px 12px;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius-s); cursor: pointer;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.plan-option:hover { border-color: var(--ink-3); }
.plan-option.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-option.is-off { opacity: 0.5; cursor: not-allowed; }
.plan-option input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: inherit; }
.plan-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.plan-option-label { font-weight: 600; }
.plan-option-note { font-size: var(--step--1); color: var(--ink-2); }
.plan-price { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-3); border-top: 1px solid var(--rule); }
.plan-amount { font: 650 clamp(2rem, 1.7rem + 1.2vw, 2.5rem)/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.plan-per { color: var(--ink-2); }
.plan-saving { color: var(--accent-text); font-weight: 600; font-size: var(--step--1); }
.plan-terms { color: var(--ink-2); font-size: var(--step--1); }
.plan-consent { gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.plan-consent legend { float: left; width: 100%; margin-bottom: 0; }
.plan-consent-item { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.plan-consent-item input { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.plan-cta { width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-block: 10px; }
.plan-secure { display: flex; gap: 8px; align-items: flex-start; font-size: var(--step--1); color: var(--ink-3); }
.plan-secure .icon { width: 14px; height: 14px; margin-top: 3px; }
.plan-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.plan-claim { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
@media (max-width: 1100px) {
  .plan-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .plan-buy { position: static; }
}

/* ---------- Members: avatar, display name and ID ---------- */
.member { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; }
.member-avatar { width: 22px; height: 22px; border-radius: 50%; flex: none; object-fit: cover; background: var(--paper-sunk); }
span.member-avatar { display: grid; place-items: center; color: var(--ink-3); border: 1px solid var(--rule); }
span.member-avatar .icon { width: 13px; height: 13px; }
.member-text { display: grid; min-width: 0; line-height: 1.25; }
.member-name { font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
.member-left { color: var(--ink-2); }
.member-id { font-family: var(--font-code); font-size: var(--step--2); color: var(--ink-3); overflow-wrap: anywhere; }
.member .sk-line { width: 96px; height: 10px; }

/* ---------- Login: the reason on the left, the bot's own messages on the right ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.login-copy { display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-6); padding: var(--space-5) clamp(16px, 5vw, 64px); min-width: 0; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.login-main { display: grid; gap: var(--space-5); align-content: center; max-width: 500px; }
.login-main h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); line-height: 1.06; letter-spacing: -0.028em; }
.login-main .lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-2); }
.login-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); color: var(--ink-2); }
.login-facts li { display: flex; gap: 10px; align-items: flex-start; }
.login-facts .icon { color: var(--accent-text); margin-top: 3px; width: 16px; height: 16px; }
.login-action { display: grid; gap: var(--space-3); justify-items: start; padding-top: var(--space-2); }
.login-foot { color: var(--ink-3); font-size: var(--step--1); max-width: 500px; }
.login-visual { display: grid; align-content: center; justify-items: center; gap: var(--space-4); padding: var(--space-7) clamp(16px, 4vw, 56px); background: var(--paper-sunk); border-left: 1px solid var(--rule); min-width: 0; }
.login.is-single { grid-template-columns: minmax(0, 1fr); }
.login.is-single .login-main { max-width: 600px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .split, .detail-grid, .cols-3 { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .appearance-layout { grid-template-columns: minmax(0, 1fr); }
  .appearance-layout .preview { position: static; }
}
@media (max-width: 960px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .subnav { display: none; }
  /* On narrow screens the sections are one select that stays at the top while the form scrolls. */
  .subnav-select { display: block; position: sticky; top: 0; z-index: 30; margin: 0 calc(var(--gutter) * -1); padding: 8px var(--gutter); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
  .subnav-select select { font-weight: 600; }
  .settings-body { max-width: none; }
  .sk-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-visual { border-left: 0; border-top: 1px solid var(--rule); padding: var(--space-6) var(--gutter); }
  .login-copy { padding-inline: var(--gutter); }
}
@media (max-width: 767px) {
  .eyebrow-server { display: flex; }
  /* The bar scrolls away on phones so the form has the room; the tabs stay with it. */
  .topbar { position: static; }
  :root { --bar-h: 52px; }
  .main { padding-top: var(--space-5); }
  .subnav-select { top: 0; }
  .appearance-layout .preview, .plan-buy { top: var(--space-4); }
  .hub-link span, .lang-code { display: none; }
  .bar-divider { display: none; }
}
@media (max-width: 760px) {
  .server-table thead { display: none; }
  .server-table, .server-table tbody, .server-table tr, .server-table td, .server-table tbody th { display: block; width: auto; }
  .server-table tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--rule); }
  .server-table td, .server-table tbody th { border: 0; padding: 0; }
  .server-table tbody th ~ td { margin-top: var(--space-2); padding-left: 48px; }
  .server-table td[data-label] { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; }
  .server-table td[data-label]::before { content: attr(data-label); font-size: var(--step--1); font-weight: 600; color: var(--ink-3); }
  .server-table.is-single td[data-label] { grid-template-columns: minmax(0, 1fr); }
  .server-table.is-single td[data-label]::before { display: none; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; }
  .responsive-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .responsive-table td { padding: 0; border: 0; display: grid; gap: 2px; min-width: 0; align-content: start; white-space: normal; }
  .responsive-table td.wrap { grid-column: 1 / -1; min-width: 0; }
  .responsive-table td::before { content: attr(data-label); font-size: var(--step--2); font-weight: 600; color: var(--ink-3); }
  .responsive-table td > .badge, .responsive-table td > .member { justify-self: start; }
  .responsive-table td.num { text-align: left; }
  .responsive-table tr.clickable:hover td { background: none; }
}
@media (max-width: 640px) {
  .form-grid, .local-pair, .pair { grid-template-columns: minmax(0, 1fr); }
  .filters { flex-direction: column; align-items: stretch; }
  .search-field, .select-field { flex: none; }
  .segmented { display: flex; }
  .segmented button { flex: 1; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .problems ul > li, .setup-notice ul > li { flex-direction: column; align-items: flex-start; }
  .savebar { gap: var(--space-2); }
  .savebar-text { font-size: var(--step--2); }
  .savebar-actions .btn { padding: 0 12px; }
  .savebar-actions .btn-label { display: none; }
  .barlist li { grid-template-columns: minmax(80px, 36%) minmax(0, 1fr) 36px; gap: 8px; }
  .metric + .metric { border-left: 0; padding-left: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-top: 1px solid var(--rule); padding-left: 0; }
  .metrics .metric:nth-child(-n+2) { border-top: 0; }
  .metrics .metric:nth-child(even) { padding-left: var(--space-4); border-left: 1px solid var(--rule); }
  .feed > li { grid-template-columns: auto minmax(0, 1fr); }
  .feed-time { grid-column: 2; }
  .item-body { padding-left: 0; }
  .send-panel { align-items: stretch; }
  .send-panel .btn { align-self: flex-start; }
  .guide-steps { grid-template-columns: minmax(0, 1fr); }
  .page { gap: var(--space-4); }
  .main { padding-bottom: var(--space-7); }
  .savebar { margin-bottom: calc(var(--space-7) * -1); }
  .switcher > .btn { max-width: 170px; }
  .topbar-row, .topbar-left { gap: var(--space-2); }
  .bot-mark-name, .hub-link, .hub-link + .bar-divider, .demo-tag, .brand-name span { display: none; }
  .bot-cell { flex-wrap: wrap; }
  .server-table td[data-label] { grid-template-columns: 84px minmax(0, 1fr); }
  .tab { padding: 0 8px; }
}
@media (max-width: 400px) {
  .switcher > .btn { max-width: 128px; }
  .lang-btn .icon { display: none; }
}
@keyframes sheet-in { from { opacity: 0; transform: scale(0.98); } }

/* Motion follows the person's setting: states still change in the same order, nothing moves. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
}

/* Icon choice: a select that shows every icon next to its name. */
.icon-select { position: relative; }
.icon-select-button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 7px 34px 7px 11px; text-align: left; cursor: pointer;
  color: var(--ink); background: var(--surface) no-repeat right 10px center; border: 1px solid var(--rule-strong); border-radius: var(--radius-s);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2362666f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.icon-select-button .icon, .icon-select-list .icon { width: 18px; height: 18px; flex: none; color: var(--accent-text); }
.icon-select-button[aria-invalid='true'] { border-color: var(--danger); }
.icon-select-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-s); box-shadow: var(--shadow);
  animation: pop-in var(--fast) var(--ease);
}
.icon-select-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.icon-select-list li.is-active { background: var(--paper-sunk); color: var(--ink); }
.icon-select-list li[aria-selected='true'] { color: var(--ink); font-weight: 600; }
.icon-select-list .icon-select-check { margin-left: auto; color: var(--ink-3); }

/*
 * Fields side by side line up: the labels, the controls and the help texts of one row each share a track, so a
 * label that wraps to two lines in one language never pushes its control below its neighbours. Only grids that
 * hold plain fields (label, control, up to four lines under it) take part; any other grid keeps its own flow.
 */
:is(.form-grid, .pair):not(:has(> :not(.form-field), > .form-field > :nth-child(7))) { row-gap: 0; }
:is(.form-grid, .pair):not(:has(> :not(.form-field), > .form-field > :nth-child(7))) > .form-field {
  grid-row: span 6; grid-template-rows: subgrid; row-gap: 0; align-content: start;
}
:is(.form-grid, .pair):not(:has(> :not(.form-field), > .form-field > :nth-child(7))) > .form-field > * + * { margin-top: 6px; }
.form-grid:not(:has(> :not(.form-field), > .form-field > :nth-child(7))) > .form-field { padding-bottom: var(--space-5); }
.pair:not(:has(> :not(.form-field), > .form-field > :nth-child(7))) > .form-field { padding-bottom: var(--space-3); }
.settings-body .form-grid:not(:has(> :not(.form-field), > .form-field > :nth-child(7))) > .form-field { padding-bottom: var(--space-5); }

/* Time zone choice: the offset in a fixed column, then the zone name; a search field on top of the list. */
.tz-select .icon-select-button { gap: 12px; }
.tz-offset { flex: none; min-width: 9ch; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: var(--step--1); }
.tz-panel { padding: 0; overflow: hidden; display: grid; max-height: none; }
.tz-search { border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; box-shadow: none !important; }
.tz-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.tz-list li { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.tz-list li.is-active { background: var(--paper-sunk); color: var(--ink); }
.tz-list li[aria-selected='true'] { color: var(--ink); font-weight: 600; }
.tz-none { padding: 12px; margin: 0; }

/* The table of a log routing (Ruleguard), tiergate copy rows and other rare blocks keep their own flow. */
.copy-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.copy-row code { overflow-wrap: anywhere; }

/* Long labels on phones: a feature's switch goes under its heading, and list entries never push the page wider. */
.stack-lg > *, .item, .item > summary { min-width: 0; }
@media (max-width: 640px) {
  .feature-head { flex-direction: column; gap: var(--space-3); }
}
@media (max-width: 640px) {
  .switcher { flex: 0 1 auto; min-width: 0; }
  .switcher > .btn { max-width: 100%; }
  .plan-table th, .plan-table td { padding-right: 8px; font-size: var(--step--1); }
  .plan-table .plan-premium { padding-left: 8px; }
}
/* An add form with its own heading (Watchfire's new game server) reads top to bottom. */
.add-key:has(> h3) { display: grid; gap: var(--space-2); justify-items: start; }
.add-key:has(> h3) > .form-grid { width: 100%; margin-top: var(--space-2); }
/* A plain information note stays neutral, so a bot whose colour is orange never reads as a warning. */
.callout-info { border-left-color: var(--rule-strong); }
.callout-info > .icon { color: var(--ink-3); }
/* A single line control never stretches to the height of a taller neighbour in its row. */
.form-field > input, .form-field > select, .form-field > .num-input { align-self: start; }
/* On a short page that saves, the save bar still sits at the bottom of the window. */
.main { display: flex; flex-direction: column; }
.main .view-enter:has(.savebar) { flex: 1; display: flex; flex-direction: column; }
.page:has(> .savebar) { flex: 1; display: flex; flex-direction: column; }
.page:has(> .savebar) > .savebar { margin-top: auto; }
