/* Server Manager — web UI
   Tokens: flakeyy/eucalyptus brand-colors.md (dark theme, the only theme on
   flakey.tech). Status colours match uptime.flakey.tech's theme.css. */

/* Inter (variable, OFL — fonts/Inter-LICENSE.txt), self-hosted so no
   third-party font host is needed. Relative URL: inherits the versioned
   /assets/<version>/ prefix and its immutable caching. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/InterVariable.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg-page: #1C3130;          /* Deep */
  --bg-surface: #243F3A;
  --bg-surface-alt: #2C4F48;   /* Grove */
  --bg-brand-tint: #3D6B61;    /* Branch */
  --bg-sunken: #162826;        /* console / inputs, a step below Deep */
  --text-primary: #F6F8F7;     /* Smoke */
  --text-secondary: #DDE8E5;   /* Surface green */
  --text-muted: #A8C4BC;       /* Silver */
  --brand-primary: #DDE8E5;
  --brand-action: #6A9A8E;     /* Sage */
  --brand-action-hover: #A8C4BC;
  --brand-soft: #3D6B61;
  --border: #3D6B61;
  --border-subtle: #2C4F48;
  /* Form-control outlines need 3:1 against both sunken and surface (WCAG
     1.4.11); Branch (#3D6B61) only reached 2.5:1 / 1.9:1. */
  --border-input: #5F9084;
  --accent: #7BAEC4;           /* Haze */
  --accent-surface: #1E3D52;   /* Deep sky */
  /* Text on Sage: Deep (#1C3130) was 4.33:1, short of AA; this is 5.5:1. */
  --on-action: #0F1C1B;
  --brand-action-hover-rgb: 168, 196, 188;

  --color-up: #2ecc71;
  --color-degraded: #f39c12;
  --color-down: #e74c3c;
  --color-unknown: #95a5a6;
  --danger-text: #f2a59c;
  --danger-surface: #3b2422;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --shadow-lift: 0 6px 20px rgba(var(--brand-action-hover-rgb), 0.12);
  --font: "Inter", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --max-width: 1120px;
}

* { box-sizing: border-box; }
/* `hidden` must win over component display rules (.btn is inline-flex, etc.). */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
/* Anchored/focused content clears the 60px sticky top bar. */
html { scroll-padding-top: 76px; }
body {
  min-height: 100vh;
  font: 15px/1.55 var(--font);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--brand-primary); line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: 0.88em; background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.05em 0.35em; }
:focus-visible { outline: 2px solid var(--brand-action-hover); outline-offset: 2px; }
/* Headings/regions focused by script (route changes, stepper) aren't controls. */
[tabindex="-1"]:focus { outline: none; }
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 60;
  background: var(--brand-action); color: var(--on-action); font-weight: 700;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.75rem; text-decoration: none; }
.noscript { padding: 2rem; }
h2.h3 { font-size: 1rem; font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(28, 49, 48, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem;
  height: 60px; display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--brand-primary); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand .dot { color: var(--brand-action); }
/* Swipeable on narrow screens, but never shows a scrollbar (overflow-y must be
   explicit: overflow-x alone makes it compute to auto). */
.nav { display: flex; gap: 0.25rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; }
.nav a {
  color: var(--text-muted); font-weight: 600; font-size: 0.92rem;
  padding: 0.4rem 0.75rem; border-radius: var(--radius-sm); white-space: nowrap;
}
.nav a:hover { color: var(--text-primary); background: var(--bg-surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text-primary); background: var(--bg-surface-alt); }
.usermenu { display: flex; align-items: center; gap: 0.5rem; }
.usermenu .who { color: var(--text-secondary); font-weight: 600; font-size: 0.9rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--bg-surface-alt); color: var(--brand-primary);
  font-weight: 700; font-size: 0.8rem; border: 1px solid var(--border);
}

main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-head .titles { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.crumb { color: var(--text-muted); font-size: 0.88rem; font-weight: 600; }
.crumb a { color: var(--text-muted); }
.crumb a:hover { color: var(--text-primary); }
.footer { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem 2rem; color: var(--text-muted); font-size: 0.82rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.footer a { color: var(--text-muted); }

.banner {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--accent-surface); color: var(--text-secondary);
  padding: 0.75rem 1rem; margin-bottom: 1.25rem; font-size: 0.92rem;
}
.banner.admin { background: #3a2f22; border-color: #6b5434; color: #f3dcb8; }
.banner.warn { background: #3a3220; border-color: #6b5c34; color: #f3e3b8; }
.banner strong { color: inherit; }

/* ── Surfaces ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.grid > .card, .options > .card, .stack > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head p { color: var(--text-muted); font-size: 0.9rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
/* min(…, 100%) lets a single column shrink below the minimum on 320px phones. */
.grid.servers { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
.grid > *, .grid.two > .stack { min-width: 0; }
.divider { height: 1px; background: var(--border-subtle); margin: 1rem 0; border: 0; }

/* Server cards — same hover language as flakey.tech's .service links */
.server-card {
  display: flex; flex-direction: column; gap: 0.9rem;
  color: inherit; text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}
.server-card:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: var(--brand-action-hover); box-shadow: var(--shadow-lift);
}
.server-card .title { display: flex; align-items: flex-start; gap: 0.75rem; }
.server-card .title h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.server-card .meta { color: var(--text-muted); font-size: 0.85rem; display: flex; gap: 0.9rem; flex-wrap: wrap; }

.tile { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 1rem 1.1rem; }
.tile .label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tile .value { font-size: 1.45rem; font-weight: 700; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.tile .value small { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.tile .meter { margin-top: 0.7rem; }

.meter { height: 6px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand-action); transition: width 400ms ease; }
.meter.warn > span { background: var(--color-degraded); }
.meter.crit > span { background: var(--color-down); }
/* Task progress: always Sage (the theme's action colour); never warns. */
.meter.progress { height: 8px; margin-bottom: 1rem; background: var(--bg-sunken); }
.meter.progress > span { background: var(--brand-action); transition: width 250ms linear; }
.meters { display: grid; gap: 0.55rem; }
.meters .m { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0.6rem; align-items: center; font-size: 0.8rem; color: var(--text-muted); }
.meters .m .v { font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 6.5rem; text-align: right; }

/* ── Status ────────────────────────────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--color-unknown); flex: none; }
.status.running::before { background: var(--color-up); box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.18); }
.status.starting::before, .status.stopping::before { background: var(--color-degraded); animation: pulse 1.4s ease-in-out infinite; }
.status.offline::before { background: var(--color-unknown); }
.status.suspended::before { background: var(--color-down); }
.status.installing::before { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.status.succeeded::before { background: var(--color-up); }
.status.failed::before, .status.interrupted::before { background: var(--color-down); }
@keyframes pulse { 50% { opacity: 0.35; } }

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.75rem; font-weight: 600; line-height: 1;
  padding: 0.3rem 0.5rem; border-radius: 99px;
  background: var(--bg-surface-alt); color: var(--text-secondary); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-surface); color: var(--accent); border-color: #2f5a75; }
.badge.good { background: #1f3e2f; color: #9fe3b9; border-color: #2c6346; }
.badge.warn { background: #3a3220; color: #f3d49b; border-color: #6b5c34; }
.badge.bad { background: var(--danger-surface); color: var(--danger-text); border-color: #6b3a34; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* ── Buttons & inputs ──────────────────────────────────────────────────── */
.btn {
  --btn-bg: transparent; --btn-fg: var(--text-primary); --btn-border: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1;
  padding: 0.6rem 1rem; min-height: 38px;
  border-radius: 10px; border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.btn:hover { text-decoration: none; border-color: var(--brand-action-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { --btn-bg: var(--brand-action); --btn-fg: var(--on-action); --btn-border: var(--brand-action); }
.btn.primary:hover:not([disabled]) { --btn-bg: var(--brand-action-hover); --btn-border: var(--brand-action-hover); }
.btn.ghost { --btn-border: transparent; color: var(--text-muted); }
.btn.ghost:hover { color: var(--text-primary); background: var(--bg-surface-alt); }
.btn.start { --btn-bg: #1f3e2f; --btn-fg: #9fe3b9; --btn-border: #2c6346; }
.btn.start:hover:not([disabled]) { --btn-bg: #24503a; --btn-border: #3d8a5e; }
.btn.danger { --btn-bg: var(--danger-surface); --btn-fg: var(--danger-text); --btn-border: #6b3a34; }
.btn.danger:hover:not([disabled]) { --btn-bg: #4d2b28; --btn-border: #a8524a; }
.btn.danger.solid { --btn-bg: #b8473b; --btn-fg: #fff; --btn-border: #b8473b; }
/* Hover goes darker, not lighter: white on #cf5446 was only 4.19:1. */
.btn.danger.solid:hover:not([disabled]) { --btn-bg: #a63f34; --btn-border: #e07a6e; }
.btn.sm { padding: 0.4rem 0.7rem; min-height: 30px; font-size: 0.82rem; border-radius: 8px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }

label.field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); }
label.field .hint { font-weight: 400; color: var(--text-muted); font-size: 0.82rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; font-size: 0.95rem; color: var(--text-primary);
  background: var(--bg-sunken); border: 1px solid var(--border-input); border-radius: 10px;
  padding: 0.6rem 0.75rem; min-height: 40px; width: 100%;
}
input::placeholder { color: #7f9c94; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-action-hover); box-shadow: 0 0 0 3px rgba(var(--brand-action-hover-rgb), 0.15); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--color-down); box-shadow: inset 4px 0 0 var(--color-down); }
input:disabled { opacity: 0.55; cursor: not-allowed; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 3.2rem; }
.input-suffix span { position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.85rem; pointer-events: none; }
.form-error { color: var(--danger-text); font-size: 0.88rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
fieldset.field.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field.plain legend { padding: 0; margin-bottom: 0.4rem; }

.check { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border-input); border-radius: 10px; cursor: pointer; background: var(--bg-sunken); }
.check:hover { border-color: var(--brand-action-hover); }
.check.inline { align-self: flex-start; padding: 0.4rem 0.7rem; }
.check.inline input { margin-top: 0.15rem; }
.check input { margin-top: 0.2rem; accent-color: var(--brand-action); }
.check .t { display: block; font-weight: 600; font-size: 0.9rem; }
.check .d { display: block; color: var(--text-muted); font-size: 0.8rem; }
.checks { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }

/* Selectable option cards (create stepper, versions) */
.options { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.option {
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.25rem;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.option:hover:not([disabled]) { border-color: var(--border); background: #1a2f2c; }
.option[aria-pressed="true"] { border-color: var(--brand-action); background: #1f3a35; box-shadow: inset 0 0 0 1px var(--brand-action); }
.option[disabled] { opacity: 0.5; cursor: not-allowed; }
.option .t { font-weight: 600; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.option .d { color: var(--text-muted); font-size: 0.83rem; overflow-wrap: anywhere; }
.list-options { display: flex; flex-direction: column; gap: 0.5rem; }
.list-options .option { flex-direction: row; align-items: center; gap: 0.75rem; }
.list-options .option .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }

/* Stepper */
.steps { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; counter-reset: step; }
.steps li { list-style: none; display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-weight: 600; font-size: 0.88rem; }
.steps li::before {
  counter-increment: step; content: counter(step);
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--border); font-size: 0.78rem;
}
.steps li + li { padding-left: 0.5rem; }
.steps li + li::after { content: none; }
.steps li[aria-current="step"] { color: var(--text-primary); }
.steps li[aria-current="step"]::before { background: var(--brand-action); color: var(--on-action); border-color: var(--brand-action); }
.steps li.done { color: var(--text-secondary); }
.steps li.done::before { content: "✓"; background: var(--bg-surface-alt); }
.steps { padding: 0; margin-top: 0; }

/* Tabs */
/* The active underline is an inset shadow, not a -1px-margin border: with
   overflow-x set, overflow-y computes to auto too, and that 1px overhang
   produced a stray scrollbar. */
.tabs {
  display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-subtle); margin-bottom: 1.25rem;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--text-muted);
  background: none; border: 0;
  padding: 0.6rem 0.9rem; cursor: pointer; white-space: nowrap; flex: none;
}
.tabs button:hover { color: var(--text-primary); }
.tabs button:focus-visible { outline-offset: -2px; border-radius: 6px; }
.tabs button[aria-selected="true"] { color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--brand-action); }
.segmented { display: inline-flex; background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 3px; }
.segmented button { font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); background: none; border: 0; border-radius: 7px; padding: 0.35rem 0.8rem; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--bg-surface-alt); color: var(--text-primary); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.7rem 0.9rem; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; margin-top: 0.75rem; color: var(--text-muted); font-size: 0.85rem; }

/* Console */
.console {
  background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.console-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border-subtle); font-size: 0.85rem; color: var(--text-muted); }
.console-out {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; color: #d6e4df;
  height: 380px; overflow: auto; padding: 0.75rem 0.9rem; margin: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.console-out .sys { color: var(--accent); }
.console-out .empty { color: var(--text-muted); font-style: italic; }
.console-in { display: flex; gap: 0.5rem; padding: 0.6rem; border-top: 1px solid var(--border-subtle); }
.console-in input { font-family: var(--mono); font-size: 0.85rem; }
.console-in .prompt { color: var(--brand-action); font-family: var(--mono); align-self: center; padding-left: 0.3rem; }

/* Job log */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log li { display: grid; grid-template-columns: 4.75rem 1fr; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--border-subtle); font-size: 0.9rem; }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--text-muted); font-family: var(--mono); font-size: 0.78rem; padding-top: 0.15rem; }
/* Modpack install: phase tracker, current step, folded activity log */
.install-file { margin: -0.35rem 0 1rem; }
.install-phases { margin-bottom: 1rem; gap: 0.6rem 1rem; }
.install-phases li + li { padding-left: 0; }
.steps li.failed { color: var(--danger-text); }
.steps li.failed::before { content: "!"; background: var(--danger-surface); border-color: #6b3a34; color: var(--danger-text); }
.install-now { padding: 0.9rem 1rem; margin-bottom: 1rem; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface-alt); }
.install-now:empty { display: none; }
.install-now-title { display: flex; align-items: center; gap: 0.65rem; font-weight: 600; }
.install-now-title .md p { margin: 0; }
.install-now .meter.progress { margin: 0.8rem 0 0.45rem; }
.install-now-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.spinner { flex: none; width: 14px; height: 14px; border: 2px solid var(--brand-action); border-right-color: transparent; border-radius: 50%; animation: spin 800ms linear infinite; }
.install-log { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); }
.install-log summary { cursor: pointer; width: fit-content; font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); }
.install-log[open] summary { margin-bottom: 0.5rem; }
.log li .md p { margin: 0; display: inline; }
.result { border-radius: var(--radius); padding: 1rem 1.1rem; border: 1px solid var(--border); background: var(--bg-surface-alt); }
.result.ok { border-color: #2c6346; background: #1d3a2c; }
.result.bad { border-color: #6b3a34; background: var(--danger-surface); }

/* Markdown output from shared message strings */
.md p + p, .md p + ul, .md ul + p { margin-top: 0.6rem; }
.md ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.md li { margin: 0.15rem 0; }

/* Empty / loading states */
.empty-state { text-align: center; padding: 3rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.empty-state img { width: 56px; opacity: 0.9; }
.empty-state p { color: var(--text-muted); max-width: 46ch; }
.skeleton { background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-surface-alt) 50%, var(--bg-surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius-lg); min-height: 150px; border: 1px solid var(--border-subtle); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Dialog */
dialog {
  color: inherit; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 2rem));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
dialog::backdrop { background: rgba(10, 20, 19, 0.65); backdrop-filter: blur(2px); }
dialog .d-body { padding: 1.35rem 1.35rem 1rem; display: flex; flex-direction: column; gap: 0.9rem; }
dialog .d-foot { display: flex; gap: 0.5rem; justify-content: flex-end; padding: 0.9rem 1.35rem; border-top: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.08); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
dialog.wide { width: min(720px, calc(100vw - 2rem)); }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  background: var(--bg-surface-alt); border: 1px solid var(--border); border-left: 4px solid var(--brand-action);
  border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 200ms ease;
}
.toast.error { border-left-color: var(--color-down); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* Auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.75rem; padding: 2rem 1.25rem; }
.auth .logo { width: clamp(64px, 11vw, 88px); }
.auth .card { width: min(460px, 100%); padding: 1.5rem; }
.auth h1 { text-align: center; }
.auth .lede { text-align: center; color: var(--text-muted); margin-top: 0.35rem; }
.steps-list { margin: 0; padding-left: 1.2rem; color: var(--text-secondary); font-size: 0.9rem; display: grid; gap: 0.3rem; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.25rem; font-size: 0.92rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.danger-zone { border-color: #5a3430; }
.danger-zone .zone-row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 0.9rem 0; border-top: 1px solid var(--border-subtle); }
.danger-zone .zone-row:first-of-type { border-top: 0; padding-top: 0; }

@media (max-width: 720px) {
  .topbar-inner { gap: 0.75rem; }
  .brand span { display: none; }
  .usermenu .who { display: none; }
  main { padding-top: 1.25rem; }
  .page-head .actions { margin-left: 0; }
}

/* ── Console extras ────────────────────────────────────────────────────── */
.console-body { position: relative; }
.console-head { flex-wrap: wrap; }
.console-head .btn.sm { min-height: 28px; }
.jump-latest {
  position: absolute; right: 1rem; bottom: 0.75rem;
  --btn-bg: var(--bg-surface-alt); --btn-border: var(--border-input);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); border-radius: 99px;
}
.console-err { padding: 0 0.9rem; }
.console-err .form-error:not([hidden]) { padding-top: 0.5rem; }
/* ANSI SGR colours, tuned for at least 4.5:1 on the console background. */
.console-out .ansi-0 { color: #9fb0ab; }
.console-out .ansi-1 { color: #f08a7e; }
.console-out .ansi-2 { color: #8fd6a0; }
.console-out .ansi-3 { color: #e9cf7a; }
.console-out .ansi-4 { color: #8fb8f0; }
.console-out .ansi-5 { color: #d9a0e2; }
.console-out .ansi-6 { color: #7fcbd2; }
.console-out .ansi-7 { color: #d6e4df; }
.console-out .ansi-8 { color: #a9bab5; }
.console-out .ansi-9 { color: #ffa196; }
.console-out .ansi-10 { color: #abedb9; }
.console-out .ansi-11 { color: #f7e29b; }
.console-out .ansi-12 { color: #b0cef6; }
.console-out .ansi-13 { color: #ebbbf1; }
.console-out .ansi-14 { color: #a6e2e7; }
.console-out .ansi-15 { color: #f6f8f7; }
.console-out .ansi-b { font-weight: 700; }
.console-out .ansi-i { font-style: italic; }
.console-out .ansi-u { text-decoration: underline; }

/* ── Toast dismiss, refresh notice, update banner ──────────────────────── */
.toast { display: flex; align-items: flex-start; gap: 0.75rem; }
.toast > .md { flex: 1; min-width: 0; }
.toast-close {
  flex: none; font: inherit; font-size: 1.2rem; line-height: 1; color: var(--text-muted);
  background: none; border: 0; border-radius: 6px; padding: 0.1rem 0.4rem; cursor: pointer; margin: -0.2rem -0.4rem 0 0;
}
.toast-close:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.refresh-notice { margin-bottom: 1rem; }
.update-banner {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 55;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: var(--accent-surface); border: 1px solid #2f5a75; color: var(--text-secondary);
  border-radius: var(--radius); padding: 0.6rem 0.75rem 0.6rem 1rem; font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); max-width: calc(100vw - 2rem);
}

/* ── Sessions ──────────────────────────────────────────────────────────── */
.sessions { list-style: none; margin: 0; padding: 0; }
.session { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; padding: 0.7rem 0; border-top: 1px solid var(--border-subtle); }
.session:first-child { border-top: 0; padding-top: 0; }
.session-main { min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; overflow-wrap: anywhere; }

/* ── Reduced motion: no shimmer, slide-ins, bar easing or smooth scroll ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .status::before { animation: none !important; }
  .spinner { animation: none; border-right-color: var(--brand-action); }
  .skeleton { animation: none; background: var(--bg-surface); }
  .toast { animation: none; }
  .server-card, .btn, .option { transition: none; }
  .server-card:hover { transform: none; }
  .meter > span, .meter.progress > span { transition: none; }
  .btn .spin { animation-duration: 1.6s; }
}
