/* ==========================================================================
   ChicagoServers Panel
   Palette: the Chicago flag at night on Lake Michigan.
   Swap the tokens below for exact brand hex codes; nothing else needs to change.
   ========================================================================== */
/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*.txt). No third-party requests. */
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-ext-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"); }

:root {
  --lake: #0d1b26;        /* page */
  --lake-2: #12232f;      /* raised surfaces */
  --lake-3: #183041;      /* inputs, hover */
  --deep: #08131b;        /* console well */
  --line: #24404f;        /* borders */
  --line-soft: #1b3240;
  --ice: #e8f1f5;         /* text */
  --mist: #8da6b4;        /* secondary text */
  --fog: #5f7a89;         /* tertiary text */
  --flag: #8cd3f2;        /* Chicago flag blue: primary, online */
  --flag-ink: #072433;    /* text on flag blue */
  --flag-dim: rgba(140, 211, 242, .14);
  --star: #e4002b;        /* Chicago star red: brand + destructive */
  --star-soft: #ff5c79;
  --star-dim: rgba(228, 0, 43, .14);
  --amber: #f2b84b;       /* in-between states */

  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --side: 248px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lake);
  color: var(--ice);
  font: 400 15px/1.55 var(--font);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--flag); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--flag); color: var(--flag-ink); }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- type ---------- */
.wide { font-variation-settings: "wdth" 125; letter-spacing: -.01em; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 650; }
h1 { font-size: clamp(26px, 3vw, 34px); font-variation-settings: "wdth" 118; letter-spacing: -.015em; }
h2 { font-size: 18px; font-variation-settings: "wdth" 108; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 .8em; }
.muted { color: var(--mist); }
.faint { color: var(--fog); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- star ---------- */
.star { width: 1em; height: 1em; fill: currentColor; flex: none; }
.ic { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line-soft);
  padding: 22px 14px 18px;
  display: flex; flex-direction: column; gap: 26px;
}
.brand { display: flex; align-items: center; padding: 0 8px; min-height: 36px; color: var(--ice); }
.brand:hover { text-decoration: none; }
.brand .brand-logo { display: block; height: 32px; width: auto; max-width: 196px; object-fit: contain; object-position: left center; }
.brand-fallback { display: inline-flex; align-items: center; gap: 10px; }
.brand-fallback[hidden] { display: none; }
.brand-fallback .star { width: 20px; height: 20px; color: var(--star); }
.brand-fallback b { font-size: 16px; font-variation-settings: "wdth" 122; font-weight: 700; letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { color: var(--fog); font-size: 12.5px; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r);
  color: var(--mist); font-weight: 500;
}
.nav a:hover { background: var(--lake-2); color: var(--ice); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ice); background: var(--lake-2); box-shadow: inset 2px 0 0 var(--flag); }
.nav .count { margin-left: auto; color: var(--fog); font-size: 12px; }
.side .me { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 16px 8px 0; font-size: 13.5px; }
.side .me strong { display: block; color: var(--ice); font-weight: 600; }
.side .me form { display: inline; }
.linkish { background: none; border: 0; padding: 0; color: var(--mist); font: inherit; cursor: pointer; }
.linkish:hover { color: var(--ice); text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; padding: 34px clamp(16px, 4vw, 52px) 80px; }
.main > .wrap { max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin: 6px 0 0; color: var(--mist); }

.topbar { display: none; }

.banner {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 10px 16px; margin: -34px calc(-1 * clamp(16px, 4vw, 52px)) 26px;
  background: var(--star-dim); border-bottom: 1px solid rgba(228, 0, 43, .35); font-size: 14px;
}

/* ---------- the Chicago flag in miniature: stripe, four stars, stripe ---------- */
.flagmark { display: inline-grid; grid-template-rows: 2px auto 2px; row-gap: 5px; width: 104px; flex: none; }
.flagmark i { display: block; background: var(--flag); border-radius: 1px; }
.flagmark span { display: flex; justify-content: space-around; padding: 0 8px; }
.flagmark .star { width: 11px; height: 11px; color: var(--star); }

/* server header rule: the mark, then a hairline to the edge */
.flag-rule { display: flex; align-items: center; gap: 14px; margin: 22px 0 0; }
.flag-rule::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.flag-rule .flagmark { width: 76px; row-gap: 4px; grid-template-rows: 2px auto 2px; }
.flag-rule .flagmark .star { width: 9px; height: 9px; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--line); --bg: transparent; --fg: var(--ice);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r);
  border: 1px solid var(--b); background: var(--bg); color: var(--fg);
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { --b: var(--mist); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { --bg: var(--flag); --b: var(--flag); --fg: var(--flag-ink); }
.btn.primary:hover { --bg: #a8def6; --b: #a8def6; }
.btn.danger { --fg: var(--star-soft); --b: rgba(228, 0, 43, .5); }
.btn.danger:hover { --bg: var(--star-dim); --b: var(--star); }
.btn.solid-danger { --bg: var(--star); --b: var(--star); --fg: #fff; }
.btn.ghost { --b: transparent; --fg: var(--mist); }
.btn.ghost:hover { --bg: var(--lake-3); --fg: var(--ice); }
.btn[disabled], .btn.is-busy { cursor: not-allowed; }
.btn[disabled], .btn.primary[disabled], .btn.danger[disabled], .btn.solid-danger[disabled] { --bg: transparent; --b: var(--line-soft); --fg: var(--fog); }
.btn.is-busy { opacity: .6; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn .ic { width: 16px; height: 16px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { display: block; color: var(--mist); font-weight: 400; font-size: 13px; margin-top: 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=time], input[type=url], select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--lake-3); color: var(--ice);
  border: 1px solid var(--line); border-radius: var(--r);
  font: 400 14.5px var(--font);
  transition: border-color .15s, background .15s;
}
textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; background: var(--deep); tab-size: 4; }
input:hover, select:hover, textarea:hover { border-color: #33576a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--flag); background: #1b3547; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mist) 50%), linear-gradient(135deg, var(--mist) 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--flag); width: 16px; height: 16px; flex: none; }
.check small { display: block; color: var(--mist); font-weight: 400; }
.field { margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

/* ---------- surfaces ---------- */
.panel { background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 22px; box-shadow: inset 0 1px 0 rgba(232, 241, 245, .03); }
.panel + .panel, .stack > * + * { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.panel-head p { margin: 4px 0 0; color: var(--mist); font-size: 14px; }
.section { padding: 26px 0; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
.section:first-child { border-top: 0; padding-top: 4px; }
.section > div:first-child p { color: var(--mist); font-size: 14px; margin-top: 6px; }
.danger-zone { border-color: rgba(228, 0, 43, .35); }

/* ---------- tables / rows ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; color: var(--mist); font-weight: 500; font-size: 13px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(140, 211, 242, .03); }
.table .right { text-align: right; }
.table a.rowlink { color: var(--ice); font-weight: 600; }
.scroll-x { overflow-x: auto; }

/* server list on the dashboard */
.servers { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.srow {
  display: grid; grid-template-columns: 112px minmax(0, 1.6fr) minmax(0, 1fr) 150px 110px;
  align-items: center; gap: 22px; padding: 16px 6px;
  border-bottom: 1px solid var(--line-soft); color: inherit;
  transition: background .15s;
}
.srow:hover { background: var(--lake-2); text-decoration: none; }
.srow .cap { width: 112px; aspect-ratio: 46 / 21; border-radius: var(--r-sm); background: var(--lake-3) center / cover no-repeat; border: 1px solid var(--line-soft); }
.srow .name { font-size: 17px; font-weight: 700; font-variation-settings: "wdth" 118; color: var(--ice); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .game { color: var(--mist); font-size: 13.5px; }
.srow .addr { font-family: var(--mono); font-size: 13px; color: var(--mist); }
.srow .mem { color: var(--mist); font-size: 13px; text-align: right; }

/* ---------- status ---------- */
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--mist); }
.status .star { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.status[data-state="running"] { color: var(--flag); }
.status[data-state="running"] .star { fill: currentColor; }
.status[data-state="crashed"], .status[data-state="unreachable"], .status[data-state="suspended"] { color: var(--star-soft); }
.status[data-state="crashed"] .star, .status[data-state="suspended"] .star { fill: currentColor; }
.status[data-state="starting"], .status[data-state="stopping"], .status[data-state="installing"], .status[data-state="updating"], .status[data-state="restoring"] { color: var(--amber); }
.status[data-state="starting"] .star, .status[data-state="stopping"] .star, .status[data-state="installing"] .star, .status[data-state="updating"] .star, .status[data-state="restoring"] .star { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--lake-3); color: var(--mist); }
.pill.flag { background: var(--flag-dim); color: var(--flag); }
.pill.red { background: var(--star-dim); color: var(--star-soft); }

/* ---------- server header (the bold moment) ---------- */
.shead { margin-bottom: 26px; }
.shead .top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.shead h1 { font-size: clamp(28px, 3.8vw, 44px); font-weight: 680; font-variation-settings: "wdth" 125; line-height: 1.04; max-width: 20ch; overflow-wrap: anywhere; }
.shead .meta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 14px; color: var(--mist); font-size: 14px; }
.shead .status { font-size: 15px; }
.shead .status .star { width: 20px; height: 20px; }
.copy { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; color: var(--ice); background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 5px 10px; cursor: pointer; }
.copy:hover { border-color: var(--line); }
.copy .ic { width: 14px; height: 14px; color: var(--mist); }
.stat { display: inline-flex; gap: 6px; align-items: baseline; }
.stat b { color: var(--ice); font-weight: 600; font-variant-numeric: tabular-nums; }
.power { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin: 0 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px 12px; color: var(--mist); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ice); text-decoration: none; }
.tabs a[aria-selected="true"] { color: var(--ice); border-bottom-color: var(--flag); }

/* ---------- console ---------- */
.console { background: var(--deep); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; height: min(68vh, 720px); min-height: 360px; }
.console .out { flex: 1; overflow-y: auto; padding: 16px 18px; font: 13px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; color: #cfe0e8; }
.console .out .sys { color: var(--flag); }
.console .bar { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); padding: 8px 10px 8px 16px; background: #0a1821; }
.console .bar .prompt { color: var(--flag); font: 600 15px var(--mono); }
.console .bar input { flex: 1; background: transparent; border: 0; height: 36px; padding: 0; font: 13.5px var(--mono); }
.console .bar input:focus { background: transparent; }
.console .tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--fog); font-size: 13px; }
.console .jump { position: absolute; right: 18px; bottom: 64px; }
.console-wrap { position: relative; }

/* ---------- files ---------- */
.fm-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--mono); font-size: 14px; }
.crumbs a, .crumbs span { padding: 4px 6px; border-radius: var(--r-sm); color: var(--mist); }
.crumbs a:hover { background: var(--lake-2); color: var(--ice); text-decoration: none; }
.crumbs .sep { color: var(--fog); padding: 0 1px; }
.crumbs span.here { color: var(--ice); }
.fm { border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; position: relative; }
.fm .table td { padding: 9px 14px; }
.fm .table th { padding: 12px 14px 10px; background: var(--lake-2); }
.fm .fname { display: inline-flex; align-items: center; gap: 10px; color: var(--ice); cursor: pointer; background: none; border: 0; font: inherit; padding: 0; text-align: left; }
.fm .fname:hover { color: var(--flag); }
.fm .fname .ic { color: var(--fog); }
.fm .is-dir .fname .ic { color: var(--flag); }
.fm td.sel { width: 36px; }
.fm input[type=checkbox] { accent-color: var(--flag); width: 16px; height: 16px; }
.fm .empty { padding: 48px 20px; text-align: center; color: var(--mist); }
.fm .drop { position: absolute; inset: 0; background: rgba(13, 27, 38, .9); border: 2px dashed var(--flag); border-radius: var(--r-lg); display: grid; place-items: center; color: var(--flag); font-weight: 600; z-index: 5; }
.selbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--flag-dim); border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); min-width: 170px; background: var(--lake-3); border: 1px solid var(--line); border-radius: var(--r); padding: 5px; z-index: 20; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ice); font: 500 14px var(--font); padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.menu-list button:hover { background: var(--lake-2); }
.menu-list button.red { color: var(--star-soft); }
.progress { height: 3px; background: var(--lake-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--flag); transition: width .2s; }

/* ---------- modal / editor ---------- */
dialog { padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--lake-2); color: var(--ice); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(4, 10, 15, .72); }
dialog form.dlg, dialog .dlg { padding: 22px; }
dialog h2 { margin-bottom: 14px; }
dialog.editor { width: min(1180px, calc(100vw - 32px)); height: calc(100vh - 48px); max-height: none; }
dialog.editor[open] { display: flex; flex-direction: column; }
.editor .ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.editor .ed-head .path { font-family: var(--mono); font-size: 13.5px; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor .ed-head .path b { color: var(--ice); font-weight: 600; }
.editor textarea { flex: 1; border: 0; border-radius: 0; resize: none; min-height: 0; padding: 16px 18px; font: 13px/1.6 var(--mono); background: var(--deep); white-space: pre; overflow: auto; }
.editor .ed-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px 8px 18px; border-top: 1px solid var(--line-soft); color: var(--fog); font-size: 12.5px; }

/* ---------- toasts / flashes ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--lake-3); border: 1px solid var(--line); font-size: 14px; animation: toast-in .25s var(--ease); }
.toast .star { width: 14px; height: 14px; margin-top: 3px; color: var(--flag); }
.toast.error { border-color: rgba(228, 0, 43, .55); }
.toast.error .star { color: var(--star); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.flash { padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: 14.5px; border: 1px solid var(--line); background: var(--lake-2); }
.flash.ok { border-color: rgba(140, 211, 242, .4); }
.flash.error { border-color: rgba(228, 0, 43, .55); background: var(--star-dim); }
.reveal { border: 1px solid var(--flag); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 20px; background: var(--flag-dim); }
.reveal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 10px 0; }
.reveal dt { color: var(--mist); }
.reveal dd { margin: 0; font-family: var(--mono); }

/* ---------- stats on admin overview ---------- */
.kpis { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 30px; }
.kpis div { display: flex; flex-direction: column; }
.kpis b { font-size: 32px; font-variation-settings: "wdth" 120; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpis span { color: var(--mist); font-size: 14px; }
.meter { width: 100%; max-width: 140px; height: 6px; border-radius: 3px; background: var(--lake-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--flag); border-radius: 3px; }
.meter.hot i { background: var(--amber); }
.meter.full i { background: var(--star); }
.checklist { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.checklist li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--lake-3); color: var(--mist); }
.checklist li.done::before { content: "✓"; background: var(--flag); color: var(--flag-ink); }
.checklist li.done span { color: var(--mist); }

pre.block { background: var(--deep); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: #cfe0e8; white-space: pre-wrap; word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--mist); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px 24px;
  background: radial-gradient(1100px 520px at 50% -10%, rgba(140, 211, 242, .07), transparent 70%), var(--lake);
}
.login-box { width: 100%; max-width: 380px; margin: auto 0; }
.login-logo { display: flex; justify-content: center; margin-bottom: 26px; color: var(--ice); }
.login-logo:hover { text-decoration: none; }
.login-logo-img { display: block; height: 52px; width: auto; max-width: 300px; object-fit: contain; }
.login-logo .brand-fallback .star { width: 28px; height: 28px; color: var(--star); }
.login-logo .brand-fallback b { font-size: 24px; font-variation-settings: "wdth" 122; }
.login-box > .flagmark { display: grid; margin: 0 auto 30px; }
.login h1 { font-size: 20px; font-weight: 600; font-variation-settings: "wdth" 100; letter-spacing: 0; text-align: center; margin-bottom: 26px; color: var(--ice); }
.login form { background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 24px 24px 22px; box-shadow: inset 0 1px 0 rgba(232, 241, 245, .03), 0 24px 60px -30px rgba(0, 0, 0, .6); }
.login form .field:last-of-type { margin-bottom: 22px; }
.login form .btn { width: 100%; height: 42px; }
.login .flash { margin-bottom: 16px; }
.login-help { color: var(--mist); font-size: 13.5px; text-align: center; margin: 20px 4px 0; line-height: 1.6; }
.login-foot { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; margin-top: 48px; color: var(--fog); font-size: 13px; }
.login-foot a { color: var(--mist); }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-page .box { max-width: 520px; }
.error-page .code { font-size: 96px; font-variation-settings: "wdth" 125; font-weight: 800; color: var(--line); line-height: 1; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .srow { grid-template-columns: 84px minmax(0, 1fr) 120px; }
  .srow .cap { width: 84px; }
  .srow .addr, .srow .mem { display: none; }
  .section { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; background: var(--lake); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(4, 10, 15, .6); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--lake); z-index: 40; }
  .main { padding-top: 24px; }
  .banner { margin-top: -24px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .srow { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .srow .cap { display: none; }
  .fm .col-size, .fm .col-date, .fm .col-perm { display: none; }
  .console { height: 62vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* notices inside the server header (leftover process, crash restarts) */
.notice { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px 12px 16px; border-radius: var(--r); border: 1px solid rgba(242, 184, 75, .45); background: rgba(242, 184, 75, .08); font-size: 14px; }
.notice p { margin: 0; max-width: 72ch; }
.notice b { font-weight: 600; }
.notice.legacy-cmd { margin: 0 0 22px; align-items: flex-start; border-color: var(--line); background: var(--lake-2); }
.notice.legacy-cmd > div { flex: 1; min-width: 0; }
.notice.legacy-cmd pre { margin-top: 8px; white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.notice.legacy-cmd details summary { cursor: pointer; margin-top: 6px; }

/* ==========================================================================
   1.2 components
   ========================================================================== */

/* ---------- field layout, errors ---------- */
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 22px; align-items: start; }
.field-grid > .field { margin-bottom: 18px; }
.field.has-error input, .field.has-error select { border-color: var(--star-soft); }
.field-error { display: block; color: var(--star-soft); font-size: 13px; margin-top: 6px; }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.input-group .btn { height: 40px; }
input.mono, .mono { font-family: var(--mono); font-size: 13px; }

/* ---------- switch ---------- */
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 600; margin: 4px 0 0; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px; background: var(--lake-3); border: 1px solid var(--line); position: relative; transition: background .18s, border-color .18s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--mist); transition: transform .18s var(--ease), background .18s; }
.switch input:checked + .track { background: var(--flag); border-color: var(--flag); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--flag-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--flag); outline-offset: 2px; }
.switch-text small { display: block; color: var(--mist); font-weight: 400; font-size: 13px; margin-top: 3px; }

/* ---------- launch profile choice ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; margin: 0; cursor: pointer; font-weight: 400; }
.choice input { position: absolute; opacity: 0; }
.choice-body { display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--lake-2); transition: border-color .15s, background .15s; }
.choice-body b { display: block; font-weight: 600; }
.choice-body small { display: block; color: var(--mist); font-size: 13px; margin-top: 4px; line-height: 1.45; }
.choice:hover .choice-body { border-color: #33576a; }
.choice input:checked + .choice-body { border-color: var(--flag); background: var(--flag-dim); box-shadow: inset 0 0 0 1px var(--flag); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--flag); outline-offset: 2px; }

.cmd-preview { margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* sticky save bar */
.savebar { position: sticky; bottom: 16px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 10px 12px 10px 18px; border-radius: var(--r-lg); background: var(--lake-3); border: 1px solid var(--line);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7); animation: toast-in .2s var(--ease); font-size: 14px; }

/* ---------- segmented control ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--lake); border: 1px solid var(--line-soft); border-radius: var(--r); }
.segmented[hidden] { display: none; }
.segmented button { height: 30px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--mist); font: 600 13.5px var(--font); cursor: pointer; }
.segmented button[aria-selected="true"] { background: var(--lake-3); color: var(--ice); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- configs tab ---------- */
.configs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.config-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 20px; }
.config-item { text-align: left; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 10px 12px; color: var(--ice); cursor: pointer; font: inherit; }
.config-item b { display: block; font-weight: 600; font-size: 14.5px; }
.config-item span { color: var(--fog); font-size: 12.5px; }
.config-item:hover { background: var(--lake-2); }
.config-item[aria-pressed="true"] { background: var(--lake-2); border-color: var(--line-soft); box-shadow: inset 2px 0 0 var(--flag); }
.config-pane { background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px 22px; min-height: 360px; }
.config-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.config-head h2 { margin-bottom: 4px; }
.cfg-desc { margin: -6px 0 14px; font-size: 14px; }
.config-pane .notice { margin: 0 0 16px; }
.config-pane form[data-cfg-form] { padding-top: 4px; }
.cfg-textarea { min-height: 480px; }
.config-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line-soft); }

/* ---------- files extras ---------- */
.fm-search { width: 200px; height: 32px; font-size: 13.5px; }
.fm-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.sftp-dialog { width: min(560px, calc(100vw - 32px)); }
.sftp-kv { grid-template-columns: 110px 1fr; align-items: center; }
.sftp-kv .copy { font-size: 13.5px; }

/* ---------- sparklines ---------- */
.spark:empty { display: none; }
.spark { width: 64px; height: 18px; margin-left: 8px; vertical-align: -4px; overflow: visible; }
.spark polyline { stroke: var(--flag); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark polyline.fill { stroke: none; fill: var(--flag-dim); }

/* ---------- search trigger + palette ---------- */
.search-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -10px 0 -6px; height: 36px; padding: 0 8px 0 12px; width: 100%;
  background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r); color: var(--fog); font: 500 13.5px var(--font); cursor: pointer; }
.search-trigger:hover { border-color: var(--line); color: var(--mist); }
kbd { font: 600 11px var(--mono); color: var(--mist); background: var(--lake-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
dialog.palette { width: min(600px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; overflow: hidden; }
dialog.palette::backdrop { background: rgba(4, 10, 15, .6); backdrop-filter: blur(2px); }
.palette input { height: 52px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; padding: 0 18px; font-size: 16px; background: transparent; }
.palette input:focus { background: transparent; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; }
.palette li small { display: block; color: var(--fog); font-size: 12.5px; }
.palette li em { font-style: normal; color: var(--fog); font-size: 12px; }
.palette li[aria-selected="true"] { background: var(--lake-3); }
.palette li[aria-selected="true"] em { color: var(--flag); }
.palette li.empty { color: var(--mist); cursor: default; }
.palette-hint { margin: 0; padding: 8px 16px; border-top: 1px solid var(--line-soft); color: var(--fog); font-size: 12px; display: flex; gap: 6px; align-items: center; }

/* ---------- admin builders ---------- */
.builder { display: flex; flex-direction: column; gap: 8px; }
.builder.nested { padding: 12px; background: var(--lake); border: 1px solid var(--line-soft); border-radius: var(--r); }
.b-row { background: var(--lake-2); border: 1px solid var(--line-soft); border-radius: var(--r); }
.builder.nested .b-row { background: var(--lake-2); }
.b-row > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; cursor: pointer; }
.b-row > summary::-webkit-details-marker { display: none; }
.b-row > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--mist); border-bottom: 1.5px solid var(--mist); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.b-row[open] > summary::before { transform: rotate(45deg); }
.b-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; overflow: hidden; }
.b-title b { font-weight: 600; white-space: nowrap; }
.b-title small { color: var(--fog); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-tools { display: flex; gap: 2px; }
.b-tools .btn.icon { width: 28px; height: 28px; font-size: 15px; }
.b-tools .b-del:hover { color: var(--star-soft); }
.b-body { padding: 4px 14px 14px; border-top: 1px solid var(--line-soft); }
.b-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; padding-top: 12px; }
.b-row.compact .b-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.b-grid .field { margin-bottom: 12px; }
.b-grid .field.wide { grid-column: 1 / -1; }
.b-grid .check { margin-top: 26px; }
.b-more { margin-top: 2px; }
.b-more > summary { cursor: pointer; color: var(--mist); font-size: 13px; padding: 4px 0; }
.builder-add { align-self: flex-start; }
.builder-json { margin-top: 8px; }

/* ---------- CodeMirror theme ---------- */
/* CodeMirror's own CSS loads lazily (after this file), so theme rules use .cm-s-csp to win */
.cm-s-csp.CodeMirror { height: 100%; background: var(--deep); color: #d6e4eb; font: 13px/1.6 var(--mono); }
.cm-s-csp .CodeMirror-lines { padding: 10px 0; }
.editor .cm-s-csp.CodeMirror { flex: 1; min-height: 0; height: auto; }
.config-pane .cm-s-csp.CodeMirror { height: 60vh; min-height: 420px; border: 1px solid var(--line-soft); border-radius: var(--r); }
.cm-s-csp .CodeMirror-gutters { background: var(--deep); border-right: 1px solid var(--line-soft); }
.cm-s-csp .CodeMirror-linenumber { color: #46606e; padding: 0 10px 0 6px; }
.cm-s-csp .CodeMirror-cursor { border-left: 2px solid var(--flag); }
.cm-s-csp .CodeMirror-activeline-background { background: rgba(140, 211, 242, .05); }
.cm-s-csp .CodeMirror-selected, .cm-s-csp.CodeMirror-focused .CodeMirror-selected { background: rgba(140, 211, 242, .22); }
.cm-s-csp .CodeMirror-matchingbracket { color: var(--ice) !important; outline: 1px solid var(--flag); }
.cm-s-csp .cm-comment { color: #5f7a89; font-style: italic; }
.cm-s-csp .cm-string, .cm-s-csp .cm-string-2 { color: #a6e3b8; }
.cm-s-csp .cm-number, .cm-s-csp .cm-atom { color: #f2c46b; }
.cm-s-csp .cm-keyword, .cm-s-csp .cm-tag { color: #8cd3f2; }
.cm-s-csp .cm-def, .cm-s-csp .cm-attribute, .cm-s-csp .cm-property { color: #c49cff; }
.cm-s-csp .cm-variable-2, .cm-s-csp .cm-header { color: #8cd3f2; font-weight: 600; }
.cm-s-csp .cm-searching { background: rgba(242, 184, 75, .35); }
.cm-s-csp .CodeMirror-dialog { background: var(--lake-3); color: var(--ice); border-color: var(--line) !important; padding: 8px 12px; font: 13px var(--font); }
.cm-s-csp .CodeMirror-dialog .CodeMirror-search-hint { display: none; }
.cm-s-csp.dialog-opened .CodeMirror-lines { padding-top: 54px; }
.cm-s-csp .CodeMirror-dialog input { background: var(--deep); color: var(--ice); border: 1px solid var(--line); border-radius: 6px; height: 28px; width: 18em; padding: 0 8px; font: 13px var(--mono); }
.cm-s-csp .CodeMirror-dialog button { background: var(--lake-2); color: var(--ice); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font: 12px var(--font); cursor: pointer; }

@media (max-width: 980px) {
  .configs { grid-template-columns: 1fr; }
  .config-list { position: static; flex-direction: row; overflow-x: auto; }
  .config-item { flex: none; }
}
@media (max-width: 820px) {
  .field-grid, .b-grid, .b-row.compact .b-grid { grid-template-columns: 1fr; }
  .fm-search { width: 100%; }
  .spark { display: none; }
}

/* ---------- migration console ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: 1180px; }
.step { counter-increment: step; position: relative; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; padding: 28px 0 28px 52px; border-top: 1px solid var(--line-soft); }
.step::before { content: counter(step); position: absolute; left: 0; top: 26px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13.5px; background: var(--lake-3); color: var(--mist); border: 1px solid var(--line); }
.step.current::before { background: var(--flag-dim); color: var(--flag); border-color: var(--flag); }
.step.done::before { content: "✓"; background: var(--flag); color: var(--flag-ink); border-color: var(--flag); }
.step-head p { color: var(--mist); font-size: 14px; margin-top: 6px; }
.step-body { min-width: 0; }
.issues { margin: 4px 0 12px; }
.issues summary { cursor: pointer; padding: 8px 0; }
.issues ul { margin: 6px 0 0; padding: 0; list-style: none; max-height: 340px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--r); }
.issues li { padding: 8px 12px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.issues li:first-child { border-top: 0; }
.issues li.err { color: #ffc2cc; }
.issues li.warn { color: #f6d899; }
.issues li.info { color: var(--mist); }
.pill.amber { background: rgba(242, 184, 75, .14); color: var(--amber); }
.text-red { color: var(--star-soft); }
.plain-steps { margin: 0 0 12px; padding-left: 18px; }
.plain-steps li { margin-bottom: 10px; }
.status[data-state="moving"], .status[data-state="importing"] { color: var(--amber); }
.status[data-state="moving"] .star, .status[data-state="importing"] .star { animation: spin 2.4s linear infinite; }
.status[data-state="legacy"] { color: var(--mist); }
.step.wide { grid-template-columns: 1fr; gap: 16px; }
.step.wide .step-head p { max-width: 860px; }
.mig-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mig-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.mig-counts .pill { cursor: pointer; border: 1px solid transparent; font: inherit; font-size: 12px; }
.mig-counts .pill b { font-weight: 650; margin-left: 4px; }
.mig-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.mig-filters input { width: 280px; }
.mig-filters select { width: auto; }
.mig-table td { vertical-align: top; }
.mig-state { min-width: 220px; }
.mig-err { color: var(--star-soft); max-width: 420px; margin-top: 5px; line-height: 1.45; }
.mig-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: flex-end; }
.mig-actions [data-mig-selected] { margin-right: auto; }
dialog.logview { width: min(900px, calc(100vw - 32px)); }
dialog.logview pre { max-height: 60vh; overflow: auto; font-size: 12px; white-space: pre-wrap; }
@media (max-width: 980px) { .step { grid-template-columns: 1fr; gap: 14px; } .mig-filters input { width: 100%; } }

/* ---- backups ---- */
.bk-now .choice-grid { margin-bottom: 14px; }
.bk-now-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.bk-table td { vertical-align: middle; }
.bk-when b { display: block; font-weight: 550; }
.bk-when small { color: var(--mist); }
.bk-note { color: var(--mist); font-size: 13px; margin-top: 2px; max-width: 360px; }
.bk-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.bk-keep[aria-pressed="true"] { color: var(--flag); }
.bk-keep svg { width: 15px; height: 15px; }
.notice.danger { border-color: rgba(228, 0, 43, .45); background: var(--star-dim); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; vertical-align: -1px; margin-right: 4px; }
.choice-grid.one { grid-template-columns: 1fr; }
dialog[data-bk-restore] { width: min(600px, calc(100vw - 32px)); }
dialog[data-bk-restore] .choice-grid { margin: 14px 0; }
[data-bk-show][hidden] { display: none !important; }
input[type=time] { color-scheme: dark; }
.bk-table td.num { white-space: nowrap; }

/* ---------------------------------------------------------------- MySQL databases */
.dbcard { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--lake-2); padding: 18px 20px; }
.dbcard + .dbcard { margin-top: 14px; }
.dbcard .kv dd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dbcard .secret { font-family: var(--mono); font-size: 13.5px; letter-spacing: .02em; }
.prefixed { display: flex; align-items: stretch; }
.prefixed > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--lake-3); color: var(--mist); font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.prefixed > input { border-radius: 0 var(--r) var(--r) 0; min-width: 0; }
.danger-text { color: var(--star-soft); }
.table .pill { white-space: nowrap; }
