/* Design system: docs/DESIGN.md. Tokens first, then components. Only transform and opacity are
   animated; glows are separate layers whose opacity changes. */
@font-face { font-family: "Oxanium"; src: url(/fonts/oxanium-var.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/fonts/atkinson-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/fonts/atkinson-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/fonts/atkinson-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plexmono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plexmono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* color: dark theme (default) */
  --void: #05080f;
  --grid: rgba(56,225,255,.045);
  --haze-1: rgba(56,225,255,.07);
  --haze-2: rgba(179,157,255,.06);
  --panel: rgba(11,19,34,.82);
  --panel-solid: #0b1322;
  --panel-2: #111c30;
  --raised: #16233a;
  --edge: rgba(56,225,255,.18);
  --edge-strong: rgba(56,225,255,.45);
  --line: rgba(150,180,220,.12);
  --text: #e6eef8;
  --text-2: #b3c2d6;
  --muted: #8b9bb2;
  --cyan: #38e1ff;
  --cyan-fill: #38e1ff;
  --cyan-hover: #7eeeff;
  --on-cyan: #04121a;
  --violet: #b39dff;
  --ok: #34f5a0;
  --warn: #ffb547;
  --bad: #ff6b86;
  --bad-fill: #c21d45;
  --idle: #63708a;
  --led-ok: var(--ok); --led-warn: var(--warn); --led-bad: var(--bad); --led-idle: var(--idle);
  --tint-cyan: rgba(56,225,255,.07);
  --tint-violet: rgba(179,157,255,.1);
  --tint-warn: rgba(255,181,71,.08);
  --tint-bad: rgba(255,107,134,.09);
  --tint-ok: rgba(52,245,160,.08);
  --glow: rgba(56,225,255,.55);
  --glow-soft: rgba(56,225,255,.22);
  --shadow: 0 24px 70px rgba(0,0,0,.55);
  --console-bg: #03060b;
  --console-text: #cfe3f2;
  --console-glow: 0 0 6px rgba(56,225,255,.28);
  --backdrop: rgba(2,4,9,.72);

  /* type */
  --display: "Oxanium", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 27px;

  /* space and shape */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 4px; --r-md: 6px; --cut: 10px;
  --clip: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));

  /* motion */
  --t-press: 90ms; --t-fast: 150ms; --t-med: 220ms; --t-slow: 300ms;
  --ease-out: cubic-bezier(.2,.8,.2,1); --ease-in: cubic-bezier(.4,0,1,1); --ease-spring: cubic-bezier(.3,1.4,.5,1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --void: #e9f0f7;
  --grid: rgba(0,109,136,.07);
  --haze-1: rgba(0,160,200,.08);
  --haze-2: rgba(91,63,196,.05);
  --panel: rgba(250,252,254,.86);
  --panel-solid: #fafcfe;
  --panel-2: #f1f6fb;
  --raised: #e6eef6;
  --edge: rgba(0,109,136,.22);
  --edge-strong: rgba(0,109,136,.5);
  --line: rgba(10,24,48,.1);
  --text: #0a1830;
  --text-2: #2f4059;
  --muted: #526379;
  --cyan: #006d88;
  --cyan-fill: #007a99;
  --cyan-hover: #006d88;
  --on-cyan: #ffffff;
  --violet: #5b3fc4;
  --ok: #0a7a4a;
  --warn: #8a5200;
  --bad: #c0183f;
  --bad-fill: #c21d45;
  --idle: #66758b;
  --led-ok: #0f9d5f; --led-warn: #c77700; --led-bad: #d61f4c; --led-idle: #66758b;
  --tint-cyan: rgba(0,122,153,.07);
  --tint-violet: rgba(91,63,196,.08);
  --tint-warn: rgba(199,119,0,.09);
  --tint-bad: rgba(214,31,76,.07);
  --tint-ok: rgba(15,157,95,.08);
  --glow: rgba(0,150,190,.35);
  --glow-soft: rgba(0,150,190,.14);
  --shadow: 0 20px 60px rgba(20,50,90,.18);
  --console-glow: none;
  --backdrop: rgba(20,35,60,.4);
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--text); background-color: var(--void);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, var(--haze-1), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, var(--haze-2), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  font: var(--fs-md)/1.5 var(--body); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Code-like values (ports, IDs, variable names, paths) use the display face with tabular figures;
   monospace is reserved for the console and the file editor. */
.tech, code { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--muted); }
.num-t { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* HUD surface: a clipped-corner panel drawn with two layers (edge + fill), so the thin edge follows
   the cut. Content sits above both. */
.hud { position: relative; isolation: isolate; }
.hud::before, .hud::after { content: ""; position: absolute; z-index: -1; pointer-events: none; clip-path: var(--clip); }
.hud::before { inset: 0; background: var(--hud-edge, var(--edge)); }
.hud::after { inset: 1px; background: var(--hud-bg, var(--panel)); }

/* ---------- buttons ---------- */
.btn {
  position: relative; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 14px; border-radius: var(--r-md); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--edge); color: var(--text);
  font: 600 var(--fs-sm)/1.2 var(--display); letter-spacing: .02em; white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out);
}
.btn::after {   /* hover glow layer */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px var(--edge-strong), 0 0 16px var(--glow-soft); opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}
.btn:hover:not(:disabled)::after { opacity: 1; }
.btn:hover:not(:disabled) { background: var(--raised); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--cyan-fill); border-color: var(--cyan-fill); color: var(--on-cyan); }
.btn.primary::after { box-shadow: 0 0 18px var(--glow), 0 0 2px var(--glow); }
.btn.primary:hover:not(:disabled) { background: var(--cyan-hover); border-color: var(--cyan-hover); }
.btn.primary:disabled { background: transparent; border-color: var(--edge); color: var(--text-2); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.danger::after { box-shadow: 0 0 0 1px var(--bad), 0 0 14px color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.danger:hover:not(:disabled) { background: var(--tint-bad); }
.btn.danger.solid { background: var(--bad-fill); border-color: var(--bad-fill); color: #fff; }
.btn.danger.solid:hover:not(:disabled) { background: var(--bad-fill); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost::after { box-shadow: 0 0 0 1px var(--edge); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: var(--fs-xs); }
.btn.icon { padding: 6px; min-width: 34px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- inputs ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--edge); color: var(--text);
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--edge-strong); }
.input:disabled { opacity: .6; cursor: not-allowed; border-style: dashed; }
.input:disabled:hover { border-color: var(--edge); }
.input:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px var(--glow-soft); }
.input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.input.bad { border-color: var(--bad); }
.input[readonly] { color: var(--text-2); background: transparent; }
textarea.input { resize: vertical; min-height: 72px; line-height: 1.45; }
textarea.tech { letter-spacing: 0; }
select.input { padding-right: 28px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--cyan-fill); flex: none; }
label.lbl, .lbl { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.hint { font-size: var(--fs-sm); color: var(--muted); margin-top: 6px; max-width: 75ch; }
.hint.bad { color: var(--bad); }
.req { color: var(--bad); margin-left: 3px; }
.form-error { color: var(--text); background: var(--tint-bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  border-left: 3px solid var(--bad); border-radius: var(--r-sm); padding: 9px 12px; margin-top: 12px; font-size: var(--fs-sm); }

/* ---------- sign in ---------- */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 32px 28px 28px; --cut: 16px; animation: rise var(--t-slow) var(--ease-out); }
.login-card::after { box-shadow: var(--shadow); }
.login-card .logo { width: 44px; height: 44px; }
.login-card h1 { margin: 16px 0 4px; font-size: var(--fs-xl); }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .btn { width: 100%; margin-top: 16px; min-height: 40px; font-size: var(--fs-md); }

/* ---------- app shell ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
header.top {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
header.top::after {   /* thin accent line under the header */
  content: ""; position: absolute; left: 0; bottom: -1px; width: 220px; height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 var(--fs-lg)/1 var(--display); letter-spacing: .02em; }
.brand svg { width: 28px; height: 28px; }
.top .spacer { flex: 1; }
.rack-summary b, .dmeta b { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); }
.runner-chip { gap: 8px; }
.credits-chip { gap: 6px; font-variant-numeric: tabular-nums; }
.credits-chip.low { color: var(--warn); }
.credits-chip.empty { color: var(--bad); }
.runner-chip.quiet #runner-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.more-menu.wide { min-width: 340px; max-width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; }
.menu-head { font: 600 var(--fs-sm)/1.3 var(--display); color: var(--muted); padding: 6px 10px 4px; }
.more-menu .mi { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-sm)/1.3 var(--display); }
.more-menu .mi svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.more-menu .mi-check { margin-left: auto; color: var(--cyan); visibility: hidden; }
.more-menu [aria-checked="true"] .mi-check { visibility: visible; }
.bell { position: relative; }
.toast .t-act { margin-left: 6px; flex: none; }
.chg-list li { grid-template-columns: 10px 1fr auto; }
.act-list .ldot.idle { background: var(--led-idle); }
.chg-side { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chg-side time { color: var(--muted); font-size: var(--fs-xs); }
.sov-cols section + section { margin-top: 22px; }
.bell-list { margin: 0; }
.bell-list li { border-left: 2px solid transparent; padding-left: 8px; }
.bell-list li.unread { border-left-color: var(--cyan); }
.bell-item { background: none; border: 0; padding: 0; text-align: left; color: var(--text); font: inherit; cursor: pointer; flex: 1; min-width: 0; }
.bell-item:disabled { cursor: default; }
.bell-item:not(:disabled):hover { text-decoration: underline; text-underline-offset: 2px; }
.bell-count { position: absolute; top: -3px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--cyan-fill); color: var(--on-cyan); font: 700 11px/17px var(--display); text-align: center; }
.top .more-menu { top: calc(100% + 8px); }
.runner-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--led-idle); }
.runner-chip .dot.ready { background: var(--led-ok); }
.runner-chip .dot.busy { background: var(--led-warn); animation: blink 1s steps(2, start) infinite; }
.runner-chip .dot.error { background: var(--led-bad); }
.toggle[aria-pressed="true"] { color: var(--cyan); background: var(--tint-cyan); border-color: var(--edge); }

main.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 420px) 1fr; }
.rack-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rack-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.rack-head h2 { margin: 0; font-size: var(--fs-lg); flex: 1; }
.rack { list-style: none; margin: 0; padding: 4px 14px 16px; overflow-y: auto; flex: 1; }
.rack-summary { padding: 0 16px 10px; font-size: var(--fs-sm); color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.rack-summary .sum-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- rack unit (signature) ---------- */
.unit { margin: 0 0 10px; position: relative; }
.unit-btn {
  --cut: 12px; position: relative; isolation: isolate; width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
  padding: 12px 18px 12px 24px; background: none; border: 0; color: var(--text);
  transition: transform var(--t-press) var(--ease-out);
}
.unit-btn::before, .unit-btn::after { content: ""; position: absolute; z-index: -1; pointer-events: none; clip-path: var(--clip); }
.unit-btn::before { inset: 0; background: var(--hud-edge, var(--edge)); }
.unit-btn::after {
  inset: 1px;
  background:
    radial-gradient(circle at 9px 10px, var(--line) 2.5px, transparent 3px),              /* rack ear screws */
    radial-gradient(circle at 9px calc(100% - 10px), var(--line) 2.5px, transparent 3px),
    linear-gradient(180deg, var(--panel-2), var(--panel));
}
.unit-btn:hover { --hud-edge: var(--edge-strong); }
.unit-btn:active { transform: scale(.99); }
.unit-btn[aria-current="true"] { --hud-edge: var(--cyan); }
.unit-btn[aria-current="true"]::after {
  background:
    linear-gradient(90deg, var(--cyan) 0 3px, transparent 3px),
    radial-gradient(circle at 9px 10px, var(--line) 2.5px, transparent 3px),
    radial-gradient(circle at 9px calc(100% - 10px), var(--line) 2.5px, transparent 3px),
    linear-gradient(90deg, var(--tint-cyan), transparent 70%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
}
.unit:has(.unit-btn[aria-current="true"]) .glowline { opacity: 1; }
.glowline {   /* soft glow under the selected unit (opacity only) */
  position: absolute; inset: 4px 10px -2px; z-index: -1; pointer-events: none; opacity: 0;
  box-shadow: 0 0 22px var(--glow-soft); transition: opacity var(--t-med) var(--ease-out);
}
.unit-name { font: 600 var(--fs-md)/1.25 var(--display); letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-sub { grid-column: 2; font-size: var(--fs-sm); color: var(--muted); display: flex; gap: 12px; overflow: hidden; white-space: nowrap; }
.unit-sub span { overflow: hidden; text-overflow: ellipsis; }
.unit-state { font: 500 var(--fs-sm)/1.2 var(--display); color: var(--text-2); text-align: right; white-space: nowrap; }
.unit-meters { grid-column: 2 / 4; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--muted); }
.meter .bar { height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.meter .fill { display: block; height: 100%; width: 100%; background: var(--cyan); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .6s var(--ease-out); }
.meter .fill.hot { background: var(--warn); }
.meter .val { font-family: var(--display); font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 8ch; text-align: right; }
.unit .progress { grid-column: 2 / 4; margin-top: 6px; height: 4px; }

/* installing sweep: a faint band crossing the unit */
.sweep { position: absolute; inset: 1px; z-index: -1; clip-path: var(--clip); overflow: hidden; pointer-events: none; display: none; }
.sweep::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--led-warn) 13%, transparent), transparent);
  transform: translateX(-100%); animation: sweep 2.6s var(--ease-out) infinite;
}
.unit.st-installing .sweep, .unit.st-updating .sweep { display: block; }
@keyframes sweep { to { transform: translateX(260%); } }

/* boot-up: a new server powers on into the rack */
.unit.boot { animation: boot var(--t-slow) var(--ease-spring); transform-origin: 50% 0; }
.unit.boot .led { animation: power-on 600ms var(--ease-out); }
@keyframes boot { from { opacity: 0; transform: scaleY(.6) translateY(-6px); } }
@keyframes power-on { 0% { opacity: 0; } 30% { opacity: 1; } 45% { opacity: .3; } 100% { opacity: 1; } }

/* ---------- LEDs ---------- */
.led { --led: var(--led-idle); position: relative; width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--led) 55%, #fff), var(--led) 60%); }
.led::before, .led::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; opacity: 0; }
.led::after { inset: -7px; background: radial-gradient(circle, var(--led) 0, color-mix(in srgb, var(--led) 35%, transparent) 35%, transparent 70%); }
.led.stopped { --led: var(--led-idle); background: var(--led-idle); opacity: .75; }
.led.running { --led: var(--led-ok); }
.led.running::after { opacity: .7; animation: breathe 2.4s ease-in-out infinite; }
.led.installing, .led.updating, .led.pending, .led.restarting { --led: var(--led-warn); }
.led.installing::after, .led.updating::after, .led.pending::after { opacity: .45; }
.led.installing::before, .led.updating::before, .led.pending::before {   /* chasing ring */
  inset: -4px; opacity: 1;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--led) 100%);
  -webkit-mask: radial-gradient(circle, transparent 5.5px, #000 6px); mask: radial-gradient(circle, transparent 5.5px, #000 6px);
  animation: spin 1.2s linear infinite;
}
.led.restarting { animation: blink .8s steps(2, start) infinite; }
.led.crashed { --led: var(--led-bad); animation: flicker 1s linear 1 both; }
.led.crashed::after { opacity: .8; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: .85; transform: scale(1.1); } }
@keyframes blink { to { opacity: .25; } }
@keyframes flicker { 0% { opacity: 1; } 8% { opacity: .15; } 16% { opacity: 1; } 26% { opacity: .1; } 34% { opacity: .9; } 46% { opacity: .2; } 58%, 100% { opacity: 1; } }

/* ---------- progress, sparklines, empty states ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--led-warn), color-mix(in srgb, var(--led-warn) 60%, #fff));
  transform-origin: 0 50%; transition: transform .8s var(--ease-out); }
.progress.indeterminate > span { width: 30%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.spark { vertical-align: -3px; margin-left: 6px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--cyan); stroke-width: 1.5; stroke-linejoin: round; }
.spark .area { fill: var(--glow-soft); stroke: none; }
.spark .tip { fill: var(--cyan); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 12px 0 6px; font-size: var(--fs-lg); }
.empty .btn { margin-top: 16px; }

/* ---------- alerts and badges ---------- */
.alert { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--cyan); background: var(--tint-cyan); }
.alert.bad { border-left-color: var(--bad); background: var(--tint-bad); }
.alert.warn { border-left-color: var(--warn); background: var(--tint-warn); }
.alert.info { border-left-color: var(--cyan); background: var(--tint-cyan); }
.alert .muted { color: var(--text-2); }
.top-alert { margin: 0; border-radius: 0; border-width: 0 0 1px 3px; padding: 9px 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 var(--fs-xs)/1.3 var(--display); letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: var(--panel-2); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--tint-warn); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--tint-ok); }
.badge.pend { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 50%, transparent); background: var(--tint-violet); }
.badge.pend .bdot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }

/* ---------- detail pane ---------- */
.detail-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); }
.detail-empty { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
.detail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.detail.enter { animation: rise var(--t-med) var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.dhead { border-bottom: 1px solid var(--line); }
.dhead-row { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.dtitle { flex: 1; min-width: 240px; }
.dtitle h2 { margin: 0; font-size: var(--fs-2xl); display: flex; align-items: center; gap: 12px; letter-spacing: .01em; }
.dtitle h2 .led { width: 12px; height: 12px; }
.dmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 8px; color: var(--muted); font-size: var(--fs-sm); }
.status-text { font: 600 var(--fs-sm)/1.2 var(--display); color: var(--text-2); }
.status-text.running { color: var(--ok); } .status-text.crashed { color: var(--bad); }
.status-text.installing, .status-text.updating, .status-text.restarting, .status-text.pending { color: var(--warn); }
.connect { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--edge);
  border-radius: var(--r-sm); padding: 0 2px 0 9px; font: 500 var(--fs-sm)/24px var(--display); font-variant-numeric: tabular-nums; color: var(--text); }
.connect button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 6px; line-height: 22px; border-radius: 3px; }
.connect button:hover { color: var(--cyan); background: var(--raised); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs { position: relative; display: flex; gap: 2px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; padding: 10px 14px 11px; cursor: pointer; color: var(--muted); white-space: nowrap;
  font: 600 var(--fs-md)/1.2 var(--display); letter-spacing: .01em; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab:focus-visible { outline-offset: -2px; }
.tab-ink { position: absolute; left: 0; bottom: 0; width: 100px; height: 2px; background: var(--cyan); pointer-events: none;
  transform-origin: 0 0; transform: scaleX(0); transition: transform var(--t-med) var(--ease-out); box-shadow: 0 0 10px var(--glow); }
.tabpanel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabpanel.enter:not(#panel-console) { animation: fade var(--t-fast) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }

/* ---------- console (monospace lives here and in the file editor) ---------- */
.console-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--console-bg); }
.console-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid rgba(150,180,220,.1); background: var(--console-bg); }
.console-tools .spacer { flex: 1; }
.con-input { min-height: 30px; padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid rgba(56,225,255,.2); background: #0a1322; color: #e6eef8;
  font: var(--fs-sm) var(--body); }
.con-input:focus { outline: 2px solid #38e1ff; outline-offset: 1px; }
#con-search { width: 14em; }
.console-tools .con-chip { border-color: rgba(56,225,255,.25); color: #b3c2d6; }
.console-tools .con-chip[aria-pressed="true"] { background: rgba(56,225,255,.12); border-color: #38e1ff; color: #7eeeff; }
.con-count { font-size: var(--fs-xs); color: #8b9bb2; }
.console .ts { display: none; color: #6f7f96; margin-right: 10px; text-shadow: none; }
.console.show-ts .ts { display: inline; }
.console .l-reply { color: #c9b8ff; }
.console .a-b { font-weight: 500; }
.console .a30, .console .a90 { color: #8b9bb2; } .console .a31, .console .a91 { color: #ff8fa3; } .console .a32, .console .a92 { color: #6ff5b4; }
.console .a33, .console .a93 { color: #ffc978; } .console .a34, .console .a94 { color: #7fb2ff; } .console .a35, .console .a95 { color: #d6a8ff; }
.console .a36, .console .a96 { color: #7eeeff; } .console .a37, .console .a97 { color: #e6eef8; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--panel-solid); border-top: 1px solid var(--line); }
.quick + .console-bar { border-top: 0; }
.join-card { --cut: 14px; padding: 18px 20px; margin-bottom: 26px; }
.join-card h3 { margin: 0 0 12px; font-size: var(--fs-lg); }
.join-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; }
.join-grid .lbl { margin-bottom: 4px; }
.join-val { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 600 var(--fs-lg)/1.3 var(--display); font-variant-numeric: tabular-nums; }
.join-code { font: 700 var(--fs-2xl)/1.1 var(--display); letter-spacing: .08em; color: var(--cyan); }
.reach { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: var(--fs-sm); color: var(--text-2); }
.reach .rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--led-idle); flex: none; }
.reach .rdot.ok { background: var(--led-ok); }
.pl-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pl-bar .input { max-width: 420px; flex: 1; min-width: 180px; }
.pl-count { font: 600 var(--fs-md) var(--display); margin: 4px 0 8px; }
.pl-count .muted { font: 400 var(--fs-sm) var(--body); margin-left: 8px; }
.pl-table td.act .btn { margin-left: 4px; }
.console-tools .btn.ghost { color: #b3c2d6; }
.console-tools .btn.ghost:hover:not(:disabled) { background: #16233a; color: #e6eef8; }
.console {
  flex: 1; overflow: auto; padding: 12px 16px; margin: 0;
  font: 12.5px/1.55 var(--mono); color: var(--console-text); white-space: pre-wrap; word-break: break-word;
  text-shadow: var(--console-glow);
  background: radial-gradient(ellipse at 50% 0%, rgba(56,225,255,.05), transparent 60%);
}
.console:focus-visible { outline-offset: -2px; }
.console .l-gp { color: #7eeeff; }
.console .l-err { color: #ff8fa3; }
.console .l-warn { color: #ffc978; }
.console .l-cmd { color: #c9b8ff; }
.console .l-sys { color: #8b9bb2; font-style: italic; }
.console .sep { display: block; margin: 8px 0; color: #8b9bb2; border-top: 1px dashed rgba(56,225,255,.2); padding-top: 8px; font-style: italic; }
.console-bar { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel-solid); align-items: center; }
.console-bar .prompt { font: 500 15px var(--mono); color: var(--cyan); }
.console-bar .input { font-family: var(--mono); font-size: 13px; }
.jump { position: absolute; right: 18px; bottom: 66px; }
.conn-state { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.conn-state.bad { color: var(--bad); }

/* ---------- forms: server settings ---------- */
.scroll { flex: 1; min-height: 0; overflow-y: auto; }
.settings { padding: 20px 22px 32px; max-width: 1000px; }
fieldset.sec { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
fieldset.sec legend, .sec-title { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; margin: 0 0 14px;
  font: 600 var(--fs-lg)/1.2 var(--display); color: var(--text); }
fieldset.sec legend::after, .sec-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--edge-strong), transparent 80%); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 16px; }
.grid .full { grid-column: 1 / -1; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; gap: 6px; align-items: start; }
.row.port { grid-template-columns: 100px 100px 96px 1fr 36px; }
.row.env { grid-template-columns: minmax(120px, 1fr) 2fr 36px; }
.row-head { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.row .hint { grid-column: 1 / -1; margin: 0 0 4px; }
.savebar {
  position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 22px; background: color-mix(in srgb, var(--panel-solid) 92%, transparent); border-top: 1px solid var(--edge);
  backdrop-filter: blur(8px);
}
.savebar .msg { flex: 1; color: var(--muted); font-size: var(--fs-sm); min-width: 200px; }
.savebar .msg.dirty { color: var(--warn); }
.varlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.varchip { font: 500 var(--fs-xs)/1.3 var(--display); min-height: 28px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--edge); color: var(--cyan); cursor: pointer; }
.varchip:hover { border-color: var(--cyan); background: var(--tint-cyan); }
details.adv { margin-top: 16px; }
.invp { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.invp .check { margin-top: 6px; }
.invp-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.invp-url { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; min-width: 0; flex: 1 1 260px; }
.join-alt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.qr-block { display: grid; justify-items: start; gap: 8px; margin: 4px 0 12px; }
.qr { display: block; width: 188px; height: 188px; padding: 0; background: #fff; border-radius: 10px; image-rendering: pixelated; }
details.adv.qr-key { margin-top: 0; }
details.adv > summary, details.gs-adv > summary { cursor: pointer; color: var(--text-2); font: 600 var(--fs-md)/1.2 var(--display); padding: 6px 0; }
details.adv > summary:hover, details.gs-adv > summary:hover { color: var(--text); }
details.adv[open] > summary { margin-bottom: 10px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 60px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; bottom: 4px; background: none; border: 0; color: var(--cyan); cursor: pointer;
  font: 600 var(--fs-xs) var(--display); padding: 0 8px; border-radius: 3px; }
.pw-wrap button:hover { background: var(--raised); }

/* ---------- game settings ---------- */
.gs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gs-top { padding: 14px 22px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.gs-toprow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gs-toprow .input { max-width: 340px; }
.gs-body { padding: 20px 22px 32px; max-width: 1100px; }
.gs-body .sec-title { margin-top: 0; }
.gs-group { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; font: 600 var(--fs-md)/1.2 var(--display); color: var(--text); }
.gs-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gs-group .muted { font-weight: 500; }
.gs-field { position: relative; padding-left: 12px; border-left: 2px solid transparent; }
.gs-field.changed { border-left-color: var(--cyan); }
.gs-field.dirty { border-left-color: var(--warn); }
.gs-field.dirty .input { border-color: var(--warn); }
.gs-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.gs-meta code { color: var(--text-2); }
.tag { font: 600 var(--fs-xs)/1.3 var(--display); color: var(--cyan); }
/* Mods tab (Steam Workshop) */
.wk-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.wk-add .input { flex: 1; min-width: 220px; max-width: 560px; }
.wk-list { list-style: none; margin: 0 0 18px; padding: 0; border-top: 1px solid var(--line); }
.wk-item { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wk-thumb { position: relative; width: 80px; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
  background: var(--panel-2) linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 8px 8px; }
.wk-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wk-thumb.none img { display: none; }
.wk-title { font: 600 var(--fs-md)/1.3 var(--display); color: var(--text); overflow-wrap: anywhere; }
.wk-title a { color: inherit; text-decoration: none; }
.wk-title a:hover { text-decoration: underline; text-underline-offset: 2px; }
.wk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.wk-st { display: inline-flex; align-items: center; gap: 6px; }
.wk-st .rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--led-idle); flex: none; }
.wk-st .rdot.ok { background: var(--led-ok); }
.wk-act { display: flex; gap: 2px; }
.wk-act .ibtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 7px; border-radius: 4px; display: inline-flex; min-width: 32px; min-height: 32px; align-items: center; justify-content: center; }
.wk-act .ibtn:hover { color: var(--cyan); background: var(--raised); }
.wk-act .ibtn.del:hover { color: var(--bad); background: var(--tint-bad); }
.wk-act .ibtn:disabled { opacity: .35; cursor: default; background: none; color: var(--muted); }
.wk-act .ibtn svg { width: 16px; height: 16px; }
.wk-mods { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.wk-mods .check { align-items: center; }
.wk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.wk-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--edge); border-radius: 999px; font-size: var(--fs-sm); color: var(--text-2); }
.wk-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 50%; }
.wk-chip button:hover { color: var(--bad); background: var(--tint-bad); }
.wk-field { max-width: 560px; margin: 0 0 16px; }
/* ---- server page: banner, actions, sub-switches, overview (round 2) */
.dhead { padding: 0 22px; overflow: visible; }  /* the ⋯ menu may hang below; .hero clips the art */
.dhead-row { min-height: 190px; align-items: flex-end; padding: 28px 0 8px; }
.hero img, :root[data-theme="light"] .hero img { width: 100%; opacity: 1; -webkit-mask-image: none; mask-image: none; object-position: center 28%; }
/* the art stays vivid at the top; text and tabs sit on a solid band that fades into it */
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--panel-solid) 0%, var(--panel-solid) 38%, color-mix(in srgb, var(--panel-solid) 85%, transparent) 50%,
      transparent 66%); }
.dhead-row { min-height: 210px; }
.dtitle h2 { font-size: 34px; }
.tabs { margin-top: 2px; }
.actions { gap: 8px; align-items: center; }
.btn.big { min-height: 42px; padding: 0 24px; font-size: var(--fs-md); }
.more { position: relative; }
#detail.tinted { --tint: hsl(var(--game-hue) 78% 58%); }
:root[data-theme="light"] #detail.tinted { --tint: hsl(var(--game-hue) 72% 34%); }
#detail.tinted .tab-ink { background: var(--tint); box-shadow: 0 0 10px color-mix(in srgb, var(--tint) 55%, transparent); }
#detail.tinted .dhead { border-bottom-color: color-mix(in srgb, var(--tint) 55%, transparent); }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--edge); border-radius: var(--r-sm); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.more-menu button { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); cursor: pointer;
  font: 600 var(--fs-sm)/1.3 var(--display); display: flex; flex-direction: column; gap: 2px; }
.more-menu button span { font: 400 var(--fs-xs)/1.3 var(--body); color: var(--muted); }
.more-menu button:hover, .more-menu button:focus-visible { background: var(--raised); }
.more-menu button.bad { color: var(--bad); }
.more-menu button:disabled { opacity: .45; cursor: default; background: none; }
.subnav { display: flex; gap: 6px; padding: 12px 22px 2px; flex: none; }
@media (max-width: 900px) {  /* narrow: the art is a strip above the name, never behind text */
  .hero { bottom: auto; height: 130px; }
  .dhead-row { min-height: 0; padding-top: 86px; }
}
.sov { padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 22px; }
.sov .gauges { margin: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1250px) { .sov .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sov .gauge.wide { grid-column: 1 / -1; }
.gauge.slow .g-val { color: var(--warn); }
.sov-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; align-items: start; }
.sov-cols > div { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.sov .settings { padding: 0; }
@media (max-width: 1100px) { .sov-cols { grid-template-columns: 1fr; } }

/* dashboard tiles */
.tile { position: relative; }
.tile-badge { position: absolute; top: 10px; right: 12px; padding: 3px 9px; border-radius: 999px; font: 600 var(--fs-xs)/1.4 var(--display);
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent); border: 1px solid var(--edge); color: var(--text); backdrop-filter: blur(4px); }
.tile-badge b { color: var(--led-ok); font-variant-numeric: tabular-nums; }
.tile.dragging { opacity: .5; }

/* stopped console */
.con-stopped { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 2;
  background: color-mix(in srgb, var(--console-bg) 80%, transparent); }
.con-stopped-card { max-width: 460px; text-align: center; color: var(--console-text); background: var(--console-bg);
  border: 1px solid color-mix(in srgb, var(--console-text) 18%, transparent); border-radius: var(--r-sm); padding: 22px 26px; }
.con-stopped-title { display: inline-flex; align-items: center; gap: 10px; font: 600 var(--fs-xl)/1.2 var(--display); }
.con-stopped-card p { margin: 8px 0 16px; color: color-mix(in srgb, var(--console-text) 78%, transparent); }
.con-stopped-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* loading placeholders */
.skel { background: var(--raised); border-radius: var(--r-sm); animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { 50% { opacity: .45; } }
:root[data-fx="reduced"] .skel { animation: none; }
.skel-wrap { width: 100%; }
.skel-list { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.skel-row { display: flex; gap: 12px; align-items: center; }
.skel-thumb { width: 36px; height: 36px; flex: none; }
.skel-line { height: 12px; }
.skel-line.skel-h { height: 18px; }
.skel-form { padding: 18px 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.skel-form > .skel-h { grid-column: 1 / -1; }
.skel-field { display: flex; flex-direction: column; gap: 8px; }
.skel-box { height: 36px; }
.skel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.skel-card { height: 130px; }
.skel-card.tall { height: 220px; }

/* settings at a glance */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--edge); border-radius: var(--r-sm); overflow: hidden; background: var(--panel-2); }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: block; padding: 7px 12px; font: 600 var(--fs-sm)/1.2 var(--display); color: var(--text-2); border-right: 1px solid var(--edge); }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--cyan-fill); color: var(--on-cyan); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: -2px; }
.seg-opt:hover input:not(:checked) + span { background: var(--raised); color: var(--text); }
.gs-field:has(.seg) { grid-column: span 2; }  /* room for the whole row of choices */
@media (max-width: 700px) { .gs-field:has(.seg) { grid-column: auto; } }
.num-slide { display: flex; gap: 10px; align-items: center; }
.num-slide .gs-range { flex: 1; min-width: 80px; accent-color: var(--cyan-fill); }
.num-slide .input { width: 96px; flex: none; }
.gs-desc.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gs-more { margin: 2px 0 4px; }

/* why it crashed */
.alert.why { display: block; position: relative; background: linear-gradient(var(--tint-bad), var(--tint-bad)), var(--panel-2); }  /* solid: the art sits behind the header */
.why-head { font-size: var(--fs-sm); color: var(--text-2); }
.why-title { font: 600 var(--fs-lg)/1.3 var(--display); margin: 4px 0 4px; color: var(--text); }
.why-detail { margin: 0 0 10px; max-width: 80ch; }
.why-fixes { display: flex; gap: 8px; flex-wrap: wrap; }
.why-done { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; color: var(--ok); font-weight: 600; }
.why-more { margin: 12px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.why-more li { margin: 6px 0; }
.why-more .btn { margin-left: 8px; }
.why-log { margin-top: 10px; }
.why-log summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; }
.con-mini { margin: 8px 0 0; max-height: 280px; overflow: auto; background: var(--console-bg); color: var(--console-text);
  font: 12px/1.5 var(--mono); padding: 10px 12px; border-radius: var(--r-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.mr-ctx { font: 600 var(--fs-sm)/1.3 var(--display); color: var(--text-2); }
.mr-row.off > .wk-thumb, .mr-row.off .wk-title { opacity: .55; }  /* (not the meta line: its "Off" badge must stay readable) */
.mr-on { align-items: center; gap: 6px; font-size: var(--fs-sm); margin-right: 6px; }
.mr-icon { width: 44px; aspect-ratio: 1; }
.wk-item:has(> .mr-icon) { grid-template-columns: 44px minmax(0, 1fr) auto; }
.mr-icon img { object-fit: contain; }
.confirm-list { margin: 12px 0 0; padding-left: 20px; max-height: 40vh; overflow: auto; }
.confirm-list li { margin: 3px 0; }
.wk-field .row { display: flex; gap: 8px; }
.wk-field .row .input { flex: 1; min-width: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--cyan); cursor: pointer; font: 600 var(--fs-xs) var(--display); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--cyan) 40%, transparent); }
.linkbtn:hover { text-decoration-color: currentColor; }
details.gs-adv { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 10px; }
details.gs-adv > summary { color: var(--text); font-size: var(--fs-lg); }
.gs-report { font-size: var(--fs-sm); }
.gs-report ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- files ---------- */
.files { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.fbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 0; font: 500 var(--fs-md)/1.2 var(--display); }
.crumbs button { background: none; border: 0; color: var(--cyan); cursor: pointer; padding: 4px 6px; border-radius: 3px; font: inherit; }
.crumbs button:hover { background: var(--raised); }
.crumbs span.sep { color: var(--muted); }
.crumbs .cur { color: var(--text); padding: 4px 6px; }
table.ftable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ftable th { text-align: left; font: 600 var(--fs-xs)/1.2 var(--display); color: var(--muted); padding: 9px 16px; border-bottom: 1px solid var(--edge);
  position: sticky; top: 0; background: var(--panel-solid); z-index: 1; }
.ftable th:nth-child(2), .ftable th:nth-child(3) { text-align: right; }
.ftable td { padding: 0 16px; border-bottom: 1px solid var(--line); height: 38px; }
.ftable tr:hover td { background: var(--tint-cyan); }
.ftable .fname { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 8px 0; cursor: pointer; color: var(--text); text-align: left; width: 100%; font-size: var(--fs-md); }
.ftable .fname:disabled { cursor: default; color: var(--muted); }
.ftable .fname svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.ftable .fname.dir svg { color: var(--cyan); }
.ftable td.num { font-family: var(--display); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; width: 1%; text-align: right; }
.ftable td.act { width: 1%; text-align: right; white-space: nowrap; }
.ftable .ibtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 7px; border-radius: 4px; display: inline-flex; }
.ftable .ibtn:hover { color: var(--cyan); background: var(--raised); }
.ftable .ibtn.del:hover { color: var(--bad); background: var(--tint-bad); }
.ftable .ibtn svg { width: 16px; height: 16px; }
.ftable tr:hover .ibtn, .ftable .ibtn:focus-visible { color: var(--text-2); }
.drop-hint { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--void) 85%, transparent);
  border: 2px dashed var(--cyan); border-radius: var(--r-md); margin: 8px; color: var(--cyan); font: 600 var(--fs-lg) var(--display); pointer-events: none; z-index: 5; }
.up-status { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 8px; min-width: 0; }
.up-status .progress { width: 120px; margin: 0; }
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor textarea {
  flex: 1; border: 0; border-radius: 0; resize: none; min-height: 200px; padding: 14px 16px;
  background: var(--panel-2); font: 13px/1.6 var(--mono); tab-size: 4; white-space: pre; overflow: auto;
}
.editor textarea:focus { box-shadow: inset 0 0 0 1px var(--cyan); }
/* the code layer sits under the transparent textarea: same font, size, padding and scroll */
.code-ed { position: relative; background: var(--panel-2); }
.code-ed textarea, .code-hl { font: 13px/1.6 var(--mono); tab-size: 4; padding: 14px 16px; margin: 0; white-space: pre; letter-spacing: 0; }
.code-ed:not(.plain) textarea { position: relative; z-index: 1; background: transparent; color: transparent; caret-color: var(--text); }
.code-ed:not(.plain) textarea::selection { background: color-mix(in srgb, var(--cyan) 30%, transparent); color: transparent; }
.code-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--text); }
.code-ed.plain .code-hl { display: none; }
.t-key { color: var(--cyan); } .t-str { color: var(--ok); } .t-num { color: var(--warn); } .t-kw { color: var(--violet); }
.t-com { color: var(--muted); font-style: italic; } .t-sec { font-weight: 700; color: var(--text); }
.code-problems { margin: 0; padding: 8px 16px; font-size: var(--fs-sm); background: var(--tint-warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.code-problems .linkbtn { font-size: var(--fs-sm); }
.editor textarea:focus-visible { outline: none; }

/* ---------- backups, automation, activity ---------- */
.bk-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
.bk-sum b { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); }
.bk-when { font: 600 var(--fs-md)/1.3 var(--display); color: var(--text); }
.bk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-xs); color: var(--muted); padding-bottom: 8px; }
.bk-table td { vertical-align: middle; padding-top: 8px; }
.bk-table td.act { padding-top: 0; }
.bk-table .btn.small { margin-right: 4px; }
.ftable .ibtn.pin[aria-pressed="true"] { color: var(--cyan); }
.badge.reason-before { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--tint-warn); }
.badge.info { color: var(--cyan); border-color: var(--edge-strong); background: var(--tint-cyan); }
.unit.has-update .unit-name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; vertical-align: 3px;
  border-radius: 50%; background: var(--cyan); }
.sch-list { display: flex; flex-direction: column; gap: 8px; }
.sch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--panel-2); }
.sch-row.off { opacity: .65; }
.sch-row .input { width: auto; min-height: 34px; }
.sch-row .sch-time { width: 9.5em; }
.check:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.badge { white-space: nowrap; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-fields .input { width: 5.5em; min-height: 34px; }
.sch-row .sch-next { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.sch-row .check { font-size: var(--fs-sm); align-items: center; }
.sch-row .check input { margin-top: 0; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { min-width: 40px; min-height: 30px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--edge); background: transparent; color: var(--text-2);
  font: 600 var(--fs-xs)/1 var(--display); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--tint-cyan); border-color: var(--cyan); color: var(--cyan); }
.chip:hover { border-color: var(--edge-strong); }
.radios { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.act-list .ldot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); transform: translateY(-1px); }
.act-list .ldot.ok { background: var(--led-ok); } .act-list .ldot.warn { background: var(--led-warn); } .act-list .ldot.error { background: var(--led-bad); }
.act-list time { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; margin-top: 8px; }

/* ---------- emblems, art, dashboard, charts, palette (phase 9) ---------- */
.emb { position: relative; display: inline-grid; place-items: center; flex: none; color: var(--cyan); overflow: visible; vertical-align: middle; }
.emb svg { display: block; }
.emb .sweep-e { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 3px; }
.emb .sweep-e::before { content: ""; position: absolute; inset: -20% auto -20% 0; width: 45%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--cyan) 45%, transparent), transparent);
  transform: translateX(-160%) skewX(-18deg); transition: transform 400ms var(--ease-out); }
:is(.unit-btn, .tile, .tpl, .pal-item):hover .emb .sweep-e::before { transform: translateX(320%) skewX(-18deg); }
.emb .orbit { position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; display: none; }
.emb.running .orbit { display: block; animation: spin 8s linear infinite; }
.emb .orbit::before { content: ""; position: absolute; top: -1px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: var(--led-ok); box-shadow: 0 0 6px var(--led-ok); }
.unit-sub .emb { margin-right: 6px; color: var(--text-2); }
.hero { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.hero img { position: absolute; right: 0; top: 0; height: 100%; object-fit: cover; animation: fade var(--t-slow) var(--ease-out); }
.dhead { position: relative; overflow: hidden; }
.dhead > :not(.hero) { position: relative; z-index: 1; }
.dhead .btn.danger:not(.solid), .dhead .btn.ghost { background: var(--panel-solid); }  /* text never sits on the picture */
.tpl-art { position: relative; display: block; aspect-ratio: 460 / 215; margin: -14px -16px 8px; overflow: hidden;
  background: linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 16px 16px, var(--panel);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
.tpl-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-art.none img { display: none; }
.tpl-art .emb-chip { position: absolute; left: 8px; bottom: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px;
  background: color-mix(in srgb, var(--panel-solid) 80%, transparent); border: 1px solid var(--edge); backdrop-filter: blur(4px); }
.tpl-art.none .emb-chip { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%) scale(1.6); background: transparent; border: 0; }
.kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; margin-left: 6px; border: 1px solid var(--edge); border-radius: 4px;
  font: 600 11px/18px var(--display); color: var(--muted); text-align: center; }
.detail-empty { display: block; padding: 0; place-items: initial; text-align: left; }
.ov { padding: 20px 22px 32px; max-width: 1280px; }
.ov-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-head h2 { margin: 0; font-size: var(--fs-2xl); }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 22px; }
.gauge { --cut: 12px; padding: 14px 16px 10px; }
.gauge .g-lbl { font-size: var(--fs-sm); color: var(--muted); }
.gauge .g-val { font: 600 var(--fs-2xl)/1.15 var(--display); font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.gauge .g-val small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.attn { margin: 0 0 22px; display: grid; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tile { --cut: 12px; --hud-bg: var(--panel-2); display: flex; flex-direction: column; cursor: pointer; padding: 14px 16px 12px; border: 0; background: none;
  text-align: left; color: var(--text); transition: transform var(--t-press) var(--ease-out); }
.tile:hover { --hud-edge: var(--edge-strong); }
.tile:active { transform: scale(.99); }
.tile .tpl-art { margin-bottom: 10px; }
.tile-name { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-md)/1.25 var(--display); }
.tile-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-sm); color: var(--muted); margin-top: 4px; }
.tile-meta b { font-family: var(--display); font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tile-act { display: flex; gap: 6px; margin-top: 10px; position: relative; z-index: 2; }
.tile { position: relative; }
.tile-open { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.tile-open::after { content: ""; position: absolute; inset: 0; z-index: 1; }  /* the whole tile opens the server */
.tile-open:focus-visible { outline: none; }
.tile:has(.tile-open:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.ov-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.up-list { list-style: none; margin: 0; padding: 0; }
.up-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.up-list time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart { position: relative; display: block; width: 100%; outline: none; }
.chart svg { display: block; width: 100%; height: var(--ch, 64px); overflow: visible; }
.chart .c-line { fill: none; stroke: var(--c, var(--cyan)); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .c-area { fill: var(--c, var(--cyan)); opacity: .14; stroke: none; }
.chart .c-base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .c-guide { stroke: var(--text-2); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; }
.boost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 26px; }
.boost { --cut: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.boost h4, .boost h3.boost-h { margin: 0; font: 600 var(--fs-md) var(--display); }
.boost p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); max-width: 60ch; }
.boost-mods { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.boost-mods li { font-size: var(--fs-xs); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--edge); color: var(--text-2); display: inline-flex; gap: 5px; }
.boost-mods li.have { border-color: color-mix(in srgb, var(--ok) 50%, var(--edge)); color: var(--text); }
.boost-mods li.have > span[aria-hidden] { color: var(--ok); }
.boost-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }
.boost-mods li.na { opacity: .6; border-style: dashed; }
.boost-mods .na-t { color: var(--muted); }
.pg-pick { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.pg-pick .input { width: auto; min-width: 140px; }
.cp-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cp-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.cp-steps { margin: 0; padding-left: 20px; font-size: var(--fs-sm); }
.cp-steps li + li { margin-top: 4px; }
.wd-guide { padding: 12px 14px; border: 1px solid var(--edge); border-radius: var(--r-sm); background: var(--panel-2); max-width: 80ch; }
.wd-drop { margin: 14px 0; padding: 22px; border: 1px dashed var(--edge-strong); border-radius: var(--r-md); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.wd-drop.over { border-color: var(--cyan); background: var(--cyan-fill); }
.wd-sum { --cut: 12px; padding: 16px 18px; margin-top: 6px; max-width: 80ch; display: flex; flex-direction: column; gap: 6px; }
.wd-name { font: 600 var(--fs-xl) var(--display); }
.wd-notes { margin: 6px 0 4px; padding-left: 18px; font-size: var(--fs-sm); color: var(--text-2); }
.wd-notes li + li { margin-top: 3px; }
.wd-pick { border: 1px solid var(--edge); border-radius: var(--r-sm); padding: 12px 14px; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; max-width: 60ch; }
.wd-pick legend { font-size: var(--fs-sm); padding: 0 4px; }
.pg-line { font-size: var(--fs-sm); color: var(--text-2); margin: 6px 0 8px; }
.chart .c-ref { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .4; }
.chart .c-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); padding: 3px 8px; border-radius: 4px; pointer-events: none; opacity: 0;
  background: var(--panel-solid); border: 1px solid var(--edge-strong); font: 600 var(--fs-xs) var(--display); white-space: nowrap; color: var(--text); }
.chart.hot .c-guide, .chart.hot .c-tip { opacity: 1; }
.chart:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.chart-empty { font-size: var(--fs-xs); color: var(--muted); height: var(--ch, 64px); display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.hist-grid { display: grid; gap: 18px; }
.hist-grid .lbl { display: flex; justify-content: space-between; }
dialog.palette { width: min(640px, calc(100vw - 24px)); margin-top: 10vh; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-in svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pal-in .input { border: 0; background: transparent; font-size: var(--fs-lg); padding: 4px 0; box-shadow: none; }
.pal-in .input:focus, .pal-in .input:focus-visible { box-shadow: none; outline: none; }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 460px); overflow-y: auto; }
.pal-group { padding: 8px 10px 4px; font: 600 var(--fs-xs) var(--display); color: var(--muted); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; border-left: 3px solid transparent; }
.pal-item .p-hint { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.pal-item[aria-selected="true"] { background: var(--tint-cyan); border-left-color: var(--cyan); }
.pal-item .p-ico { width: 20px; display: grid; place-items: center; color: var(--text-2); }
.pal-foot { display: flex; gap: 16px; padding: 8px 16px 12px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); }
.io-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.preset-list { list-style: none; padding: 0; margin: 0 0 16px; }
.preset-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.preset-list .p-name { font: 600 var(--fs-md) var(--display); }
.preset-list .p-meta { font-size: var(--fs-xs); color: var(--muted); }
.preset-list .spacer { flex: 1; }
:root[data-fx="reduced"] .emb .orbit, :root[data-fx="reduced"] .emb .sweep-e { display: none; }

/* ---------- dialogs ---------- */
dialog {
  border: 0; padding: 0; background: transparent; color: var(--text); overflow: visible;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
}
dialog.wide { width: min(880px, calc(100vw - 24px)); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog[open] { animation: dlg-in var(--t-slow) var(--ease-out); }
dialog[open]::backdrop { animation: fade var(--t-med) var(--ease-out); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg { --cut: 16px; --hud-bg: var(--panel-solid); --hud-edge: var(--edge-strong); display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg::after { box-shadow: var(--shadow); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: var(--fs-xl); flex: 1; }
.dlg-body { padding: 18px 22px; overflow-y: auto; }
.dlg-body > p:first-child { margin-top: 0; }
.dlg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-foot .left { margin-right: auto; }
.dlg h3 { font-size: var(--fs-md); margin: 22px 0 10px; color: var(--text); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tpl {
  --cut: 10px; --hud-bg: var(--panel-2); text-align: left; cursor: pointer; padding: 14px 16px; border: 0; background: none;
  color: var(--text); display: flex; flex-direction: column; gap: 4px; min-height: 76px;
  transition: transform var(--t-press) var(--ease-out);
}
.tpl:hover { --hud-edge: var(--cyan); --hud-bg: var(--raised); }
.tpl:active { transform: scale(.98); }
.tpl b { font: 600 var(--fs-md)/1.25 var(--display); }
.tpl .tpl-meta { font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 12px; }
.tpl.custom { --hud-edge: var(--edge); --hud-bg: transparent; }
.notes { background: var(--tint-cyan); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: var(--r-sm); padding: 10px 12px; font-size: var(--fs-sm); margin-bottom: 16px; max-width: 80ch; }
.runner-log { background: var(--console-bg); color: var(--console-text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; font: 12px/1.45 var(--mono); max-height: 260px; overflow: auto; white-space: pre-wrap; margin: 12px 0 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: var(--fs-sm); }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-all; }

/* ---------- toasts ---------- */
#toasts { position: fixed; inset: 62px 16px auto auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit;
  display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(420px, calc(100vw - 32px)); }
.toast {
  --cut: 10px; --hud-bg: var(--panel-solid); --hud-edge: var(--edge-strong);
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 18px; font-size: var(--fs-sm);
  animation: toast-in var(--t-med) var(--ease-out);
}
.toast::after { box-shadow: var(--shadow); background: linear-gradient(90deg, var(--toast-c, var(--cyan)) 0 3px, var(--panel-solid) 3px); }
.toast.ok { --toast-c: var(--ok); }
.toast.bad { --toast-c: var(--bad); --hud-edge: color-mix(in srgb, var(--bad) 60%, transparent); }
.toast.out { opacity: 0; transform: translateX(16px); transition: opacity var(--t-fast) var(--ease-in), transform var(--t-fast) var(--ease-in); }
.toast .t-msg { flex: 1; }
.toast .t-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; border-radius: 3px; }
.toast .t-x:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }

.back-btn { display: none; }

/* ---------- Reduce effects: no ambient or decorative motion, no glows, no background effects ---------- */
:root[data-fx="reduced"] body { background-image: none; }
:root[data-fx="reduced"] *, :root[data-fx="reduced"] *::before, :root[data-fx="reduced"] *::after { transition: none !important; }
:root[data-fx="reduced"] *:not(.spinner):not(.indeterminate > span),
:root[data-fx="reduced"] *::before, :root[data-fx="reduced"] *::after { animation: none !important; }
:root[data-fx="reduced"] dialog::backdrop { animation: none; backdrop-filter: none; }
:root[data-fx="reduced"] .led::after, :root[data-fx="reduced"] .led::before, :root[data-fx="reduced"] .sweep,
:root[data-fx="reduced"] .btn::after, :root[data-fx="reduced"] .glowline, :root[data-fx="reduced"] header.top::after { display: none; }
:root[data-fx="reduced"] .led.installing, :root[data-fx="reduced"] .led.updating, :root[data-fx="reduced"] .led.pending { box-shadow: 0 0 0 2px color-mix(in srgb, var(--led) 40%, transparent); }
:root[data-fx="reduced"] .console { text-shadow: none; background: none; }
:root[data-fx="reduced"] .tab-ink, :root[data-fx="reduced"] .spark .area { box-shadow: none; }
:root[data-fx="reduced"] .savebar { backdrop-filter: none; background: var(--panel-solid); }
:root[data-fx="reduced"] .input:focus { box-shadow: none; }
:root[data-fx="reduced"] .btn:hover:not(:disabled) { border-color: var(--edge-strong); }
:root[data-fx="reduced"] .btn.primary:hover:not(:disabled) { border-color: var(--cyan-hover); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  main.layout { grid-template-columns: 1fr; }
  .rack-col { border-right: 0; }
  body.show-detail .rack-col { display: none; }
  body:not(.show-detail) .detail-col { display: none; }
  .back-btn { display: inline-flex; flex-basis: 100%; justify-content: flex-start; margin: -4px 0 -2px -8px; }
  .savebar { padding: 10px 14px; }
  .savebar .msg { flex-basis: 100%; }
  .savebar .btn { flex: 1; }
  .actions .btn { min-height: 34px; padding: 4px 10px; }
  .dhead { padding: 12px 14px 0; }
  .dtitle h2 { font-size: var(--fs-xl); }
  .settings, .gs-body { padding: 16px 14px 24px; }
  .gs-top { padding: 12px 14px; }
  .row.port { grid-template-columns: 1fr 1fr 92px 36px; }
  .row.port .p-label { grid-column: 1 / 4; }
  .fbar .crumbs { flex-basis: 100%; }
}
@media (max-width: 560px) {
  header.top { gap: 6px; padding: 8px 10px; }
  .brand span, #pal-btn .t-label { display: none; }
  .toggle .t-label, #runner-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .runner-chip { min-width: 34px; }
  .tab { padding: 10px 8px 11px; font-size: 14px; }
  .unit-meters { grid-template-columns: 1fr; gap: 4px; }
  .ftable .col-mtime { display: none; }
  .wk-item { grid-template-columns: 64px minmax(0, 1fr); }
  .wk-item:has(> .mr-icon) { grid-template-columns: 44px minmax(0, 1fr); }
  .wk-thumb { width: 64px; }
  .wk-act { grid-column: 2; }
  .actions .btn { flex: 1 1 auto; }
  .dlg-head, .dlg-body, .dlg-foot { padding-left: 16px; padding-right: 16px; }
  .gs-toprow .input { max-width: none; }
  #toasts { inset: 56px 10px auto 10px; width: auto; }
  .bk-table thead { display: none; }
  .bk-table tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .bk-table td { border: 0; height: auto; padding: 0 14px; }
  .bk-table td.act { grid-column: 1 / -1; text-align: left; padding-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { .spinner, .progress.indeterminate > span { animation-duration: 2s; } }

/* 1.5 accounts: what friends don't get (the server checks it too) */
body:not([data-role="admin"]) .admin-only { display: none !important; }
body[data-role="user"] .trusted-only { display: none !important; }
body[data-role="admin"] .friend-only { display: none !important; }
.login-card form[hidden] { display: none; }
.login-card .code-in { font: 600 var(--fs-xl) var(--display); letter-spacing: .25em; text-align: center; }
.login-card .input + .lbl, .login-card .pw-wrap + .lbl { margin-top: 14px; }
.acct-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.acct-tbl th, .acct-tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.acct-tbl th { color: var(--muted); font-weight: 600; }
.acct-tbl td.act { white-space: nowrap; text-align: right; }
.acct-tbl .input { padding: 4px 8px; min-height: 0; width: auto; }
.invite-code { font: 700 var(--fs-xl) var(--display); letter-spacing: .08em; color: var(--cyan); }

/* credits and plans (1.5) */
.acct-tbl td.num-t, .acct-tbl th.num-t { text-align: right; font-variant-numeric: tabular-nums; }
.acct-tbl .plus { color: var(--ok); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.plan { position: relative; display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--edge); border-radius: var(--r-md);
  background: var(--raised); cursor: pointer; }
.plan:has(input:checked) { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); }
.plan:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan b { font-family: var(--display); }
.plan .price { color: var(--text); font-variant-numeric: tabular-nums; }
.plan .spec { color: var(--muted); font-size: var(--fs-sm); }
.plan .badge { justify-self: start; margin-top: 4px; }
.plans-edit .row { grid-template-columns: minmax(110px, 1.4fr) repeat(3, minmax(80px, 1fr)) auto; }
.give-form { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) auto; gap: 10px 12px; align-items: end; margin-top: 12px; }
.give-form .give-title { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) { .give-form { grid-template-columns: 1fr; } }
.admin-tabs { margin: 4px 0 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin: 0 0 12px; }
.filters > div { min-width: 180px; }
.acct-tbl tr.failed td { background: var(--tint-warn); }
.credit-cards .g-val small { font-size: var(--fs-sm); }
.steps { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; font-size: var(--fs-sm); color: var(--muted); }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--edge); font: 600 var(--fs-xs) var(--display); }
.steps li[aria-current="step"] { color: var(--text); }
.steps li[aria-current="step"]::before { border-color: var(--cyan-fill); background: var(--cyan-fill); color: var(--on-cyan); }
#inv-form { margin-bottom: 10px; }
.acct-tbl + .sec-title, .acct-tbl + h3 { margin-top: 28px; }

/* round 5: health grade, who played / busy hours, reachability (DESIGN.md "The group's panel") */
.grade { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--r-sm);
  font: 700 18px/1 var(--display); border: 1px solid transparent; }
.grade.sm { min-width: 22px; height: 22px; font-size: 14px; }
.grade.g-A, .grade.g-B { color: var(--ok); background: var(--tint-ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.grade.g-C { color: var(--warn); background: var(--tint-warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.grade.g-D, .grade.g-F { color: var(--bad); background: var(--tint-bad, color-mix(in srgb, var(--bad) 14%, transparent)); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.health-head { display: flex; align-items: center; gap: 12px; }
.health-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.health-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-sm); }
.busy { display: grid; grid-template-columns: 32px repeat(24, minmax(6px, 1fr)); gap: 2px; margin-top: 10px; max-width: 520px; }
.busy .bd { font: 600 var(--fs-xs)/1 var(--display); color: var(--muted); align-self: center; }
.busy .bh { aspect-ratio: 1; border-radius: 2px; background: var(--panel-2); position: relative; }
.busy .bh i { position: absolute; inset: 0; border-radius: 2px; background: var(--cyan); }
.busy-axis { display: grid; grid-template-columns: 32px repeat(4, 1fr); max-width: 520px; font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.pt-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.reach-out { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.reach-out .hint { margin: 0; }
.reach-res ul { margin: 4px 0 0 20px; padding: 0; font-size: var(--fs-sm); }
.reach .rdot.bad { background: var(--bad); }
.reach .rdot.warn { background: var(--warn); }
.recaps { display: flex; flex-direction: column; gap: 12px; }
.recap { padding: 14px 16px; }
.recap-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.recap-head b { font: 600 var(--fs-md, 15px)/1.3 var(--display); }
.recap-head .muted { font-size: var(--fs-sm); }
.recap-players { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.recap-players .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--panel-2); font-size: var(--fs-sm); }
.recap-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.recap ul { margin: 8px 0 0 18px; padding: 0; font-size: var(--fs-sm); }
.nights { display: flex; flex-direction: column; gap: 12px; }
.night { display: grid; grid-template-columns: 78px 1fr; gap: 16px; padding: 14px 16px; align-items: start; }
.night-date { display: flex; flex-direction: column; align-items: center; padding: 8px 0; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--edge); font-family: var(--display); line-height: 1.15; }
.night-date .wd { font-size: var(--fs-xs); color: var(--muted); }
.night-date .dd { font-size: 24px; font-weight: 700; }
.night-date .tm { font-size: var(--fs-sm); }
.night-date.now { border-color: var(--ok); color: var(--ok); }
.night h4 { margin: 0; font: 600 var(--fs-md, 15px)/1.3 var(--display); }
.night .meta { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.night .who { font-size: var(--fs-sm); margin-top: 6px; }
.night-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.rsvp { display: inline-flex; gap: 0; }
.rsvp .btn { border-radius: 0; }
.rsvp .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.rsvp .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.rsvp .btn[aria-pressed="true"] { background: var(--cyan-fill); color: var(--on-cyan); border-color: var(--cyan-fill); }
@media (max-width: 560px) { .night { grid-template-columns: 1fr; } .night-date { flex-direction: row; gap: 10px; justify-content: center; } }

/* co-owners (2.0): the server page without what only the owner may use */
html[data-co] .owner-only { display: none !important; }
.co-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.co-list li { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
dialog.wide.map-dlg { width: min(1400px, 96vw); max-width: 96vw; }
.map-dlg .dlg-head { gap: 10px; }
.map-dlg .dlg-head h2 { flex: 1; }
.map-frame { aspect-ratio: 16 / 10; max-height: 80vh; width: 100%; background: #181818; }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 700px) { .map-frame { aspect-ratio: auto; height: 75vh; } }

/* the shareable invite page (join.html, docs/DESIGN.md "Invite page") */
.invite-body { display: grid; justify-items: center; align-content: start; padding: 48px 16px 24px; min-height: 100vh; }
.invite { width: min(560px, 100%); overflow: hidden; }
.invite-art { aspect-ratio: 460 / 160; background: var(--panel-2); position: relative; }
.invite-art:empty { display: none; }
.invite-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.invite-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, var(--panel-solid)); }
.invite-main { padding: 20px 24px 24px; }
.invite-game { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.invite h1 { margin: 2px 0 10px; font: 700 var(--fs-2xl)/1.15 var(--display); overflow-wrap: anywhere; }
.invite-status { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--text-2); }
.invite-steam { display: inline-flex; margin-bottom: 4px; text-decoration: none; }
.invite-row { margin-top: 16px; }
.invite-row .btn + .btn { margin-left: 8px; }
.invite-steps { margin: 0; line-height: 1.5; }
.invite-foot { color: var(--muted); font-size: var(--fs-xs); margin: 14px 0 0; }
