/* Zi-Host design tokens, mirrored from zi-host.ch (dark-only identity). */
:root {
  --void: #0a0c12;
  --abyss: #0d1017;
  --surface: #11141d;
  --elevated: #171b26;
  --edge: #222736;
  --edge-soft: #181c27;
  --mist-100: #eef0f6;
  --mist-300: #b9bfcd;
  --mist-400: #8e95a6;
  --mist-500: #6f7688;
  --mist-600: #545a6a;
  --ice-300: #c1a8f9;
  --ice-400: #a888f5;
  --ice-500: #8b5cf0;
  --ice-glow: rgba(139, 92, 240, .2);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --danger: #f87171;
  --danger-strong: #ef4444;
  --danger-soft: rgba(248, 113, 113, .12);
  --on-accent: #ffffff;
  --backdrop: rgba(5, 6, 10, .72);
  --shadow-lift: 0 8px 28px rgba(0, 0, 0, .28);
  --shadow-panel: 0 4px 10px rgba(0, 0, 0, .16);
  --radius-card: 1rem;
  --radius-control: .5rem;
  --font-sans: Inter, "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--mist-100);
  font: 400 .9375rem/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ice-500); color: var(--on-accent); }
[hidden] { display: none !important; }

h1, h2, p { margin: 0; }
.heading { font-weight: 600; letter-spacing: -.011em; color: var(--mist-100); text-wrap: balance; }
h1.heading { font-size: 1.5rem; }
h2.heading { font-size: 1.25rem; }
.eyebrow { color: var(--ice-400); font-size: .8125rem; font-weight: 500; }
.muted { color: var(--mist-400); }
.lead { max-width: 65ch; line-height: 1.625; }
.small { font-size: .8125rem; }
.titles { display: flex; flex-direction: column; gap: .4rem; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .625rem; color: var(--mist-100); text-decoration: none; font-weight: 600; font-size: 1.125rem; letter-spacing: -.011em; }
.brand .logo { width: 2.75rem; height: 2.25rem; object-fit: contain; }
.brand .dash { color: var(--ice-400); }
.panel-tag { font-family: var(--font-mono); font-size: .6875rem; color: var(--mist-400); border: 1px solid var(--edge); background: var(--abyss); border-radius: 999px; padding: .125rem .55rem; }

/* Controls */
button, input, select, textarea { font: inherit; color: inherit; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--edge);
  background: var(--elevated);
  color: var(--mist-300);
  padding: .5625rem 1rem;
  font-size: .875rem; font-weight: 600; line-height: 1.25rem;
  white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover:not(:disabled) { background: var(--edge); color: var(--mist-100); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--ice-500); border-color: transparent; color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
button.primary:hover:not(:disabled) { background: var(--ice-400); color: var(--on-accent); }
button.danger { background: var(--danger-soft); border-color: rgba(248, 113, 113, .35); color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-strong); border-color: transparent; color: var(--on-accent); }
button.small { padding: .375rem .75rem; font-size: .8125rem; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ice-400); outline-offset: 2px; }

input, select, textarea {
  width: 100%;
  border-radius: var(--radius-control);
  border: 1px solid var(--edge);
  background: var(--abyss);
  color: var(--mist-100);
  padding: .625rem .875rem;
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--mist-600); }
input:focus, select:focus, textarea:focus { border-color: var(--ice-500); outline: none; box-shadow: 0 0 0 3px var(--ice-glow); }
textarea { resize: vertical; font-family: var(--font-mono); font-size: .8125rem; }
select[size] { padding: .25rem; }
select[size] option { padding: .375rem .5rem; border-radius: .375rem; }
input[type="checkbox"] { accent-color: var(--ice-500); width: 1rem; height: 1rem; }

label { display: flex; flex-direction: column; gap: .375rem; font-size: .8125rem; font-weight: 500; color: var(--mist-300); }
label.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 400; color: var(--mist-100); }
label.check input { width: auto; }

.form-error { color: var(--danger); font-size: .8125rem; min-height: 1.2em; white-space: pre-line; }
.form-error:empty { min-height: 0; }
.setup-command {
  margin: .5rem 0; padding: .6rem .75rem; background: var(--abyss); color: var(--mist-100); border: 1px solid var(--edge);
  border-radius: 6px; font-size: .75rem; white-space: pre-wrap; word-break: break-all; user-select: all;
}

/* Login */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 16px;
  background: linear-gradient(180deg, var(--abyss) 0, var(--void) 22rem);
}
.card { border-radius: var(--radius-card); border: 1px solid var(--edge); background: var(--surface); }
.login-card { width: 100%; max-width: 25rem; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.75rem; box-shadow: var(--shadow-lift); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 2.75rem; }
.password-toggle {
  position: absolute; top: 50%; right: .25rem; transform: translateY(-50%);
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: var(--radius-control); background: transparent; color: var(--mist-400);
}
.password-toggle:hover:not(:disabled) { color: var(--mist-100); background: var(--elevated); }
.password-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ice-glow); color: var(--mist-100); }
.password-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* App shell */
#app-view { min-height: 100vh; background: linear-gradient(180deg, var(--abyss) 0, var(--void) 22rem); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap;
  min-height: 3.75rem; padding: 0 max(16px, calc((100vw - 78rem) / 2 + 1.5rem));
  background: rgba(10, 12, 18, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--edge);
}
.topbar .brand { margin-right: -.75rem; }
.tabs { display: flex; gap: .25rem; flex: 1; align-self: stretch; }
.tabs button {
  position: relative; background: transparent; border: none; border-radius: 0;
  color: var(--mist-400); font-weight: 500; padding: 0 .75rem; min-height: 3.75rem;
}
.tabs button::after { content: ""; position: absolute; left: .75rem; right: .75rem; bottom: 0; height: 2px; border-radius: 999px; background: transparent; transition: background-color .15s; }
.tabs button:hover:not(:disabled) { background: transparent; color: var(--mist-100); }
.tabs button[aria-selected="true"] { color: var(--mist-100); }
.tabs button[aria-selected="true"]::after { background: var(--ice-500); }
.user { display: flex; align-items: center; gap: .75rem; color: var(--mist-400); font-size: .8125rem; font-family: var(--font-mono); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; background: var(--ice-500); color: var(--on-accent); border-radius: 999px; padding: 0 .4rem; font-size: .6875rem; font-weight: 600; font-family: var(--font-sans); }

.content { padding: 2.5rem max(16px, calc((100vw - 78rem) / 2 + 1.5rem)) 4rem; }
.tab { display: flex; flex-direction: column; gap: 1.25rem; }
.toolbar { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.toolbar .titles { flex: 1; min-width: 14rem; }
.tab .toolbar + .table-wrap + .toolbar, .tab .table-wrap + .toolbar { margin-top: 1.75rem; }
.toolbar input[type="search"] { max-width: 16rem; }
.toolbar select { max-width: 12rem; }

/* Tables (zi-host "panel" + "table-zi") */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius-card); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
th { text-align: left; color: var(--mist-500); background: var(--abyss); border-bottom: 1px solid var(--edge); white-space: nowrap; padding: .75rem 1.25rem; font-size: .75rem; font-weight: 600; }
td { border-bottom: 1px solid var(--edge-soft); color: var(--mist-300); vertical-align: middle; padding: .875rem 1.25rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
td:first-child { font-family: var(--font-mono); color: var(--mist-400); }
td:nth-child(2) { color: var(--mist-100); font-weight: 500; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--elevated); }
tbody tr:last-child td { border-bottom: none; }
th.actions { text-align: right; }
/* Buttons column pinned to the right edge of a table wider than the screen:
   always within reach, no horizontal scrolling to get to it. */
td.actions { text-align: right; position: sticky; right: 0; z-index: 1; background: var(--surface);
  box-shadow: -12px 0 12px -12px rgba(0, 0, 0, .55); }
td.actions > * + * { margin-left: .375rem; }
table:has(td.actions) th:last-child { position: sticky; right: 0; z-index: 2; background: var(--abyss);
  box-shadow: -12px 0 12px -12px rgba(0, 0, 0, .55); }
tbody tr:hover td.actions, .file-row:hover td.actions, .click-row:hover td.actions { background: var(--elevated); }
td.empty { text-align: center; color: var(--mist-500); padding: 2.5rem 1.25rem; font-family: var(--font-sans); }

/* Live data */
.live { display: inline-flex; align-items: center; gap: .35rem; margin-left: .6rem; color: var(--mist-500); font-size: .75rem; font-weight: 500; }
.live::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); animation: live-pulse 2s infinite; }
.live.stale::before { background: var(--warn); animation: none; }
.live.stale { color: var(--warn); }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .45); } 70% { box-shadow: 0 0 0 .4rem rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.node-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.node-card { display: flex; flex-direction: column; gap: .5rem; padding: .875rem 1rem; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius-card); min-width: 0; }
.node-card .node-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.node-card .node-name { font-family: var(--font-mono); font-weight: 500; color: var(--mist-100); }
.node-card .node-row { display: grid; grid-template-columns: 4.5rem 1fr auto; align-items: center; gap: .5rem; font-size: .75rem; color: var(--mist-400); font-variant-numeric: tabular-nums; }
.node-card .bar { height: .3rem; background: var(--edge); border-radius: 999px; overflow: hidden; }
.node-card .bar > i { display: block; height: 100%; background: var(--ice-500); border-radius: 999px; transition: width .6s ease; }
.node-card .bar > i.hot { background: var(--warn); }
.meter > i { transition: width .6s ease; }
.rate { font-family: var(--font-mono); font-size: .75rem; color: var(--mist-400); white-space: nowrap; }
.sub { display: block; font-size: .7rem; color: var(--mist-500); margin-top: .15rem; }

.banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .875rem 1.125rem; border-radius: var(--radius-card); border: 1px solid rgba(251, 191, 36, .35); background: var(--warn-soft); color: var(--mist-100); font-size: .875rem; }
.banner p { flex: 1; min-width: 16rem; margin: 0; }
.banner .mono { color: var(--warn); }

.presence { font-family: var(--font-mono); font-size: .75rem; white-space: nowrap; }
.presence.yes { color: var(--ok); }
.presence.no { color: var(--mist-600); }
.presence .store { color: var(--mist-500); margin-left: .3rem; }

.api-doc { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem; }
.api-doc pre, .key-box { margin: 0; padding: .875rem 1rem; background: var(--abyss); border: 1px solid var(--edge); border-radius: var(--radius-control); font-size: .8125rem; color: var(--mist-300); white-space: pre-wrap; word-break: break-all; }
.key-box { color: var(--ice-300); user-select: all; }

/* Container page */
.subtabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--edge); }
.subtabs button { background: transparent; border: none; border-radius: 0; color: var(--mist-400); font-weight: 500;
  padding: .6rem .9rem; position: relative; }
.subtabs button[aria-selected="true"] { color: var(--mist-100); }
.subtabs button[aria-selected="true"]::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -1px; height: 2px; background: var(--ice-500); border-radius: 999px; }
.pane { display: flex; flex-direction: column; gap: .75rem; }
/* "#ct/<node>/<vmid>/db": the databases alone, on a page of their own. */
.db-page-open { align-self: flex-end; }
#tab-ct:not(.db-page) [data-action=db-back], #tab-ct.db-page [data-action=ct-back],
#tab-ct.db-page .subtabs, #tab-ct.db-page [data-action=db-page] { display: none; }
/* The server's tab: its databases and their access; tables and SQL on the page of their own. */
#tab-ct:not(.db-page) .db-manager { display: none; }
/* …and the databases' page has the tree instead of the list and connection cards. */
#tab-ct.db-page [data-field=dbListCard], #tab-ct.db-page .db-connection { display: none; }
.ct-actions { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
/* Server and container controls, one above the other: label, state and
   buttons line up in columns and never push the page wider. */
.power-stack { display: grid; grid-template-columns: auto minmax(0, auto) auto; gap: .375rem 0; min-width: 0; max-width: 100%; }
.power-group { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: center; column-gap: .75rem;
  padding: .35rem .5rem .35rem .75rem; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--surface); }
.power-group[hidden] { display: none; }
.power-status { min-width: 0; }
.power-group .ct-actions { justify-content: flex-end; }
.power-label { font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mist-400); }
@media (max-width: 640px) {
  .power-stack { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .power-group { display: flex; flex-wrap: wrap; }
}
.console-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.console-head p { flex: 1; min-width: 14rem; margin: 0; }
.console-frame { width: 100%; height: min(70vh, 44rem); border: 1px solid var(--edge); border-radius: var(--radius-card); background: var(--void); }
.button-link, .button-like { display: inline-flex; align-items: center; gap: .5rem; border-radius: var(--radius-control); border: 1px solid var(--edge);
  background: var(--elevated); color: var(--mist-300); padding: .5625rem 1rem; font-size: .875rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.button-link:hover, .button-like:hover { background: var(--edge); color: var(--mist-100); }
.button-like { flex-direction: row; }
.files-bar { align-items: center; }
.crumbs { flex: 1; min-width: 12rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; color: var(--mist-400); font-size: .8125rem; }
.crumbs button { background: transparent; border: none; padding: .15rem .35rem; color: var(--ice-300); font-family: var(--font-mono); font-weight: 500; }
.file-name { background: transparent; border: none; padding: 0; color: var(--mist-100); font-weight: 500; text-align: left; }
.file-name:hover { color: var(--ice-300); background: transparent; }
.file-icon { display: inline-block; width: 1.2rem; color: var(--mist-500); }
.file-name.is-dir { color: var(--ice-300); }
.files-table th.check, .files-table td.check, .select-table th.check, .select-table td.check { width: 2.75rem; padding-right: 0; cursor: default; }
.files-table input[type=checkbox], .select-table input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--ice-500); cursor: pointer; vertical-align: middle; }
.file-row, .click-row { cursor: pointer; }
.file-row:hover td, .click-row:hover td { background: var(--elevated); }
.file-row.selected td, .click-row.selected td { background: var(--ice-glow); }
/* The pinned buttons cell must stay opaque: the translucent tint goes on top of the card colour. */
.file-row.selected td.actions, .click-row.selected td.actions { background: linear-gradient(var(--ice-glow), var(--ice-glow)), var(--surface); }
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .75rem; padding: .5rem .75rem;
  border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--elevated); color: var(--mist-100); font-size: .8125rem; }
.selection-bar span { margin-right: auto; font-weight: 600; }
.settings-card { padding: 1.25rem; display: grid; gap: 1rem; }
.tfa-codes { margin: 0; padding: .75rem; background: var(--edge); border-radius: .5rem; font-size: .95rem; line-height: 1.6; white-space: pre-wrap; user-select: all; }
.fw-nodes { display: grid; gap: .75rem; }
.fw-node p { margin: .15rem 0; }
.admins-nodes { margin: 0; padding-left: 1.1rem; font-size: .8rem; }
.admins-acl-form { margin-top: .75rem; }
.admins-privs { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; max-height: 55vh; overflow-y: auto; }
.admins-privs fieldset { display: flex; flex-direction: column; gap: .15rem; }
.sharing-nodes { display: grid; gap: 1rem; margin-top: 1rem; }
.sharing-node .node-row { grid-template-columns: 7.5rem 1fr auto; }
.sharing-node .table-wrap { margin-top: .5rem; }
.sharing-warnings { margin: 0; padding-left: 1.1rem; color: var(--warn); font-size: .8rem; }
.warn-text { color: var(--warn); }
.strong { font-weight: 600; }  /* an important security event, a recommendation */
.stress-result { border-top: 1px solid var(--edge); margin-top: 0.6rem; padding-top: 0.6rem; }
.routed-choices { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.vps-disk-list { display: grid; gap: .5rem; }
.vps-disk-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.vps-disk-row input[type=number] { width: 7rem; }
.settings-card .heading .badge { margin-left: .5rem; vertical-align: middle; }
.version-var input { border-color: var(--ice-500); }
dialog.wide { width: min(70rem, calc(100vw - 32px)); }
.editor { min-height: 60vh; font-size: .8125rem; line-height: 1.5; white-space: pre; overflow: auto; }
.info-card { padding: 1.25rem; }
.info-grid { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 0; }
.info-grid dt { color: var(--mist-400); font-size: .8125rem; }
.info-grid dd { margin: 0; color: var(--mist-100); font-family: var(--font-mono); font-size: .8125rem; word-break: break-all; }
.ct-link { background: transparent; border: none; padding: 0; color: var(--ice-300); font-weight: 600;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.ct-link:hover { color: var(--ice-400); background: transparent; text-decoration-style: solid; }

/* Status pills */
.status {
  display: inline-flex; align-items: center; gap: .375rem;
  border: 1px solid var(--edge); border-radius: 999px; padding: .1875rem .625rem;
  font-size: .6875rem; font-weight: 600; letter-spacing: .01em; color: var(--mist-400);
}
.status::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--mist-500); }
.status.running { color: var(--ok); background: var(--ok-soft); border-color: rgba(52, 211, 153, .3); }
.status.running::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.status.stopped { color: var(--mist-400); }
.status.error { color: var(--danger); background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); }
.status.error::before { background: var(--danger); }
.status.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(251, 191, 36, .3); }
.status.warn::before { background: var(--warn); }

.meter { display: inline-block; width: 4.5rem; height: .3rem; background: var(--edge); border-radius: 999px; vertical-align: middle; margin-right: .5rem; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--ice-500); border-radius: 999px; }

/* Dialogs */
dialog {
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--mist-100);
  padding: 0;
  width: min(45rem, calc(100vw - 32px));
  /* Always centred in the window, never taller than it: the content scrolls. */
  margin: auto;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
}
/* A narrow form makes a narrow dialog (otherwise the form sat on the left of
   a wide, half-empty box). */
dialog:has(> .dialog-form.narrow) { width: min(28rem, calc(100vw - 32px)); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.dialog-form { padding: 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; }
.dialog-form > h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.011em; }
.dialog-form > h2 span { color: var(--ice-300); font-family: var(--font-mono); font-size: 1rem; font-weight: 500; }
.dialog-form.narrow { max-width: none; }
.dialog-form strong { color: var(--ice-300); font-family: var(--font-mono); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid .span2 { grid-column: span 2; }
.row-actions { display: flex; justify-content: flex-end; gap: .5rem; padding-top: 1.25rem; border-top: 1px solid var(--edge); }

/* Egg builder */
.mono { font-family: var(--font-mono); }
h3.heading { font-size: 1.125rem; margin: 0; }
.egg-import { display: flex; flex-direction: column; gap: 1rem; }
.egg-head { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.25rem; background: var(--abyss); border: 1px solid var(--edge); border-radius: var(--radius-control); margin-bottom: 1.25rem; }
.egg-head .mono { color: var(--mist-400); word-break: break-all; }
.egg-vars { border: 1px solid var(--edge); border-radius: var(--radius-control); padding: 1rem; margin: 1.25rem 0; min-width: 0; }
.egg-vars legend { padding: 0 .4rem; color: var(--mist-300); font-size: .8125rem; font-weight: 600; }
.hint { color: var(--mist-500); font-weight: 400; font-size: .75rem; margin: 0; }
.build-node { margin: 0; padding: .6rem .875rem; border: 1px dashed var(--edge); border-radius: var(--radius-control); color: var(--mist-300); font-size: .8125rem; }
.build-node strong { color: var(--ice-300); font-family: var(--font-mono); }
input[type="file"] { padding: .5rem; }
input[type="file"]::file-selector-button { font: inherit; font-size: .8125rem; font-weight: 600; color: var(--mist-100); background: var(--elevated); border: 1px solid var(--edge); border-radius: .375rem; padding: .3rem .75rem; margin-right: .75rem; cursor: pointer; }
#dlg-egg { width: min(52rem, calc(100vw - 32px)); }

/* Tasks */
.task-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .625rem; }
.task-list li { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius-card); padding: 1rem 1.25rem; color: var(--mist-300); }
.task-list li.muted { color: var(--mist-500); text-align: center; padding: 2.5rem 1.25rem; }
.task-list .task-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .875rem; }
.task-list pre { margin: .75rem 0 0; padding: .75rem; background: var(--abyss); border: 1px solid var(--edge-soft); border-radius: var(--radius-control); font: .75rem/1.5 var(--font-mono); white-space: pre-wrap; color: var(--mist-400); max-height: 15rem; overflow: auto; }
.task-state { font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .125rem .6rem; border: 1px solid transparent; }
.task-state.running { color: var(--warn); background: var(--warn-soft); }
.task-state.ok { color: var(--ok); background: var(--ok-soft); }
.task-state.error { color: var(--danger); background: var(--danger-soft); }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: .5rem; z-index: 50; max-width: min(24rem, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: .6rem; background: var(--elevated); border: 1px solid var(--edge); border-radius: var(--radius-control); padding: .7rem 1rem; color: var(--mist-100); font-size: .875rem; box-shadow: var(--shadow-lift); }
.toast::before { content: ""; flex: none; width: .45rem; height: .45rem; border-radius: 50%; background: var(--ice-400); }
.toast.ok::before { background: var(--ok); }
.toast.error::before { background: var(--danger); }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .grid .span2 { grid-column: span 1; }
  /* Header: brand and account on one line, the tabs below, wrapping onto
     several lines (no sideways scrolling, no scrollbar). */
  .topbar { padding-top: .5rem; gap: .5rem 1rem; position: static; }
  .panel-tag { display: none; }
  .tabs { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 0 .125rem; margin: 0 -.5rem; }
  .tabs button { min-height: 2.5rem; padding: 0 .6rem; }
  .tabs button::after { left: .6rem; right: .6rem; }
  .user { margin-left: auto; gap: .5rem; }
  .user #user-name { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user .lang-select { max-width: 8.5rem; }
  .content { padding-top: 1.25rem; padding-bottom: 3rem; }
  .tab { gap: 1rem; }
  .toolbar input[type="search"], .toolbar select { max-width: none; }
  .toolbar .titles { min-width: 100%; }
  /* Container page: its tabs wrap too; buttons big enough for a finger. */
  .subtabs { flex-wrap: wrap; gap: 0; }
  .subtabs button { padding: .55rem .65rem; }
  button, .button-link, .button-like { min-height: 2.5rem; }
  .chip button, button.chip { min-height: 0; }
  /* iOS zooms into any field under 16 px: they stay at 16 px. */
  input, select, textarea { font-size: 16px; }
  .info-grid { grid-template-columns: 1fr; gap: .15rem; }
  .info-grid dd { margin-bottom: .55rem; }
  .settings-card, .info-card { padding: 1rem; }
  .console-frame { height: 65vh; }
  .row-actions { flex-wrap: wrap; }
  /* Dialogs: the whole screen width, their content scrolls inside. */
  dialog, dialog.wide, dialog:has(> .dialog-form.narrow), #dlg-egg, #dlg-bench { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dialog-form { padding: 1.1rem; gap: 1rem; }
  .toasts { left: 8px; right: 8px; bottom: 8px; max-width: none; }
}
/* Scrollbars in the panel's colours (a white bar on a dark page otherwise). */
html, .table-wrap, .menu, dialog, pre, textarea { scrollbar-color: var(--edge) transparent; scrollbar-width: thin; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.upload-progress { display: grid; gap: .35rem; margin: 0 0 .75rem; font-size: .8125rem; color: var(--mist-300); }
.upload-progress progress { width: 100%; height: .5rem; accent-color: var(--ice-500); }
.sftp-grid dd { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.java-card { margin-bottom: 1rem; }
.java-card .heading { margin: 0; font-size: 1rem; }
.java-card select { min-width: 12rem; }
.missing-var input { border-color: var(--danger); }
.missing-var input::placeholder { color: var(--danger); }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: .75rem; margin-bottom: 2rem; }
/* A card is a <button>: undo the button's centred, single-line layout. */
.game-card { display: grid; grid-template-rows: auto 1fr auto; justify-content: stretch; justify-items: start;
  align-items: start; gap: .3rem; min-width: 0; text-align: left; white-space: normal; padding: .9rem 1rem;
  border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--surface);
  color: var(--mist-100); cursor: pointer; font-weight: 400; }
.game-card:hover:not(:disabled) { border-color: var(--ice-500); background: var(--elevated); }
.game-card > span { max-width: 100%; overflow-wrap: anywhere; }
.game-name { font-weight: 700; font-size: .95rem; color: var(--mist-100); }
.game-card > .game-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; width: 100%; }
.game-built { flex: none; padding: .1rem .45rem; border-radius: 999px; font-size: .6875rem; font-weight: 600; white-space: nowrap;
  color: var(--ok); background: var(--ok-soft); border: 1px solid rgba(52, 211, 153, .3); }
.game-built.no { color: var(--mist-500); background: transparent; border-color: var(--edge); }
.game-card.built { border-color: rgba(52, 211, 153, .35); }
.game-desc { color: var(--mist-400); font-size: .8125rem; line-height: 1.35; }
.game-size { margin-top: .35rem; color: var(--mist-500); font-size: .75rem; font-variant-numeric: tabular-nums; }
.egg-notes { margin: .25rem 0 0; padding: .6rem .75rem; border-left: 3px solid var(--warn); background: var(--warn-soft);
  color: var(--mist-100); font-size: .8125rem; border-radius: 4px; }
.agent-actions { margin-top: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }

/* Database manager (container page) */
.db-connection, .db-list { margin-bottom: 1rem; }
.db-add { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.db-add label { flex: 1 1 16rem; }
.db-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.db-head .heading { margin: 0; font-size: 1rem; }
.db-connection .info-grid dd { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.db-connection .row-actions { flex-wrap: wrap; }
.db-strings summary { cursor: pointer; color: var(--mist-300); font-size: .8125rem; margin-bottom: .75rem; }
.db-manager { display: grid; grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.db-tables { padding: .75rem; display: grid; gap: .25rem; max-height: 70vh; overflow: auto; }
.db-tables nav { display: grid; gap: .125rem; }
.db-tables-head { display: flex; align-items: center; justify-content: space-between; padding: 0 .25rem .25rem; }
.db-table-item { display: flex; justify-content: space-between; gap: .5rem; width: 100%; text-align: left; padding: .45rem .6rem;
  border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--mist-300);
  font-weight: 400; font-size: .8125rem; cursor: pointer; min-width: 0; }
.db-table-item .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-table-item:hover { background: var(--elevated); color: var(--mist-100); }
.db-table-item.active { border-color: var(--ice-500); background: var(--ice-glow); color: var(--mist-100); }
.db-sql-item { font-weight: 600; color: var(--ice-300); margin-bottom: .25rem; border-bottom-color: var(--edge); }
/* One column never wider than the page: a wide table scrolls in its own frame. */
.db-view { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.db-data { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.db-pager select { width: auto; }
.db-tree-name { display: block; width: 100%; text-align: left; justify-content: flex-start; background: transparent; border: 0;
  padding: .4rem .5rem; font-weight: 600; color: var(--mist-300); min-height: 0; overflow: hidden; text-overflow: ellipsis; }
.db-tree-name::before { content: "▸ "; color: var(--mist-500); }
.db-tree-name.open { color: var(--mist-100); }
.db-tree-name.open::before { content: "▾ "; }
.db-tree-db { display: grid; gap: .125rem; }
.db-tree-db > .db-table-item { margin-left: .75rem; width: calc(100% - .75rem); }
.db-tree-group { font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mist-500);
  padding: .5rem .5rem .15rem 1.35rem; }
.db-structure { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.db-subtitle { margin: .5rem 0 0; font-size: .875rem; }
.db-index-add { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; margin-top: .5rem; }
.db-index-columns { border: 1px solid var(--edge); border-radius: var(--radius-control); padding: .35rem .6rem; margin: 0; }
.db-index-columns div { display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.db-create pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; margin: .5rem 0 0; }
.db-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.db-toolbar .heading { margin: 0 auto 0 0; font-size: 1rem; }
.db-grid td, .db-grid th { white-space: nowrap; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
.db-grid th.db-col { cursor: pointer; user-select: none; }
.db-grid th.db-col:hover { color: var(--mist-100); }
.db-null { color: var(--mist-600); font-style: italic; font-size: .75rem; }
.db-pager { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.db-pager span { margin-right: auto; font-variant-numeric: tabular-nums; }
.db-sql { min-height: 8rem; }
.db-result { display: grid; gap: .35rem; margin-top: .75rem; }
.db-row-fields textarea { width: 100%; }
.db-null-toggle { display: inline-flex; align-items: center; gap: .3rem; }
.ok-text { color: var(--ok); }
@media (max-width: 720px) {
  .db-manager { grid-template-columns: 1fr; }
  .db-tables { max-height: 14rem; }
}
.edit-db { border: 1px solid var(--edge); border-radius: var(--radius-control); padding: .75rem 1rem; margin: 0; display: grid; gap: .5rem; }
.edit-db legend { padding: 0 .35rem; color: var(--mist-300); font-size: .8125rem; font-weight: 600; }
.edit-db p { margin: 0; }

/* Client area */
.link-button { background: none; border: none; padding: 0; color: var(--ice-300); font-weight: 500; justify-self: center; }
.link-button:hover:not(:disabled) { background: none; color: var(--ice-400); text-decoration: underline; }
.legal-links { text-align: center; margin: 0; }
.legal-links a { color: var(--mist-300); }
.form-ok { color: var(--ok); font-size: .8125rem; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .25rem; margin: 0 .35rem .25rem 0; padding: .1rem .2rem .1rem .55rem;
  border: 1px solid var(--edge); border-radius: 999px; font-size: .75rem; background: var(--elevated); }
.chip button.small { padding: 0 .4rem; line-height: 1.1rem; }
.chip .link-button { padding: 0; font-size: inherit; }
.chip-plain { padding-right: .55rem; }
/* A node lacking the ISO or template. */
.chip-missing { border-style: dashed; color: var(--mist-300, inherit); background: transparent; }
/* A server shared with the client (a subuser), not its own: opens its users tab. */
button.chip-shared { border-style: dashed; color: var(--mist-300, inherit); padding-right: .55rem; cursor: pointer; font: inherit; font-size: .75rem; }
button.chip-shared:hover { border-color: var(--ice-500); }
#tab-account .settings-card { margin-bottom: 1rem; }
#tab-account .heading { margin: 0; font-size: 1rem; }
.catalog { margin-bottom: 2rem; }
.catalog .game-grid { margin-bottom: 1.25rem; }
.catalog-group { margin: 0 0 .6rem; font-size: .9rem; font-weight: 600; color: var(--mist-300); }
.image-detail { word-break: break-all; }
.small-heading { margin: 1rem 0 .4rem; font-size: .9rem; }
.image-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.image-list li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .8125rem; }
.image-list li .mono { margin-right: auto; word-break: break-all; }

/* Statistics */
.stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.segmented { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.segmented button[aria-pressed="true"] { background: var(--ice-glow); border-color: var(--ice-500); color: var(--mist-100); }
.stats-info { display: flex; gap: 1.25rem; margin: 0; font-size: .8125rem; }
.stats-info dt { color: var(--mist-500); }
.stats-info dd { margin: 0 0 0 .35rem; color: var(--mist-100); font-variant-numeric: tabular-nums; }
.stats-info div, .stats-info { align-items: baseline; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.chart-card { padding: 1rem 1.1rem; display: grid; gap: .4rem; min-width: 0; }
.chart-title { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.chart-title .heading { margin: 0; font-size: .95rem; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--edge); stroke-width: 1; }
.chart-label { fill: var(--mist-500); font-size: 11px; font-family: var(--font-sans); }
.chart-line { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.chart-area { stroke: none; opacity: .14; }
.chart-accent .chart-line { stroke: var(--ice-400); } .chart-accent .chart-area { fill: var(--ice-400); }
.chart-ok .chart-line { stroke: var(--ok); } .chart-ok .chart-area { fill: var(--ok); }
.chart-warn .chart-line { stroke: var(--warn); } .chart-warn .chart-area { fill: var(--warn); }
.chart-legend { display: inline-flex; gap: .75rem; font-size: .75rem; color: var(--mist-400); }
.chart-key::before { content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .3rem; vertical-align: middle; }
.chart-key.chart-accent::before { background: var(--ice-400); }
.chart-key.chart-ok::before { background: var(--ok); }
.chart-key.chart-warn::before { background: var(--warn); }

/* Scheduled tasks */
.grow { flex: 1 1 auto; margin: 0; }
.sched-list { display: grid; gap: .75rem; }
.sched-card { padding: 1rem 1.1rem; display: grid; gap: .5rem; }
.sched-card.paused { opacity: .65; }
.sched-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sched-top .heading { margin: 0; font-size: .95rem; }
.sched-top p { margin: .2rem 0 0; }
.sched-command { margin: .4rem 0 0; padding: .4rem .6rem; background: var(--abyss); border: 1px solid var(--edge-soft); border-radius: var(--radius-control); font-size: .75rem; white-space: pre-wrap; word-break: break-all; }
.sched-next { text-align: right; color: var(--mist-100); }
.sched-actions { padding-top: .6rem; flex-wrap: wrap; }
.sched-history summary { cursor: pointer; font-size: .8125rem; color: var(--mist-400); }
.sched-run { margin-top: .5rem; }
.sched-run pre { max-height: 14rem; overflow: auto; margin: .3rem 0 0; }

/* Monitoring API tokens */
#token-form { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: end; }
.token-new { border: 1px solid var(--edge); border-radius: var(--radius-control); padding: .75rem; margin: .5rem 0; }
.copy-row { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.copy-row code { overflow-wrap: anywhere; min-width: 0; flex: 1; }
.token-new pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0 0; }

/* Live resources next to the console */
.console-layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1rem; align-items: start; }
.usage-panel { display: flex; flex-direction: column; gap: .875rem; padding: 1rem; border: 1px solid var(--edge);
  border-radius: var(--radius-card); background: var(--surface); }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.usage-head .heading { margin: 0; font-size: 1rem; }
.usage-list { display: flex; flex-direction: column; gap: .875rem; }
.usage-item { display: grid; grid-template-columns: 1fr auto; gap: .25rem .5rem; align-items: baseline; }
.usage-item .u-label { color: var(--mist-400); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.usage-item .u-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.usage-item .u-detail { grid-column: 1 / -1; color: var(--mist-400); font-size: .75rem; font-variant-numeric: tabular-nums; }
.usage-bar { grid-column: 1 / -1; height: .375rem; border-radius: 999px; background: var(--edge); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width .4s ease; }
.usage-bar.warn > span { background: var(--warn); }
.usage-bar.danger > span { background: var(--danger); }
.usage-bar.idle > span { background: var(--edge); }
@media (max-width: 900px) {
  .console-layout { grid-template-columns: minmax(0, 1fr); }
  .usage-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
}

/* Catalogue rebuild: the whole list on the page (no inner scrolling) */
.rebuild-list { display: flex; flex-direction: column; gap: .5rem; }
.rebuild-group { margin: .5rem 0 0; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mist-500); }
.rebuild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .5rem; }
.rebuild-item { display: flex; align-items: center; gap: .625rem; padding: .5rem .625rem; border: 1px solid var(--edge);
  border-radius: var(--radius-control); background: var(--surface); cursor: pointer; min-width: 0; }
.rebuild-item:hover { border-color: var(--ice-500); }
.rebuild-item.built { border-color: rgba(52, 211, 153, .3); }
.rebuild-item .row-icon { width: 3.5rem; height: 1.85rem; }
.rebuild-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.rebuild-name { color: var(--mist-100); font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rebuild-state { color: var(--mist-500); font-size: .75rem; }
.rebuild-state.ok { color: var(--ok); }
.image-name { display: flex; flex-direction: column; gap: .15rem; white-space: normal; }
/* The panel's storages of each node */
.storages-list { display: flex; flex-direction: column; gap: 1rem; margin: .75rem 0; }
.storage-node { display: flex; flex-direction: column; gap: .5rem; }
.storage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .625rem;
  padding: .5rem .625rem; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--surface); }
.storage-size input { width: 7rem; }
@media (max-width: 720px) { .storage-row { grid-template-columns: minmax(0, 1fr); } }
/* Pterodactyl transfer: one row per server, its choice and its target */
.ptero-list { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; }
.ptero-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 11rem) minmax(0, 16rem); align-items: center; gap: .625rem;
  padding: .5rem .625rem; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--surface); }
.ptero-item.skip { opacity: .65; }
.ptero-item select { width: 100%; min-width: 0; }
.ptero-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ptero-text .rebuild-name { white-space: normal; }
.ptero-done { color: var(--ok); }
@media (max-width: 720px) { .ptero-item { grid-template-columns: minmax(0, 1fr); } }
.image-name .row-sub { font-size: .7rem; }

/* Language selector */
.lang-select { width: auto; padding: .35rem .6rem; font-size: .8125rem; }
.login-lang { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 1rem); right: 1rem; }

/* Server lists (containers, VPS, client): one wide card per server, the
   state as the left border; never wider than the page. */
.server-list { display: flex; flex-direction: column; gap: .75rem; }
.list-head { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--mist-400); cursor: pointer; }
.list-head input, .server-row .check input { width: 1.1rem; height: 1.1rem; accent-color: var(--ice-500); cursor: pointer; }
.list-empty { padding: 2.5rem 1rem; text-align: center; color: var(--mist-500); border: 1px dashed var(--edge); border-radius: var(--radius-card); }
.server-row { --edge-color: var(--mist-500); position: relative; display: grid; align-items: center; gap: 1.25rem;
  grid-template-columns: auto minmax(13rem, 1.7fr) minmax(9rem, 1fr) minmax(0, 3fr) auto;
  min-height: 5.5rem; padding: 1.25rem 1.5rem 1.25rem 1.375rem; background: var(--surface); border: 1px solid var(--edge);
  border-left: 4px solid var(--edge-color); border-radius: var(--radius-control); cursor: pointer;
  transition: border-color .15s, background-color .15s; }
.server-row.running { --edge-color: var(--ok); }
.server-row.stopped { --edge-color: var(--danger); }
.server-row.suspended { --edge-color: var(--warn); cursor: default; opacity: .75; }
.server-row:hover, .server-row:focus-visible { border-color: var(--ice-500); border-left-color: var(--edge-color);
  background: var(--elevated); outline: none; }
.server-row.selected { background: linear-gradient(var(--ice-glow), var(--ice-glow)), var(--surface); }
.server-row .check, .server-row .row-pad { display: flex; align-items: center; width: 1.1rem; }
.row-name { display: flex; align-items: center; gap: .875rem; min-width: 0; }
.row-titles, .row-cell { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.row-icon { flex: none; display: grid; place-items: center; width: 5.25rem; height: 2.75rem; overflow: hidden;
  border-radius: var(--radius-control); background: var(--elevated); border: 1px solid var(--edge); color: var(--mist-500); }
/* Pinned to the frame: in a grid, "height: 100%" alone does not apply and a
   square logo would grow as tall as it is wide (only its middle showing). */
.row-icon { position: relative; }
.row-icon img { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; object-fit: cover; display: block; }
.row-icon img.logo { object-fit: contain; padding: .25rem; }
.row-icon-svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.row-icon-svg circle { fill: currentColor; stroke: none; }
.server-row.running .row-icon-svg { color: var(--ok); }
.row-title { color: var(--mist-100); font-weight: 600; font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--mist-400); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-label { color: var(--mist-500); font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.row-value { color: var(--mist-100); font-size: .9375rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.row-detail { color: var(--mist-500); font-size: .75rem; }
.row-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; min-width: 0; }
.row-cell .bar { display: block; width: 100%; max-width: 10rem; height: .375rem; background: var(--edge); border-radius: 999px; overflow: hidden; }
.row-cell .bar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .6s ease; }
.row-cell .bar > i.hot { background: var(--danger); }
.row-actions { display: flex; align-items: center; gap: .375rem; justify-content: flex-end; }
@media (max-width: 1000px) {
  .server-row { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: .875rem; }
  .row-address { grid-column: 2 / -1; }
  .row-stats { grid-column: 2 / -1; grid-row: 3; }
  .row-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 560px) {
  /* Phone: the name on its own line (whole, never cut), the buttons under it. */
  .row-icon { display: none; }
  .server-row { grid-template-columns: auto minmax(0, 1fr); gap: .75rem; padding: 1rem 1rem 1rem .875rem; }
  /* No checkbox (client lists): no empty column either. */
  .server-row .row-pad { display: none; }
  .server-row:has(.row-pad) { grid-template-columns: minmax(0, 1fr); }
  .row-name { grid-column: -2; grid-row: 1; }
  .row-actions { grid-column: -2; grid-row: 2; justify-content: flex-start; flex-wrap: wrap; }
  .row-address { grid-column: -2; grid-row: 3; }
  .row-stats { grid-column: -2; grid-row: 4; gap: .75rem; }
  .row-title { white-space: normal; overflow-wrap: anywhere; }
  .row-sub { white-space: normal; }
  .row-value { white-space: normal; overflow-wrap: anywhere; font-size: .875rem; }
  .row-detail { font-size: .6875rem; }
}
.power.start { color: var(--ok); border-color: rgba(52, 211, 153, .35); }
.power.stop { color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.row-menu { position: relative; display: inline-block; vertical-align: middle; }
.row-menu > summary { list-style: none; padding: .375rem .7rem; font-weight: 700; letter-spacing: .1em; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu .menu:not(.menu-pop) { display: none; }
.menu.menu-pop { position: fixed; z-index: 1000; min-width: 11rem; display: flex; flex-direction: column; padding: .375rem;
  background: var(--elevated); border: 1px solid var(--edge); border-radius: var(--radius-control); box-shadow: var(--shadow-lift); }
.menu.menu-pop button { justify-content: flex-start; border: 0; background: transparent; padding: .5rem .625rem; text-align: left; font-weight: 500; }
.menu.menu-pop button:hover { background: var(--edge); }
.menu.menu-pop button.danger { color: var(--danger); }

/* Totals under the image and template tables */
tr.total-row td { border-top: 1px solid var(--edge); background: var(--abyss); color: var(--mist-100); font-weight: 600; }
tr.total-row td:first-child { font-family: var(--font-sans); color: var(--mist-300); }
tr.total-row .sub { display: block; font-weight: 400; }
tbody tr.total-row:hover { background: var(--abyss); }
.task-error { margin: .5rem 0; padding: .5rem .75rem; border-left: 3px solid var(--danger); background: var(--danger-soft);
  color: var(--danger); font-size: .8125rem; border-radius: 4px; overflow-wrap: anywhere; }
.node-pick { display: flex; flex-direction: column; gap: .4rem; }
.node-checks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.node-checks label { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-mono); font-size: .8125rem; }
.field-label { font-size: .8125rem; color: var(--mist-300); font-weight: 500; }
/* The panel's own popups */
.ask-message { margin: 0; color: var(--mist-300); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ask-input { display: flex; flex-direction: column; gap: .4rem; }
.ask-input .copy-row input { flex: 1; min-width: 0; }
/* Images table: readable name, compact, never wider than the page */
td.image-cell { white-space: normal; font-family: var(--font-sans); min-width: 12rem; }
td.image-cell .row-title { font-family: var(--font-sans); font-size: .9375rem; }
td.image-cell .row-sub { font-family: var(--font-mono); overflow-wrap: anywhere; }
#img-rows td, #img-head th { padding-left: .875rem; padding-right: .875rem; }
#img-rows td.actions { width: 1%; }
/* No sideways scrolling: cells wrap instead of widening the table. */
#img-rows td, #img-head th, #tpl-rows td { white-space: normal; }
#img-rows .presence { white-space: normal; }
#img-rows td.actions, #tpl-rows td.actions { white-space: nowrap; }
#img-head, #img-rows { overflow-wrap: anywhere; }
/* A server's own domain name */
.domain-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.domain-form input { flex: 1 1 14rem; min-width: 0; }
.domain-form select { flex: 0 1 14rem; width: auto; min-width: 10rem; }
.subuser-form { display: flex; flex-direction: column; gap: .9rem; }
.perm-grid { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .9rem 1.25rem; }
.perm-grid legend { font-weight: 600; margin-bottom: .5rem; }
.perm-group { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.perm-group b { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mist-400); }
.perm { display: flex; flex-direction: row; gap: .5rem; align-items: flex-start; font-size: .875rem; line-height: 1.35;
  font-weight: 400; color: var(--mist-100); }
.perm input { margin-top: .15rem; flex: none; width: auto; min-height: 0; }
/* Clients tab: a client's servers (own and shared) wrap instead of running under the actions. */
td.chips { white-space: normal; min-width: 14rem; }
.perm:has(input:disabled) { opacity: .5; }
.bench-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.bench-actions label { display: flex; gap: .35rem; align-items: center; }
#dlg-bench { width: min(56rem, calc(100vw - 32px)); }
.bench-scores { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0; }
.bench-score { display: flex; flex-direction: column; min-width: 6.5rem; padding: .5rem .75rem; border: 1px solid var(--edge); border-radius: .5rem; background: var(--elevated); }
.bench-score.overall { border-color: var(--ice-500); box-shadow: 0 0 0 1px var(--ice-glow); }
.bench-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dedicated-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.dedicated-form input { width: 6rem; }
.dedicated-mac { width: 11rem; }
.domain-form .domain-port { flex: 0 1 11rem; min-width: 8rem; }
.domain-head { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.domain-card td { white-space: normal; overflow-wrap: anywhere; }
.domain-list { display: grid; gap: .75rem; margin-bottom: .75rem; }
.domain-list:empty { display: none; }
.routed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.routed-list li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.routed-list li button { margin-left: auto; }
.domain-entry { border: 1px solid var(--edge); border-radius: var(--radius-control); padding: .625rem .75rem; min-width: 0; }
.domain-entry-head { display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; }
.domain-entry-head .mono { overflow-wrap: anywhere; min-width: 0; }
.domain-entry-actions { display: flex; gap: .375rem; margin-left: auto; }
.domain-entry .table-wrap { margin-top: .5rem; }
/* Sortable table headers */
th.sortable { padding: 0; }
.sort-button { all: unset; display: block; padding: .75rem .875rem; cursor: pointer; font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; }
.sort-button:hover { color: var(--mist-100); }
.sort-button:focus-visible { outline: 2px solid var(--ice-500); outline-offset: -2px; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--mist-100); }
tr.category-row td { background: var(--abyss); color: var(--mist-300); font-size: .75rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; padding-top: .6rem; padding-bottom: .6rem; }
tr.category-row .category-count { color: var(--mist-500); text-transform: none; letter-spacing: 0; font-weight: 400; }
tbody tr.category-row:hover { background: var(--abyss); }
.node-card .disk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.node-card .disk-down { color: var(--danger, #e5534b); }
.title-row { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; min-width: 0; }
.title-row .heading { margin: 0; overflow-wrap: anywhere; }

/* Logs tab: sources by group on the left (above on phones), the chosen one on the right. */
.logs-layout { display: grid; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.logs-nav { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; min-width: 0; }
.logs-group { display: flex; flex-direction: column; gap: .2rem; }
.logs-group-title { font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mist-500); padding: 0 .6rem .2rem; }
.logs-source { text-align: left; justify-content: flex-start; background: transparent; border: 1px solid transparent; border-radius: var(--radius-control); padding: .45rem .6rem; color: var(--mist-300); font-weight: 500; min-height: 0;
  /* Buttons stay on one line elsewhere: here a long name wraps in its column. */
  flex-direction: column; align-items: flex-start; gap: .1rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.logs-source-details { font-size: .75rem; font-weight: 400; color: var(--mist-500); }
.logs-source:hover { background: var(--elevated); color: var(--mist-100); }
.logs-source.active { background: var(--elevated); border-color: var(--edge); color: var(--mist-100); box-shadow: inset 3px 0 0 var(--ice-500); }
.logs-view { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.logs-head { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start; justify-content: space-between; }
.logs-head > div:first-child { min-width: 0; flex: 1 1 14rem; }
.logs-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.logs-tools input[type="search"] { width: 11rem; }
.logs-tools select { width: auto; }
.logs-follow { white-space: nowrap; }
.logs-integrity { margin: 0; padding: .45rem .7rem; border-radius: var(--radius-control); font-size: .8125rem; border: 1px solid var(--edge); }
.logs-integrity.ok { color: var(--ok); }
.logs-integrity.broken { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.log-text { margin: 0; max-height: 65vh; overflow: auto; padding: .75rem .9rem; background: var(--abyss); border: 1px solid var(--edge); border-radius: var(--radius-control);
  font-family: var(--font-mono); font-size: .78rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line.log-error { color: var(--danger); }
.log-line.log-warn { color: var(--warn); }
.activity-table td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 12rem; max-width: 28rem; }
.activity-table td.nowrap { white-space: nowrap; }
.activity-table .sub { display: block; font-size: .72rem; color: var(--mist-500); white-space: normal; max-width: 20rem; }
@media (max-width: 860px) {
  .logs-layout { grid-template-columns: minmax(0, 1fr); }
  .logs-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: .5rem 1rem; }
  .logs-group { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .25rem; }
  .logs-group-title { flex-basis: 100%; padding-left: 0; }
  .logs-source { border-color: var(--edge); }
  .logs-tools input[type="search"] { width: 100%; flex: 1 1 100%; }
}

/* VPS console: its screen (noVNC) or its terminal. */
.switch-buttons { display: inline-flex; padding: .15rem; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--abyss); }
.switch-buttons button { border: 0; background: transparent; color: var(--mist-400); min-height: 0; padding: .35rem .8rem; }
.switch-buttons button[aria-pressed="true"] { background: var(--ice-500); color: var(--on-accent, #fff); }

/* Applications (helper-scripts): compact cards, the built ones marked. */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.app-card { display: flex; flex-direction: column; gap: .35rem; padding: .75rem .9rem; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--surface); min-width: 0; }
.app-card.built { border-color: rgba(52, 211, 153, .35); }
.app-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.app-head strong { overflow-wrap: anywhere; }
.app-card .row-actions { justify-content: flex-start; padding-top: .35rem; border-top: 0; margin-top: auto; }
#apps-filter { max-width: 18rem; }

/* QR code of a second factor (otpauth:// link): always dark on light, as scanners expect */
.qr-box { display: flex; justify-content: center; margin: .5rem 0; }
.qr-code { width: min(14rem, 100%); height: auto; border-radius: var(--radius-control); }
.qr-code .qr-light { fill: #fff; }
.qr-code .qr-dark { fill: #000; }
