/* VDS-DC77 — base styles, dark+light themes */
:root {
    color-scheme: dark light;
    --bg: #0b1020;
    --bg-grad: radial-gradient(1200px 600px at 70% -10%, #1a2447 0%, #0b1020 60%);
    --fg: #e6ecff;
    --muted: #8aa0c8;
    --accent: #6ea8ff;
    --accent-hover: #8fbcff;
    --line: rgba(138, 160, 200, 0.18);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.06);
    --field-bg: rgba(255, 255, 255, 0.04);
    --field-border: rgba(255, 255, 255, 0.10);
    --field-focus: rgba(110, 168, 255, 0.55);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.30);
    --danger: #e35a5a;
    --warn: #d99340;
    --ok: #4eb888;
    --radius: 4px;
    --sidebar-bg: #0e1428;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-w: 220px;
    --topbar-h: 48px;
}

[data-theme="light"] {
    --bg: #f5f6fa;
    --bg-grad: radial-gradient(1200px 600px at 70% -10%, #e6ecf8 0%, #f5f6fa 60%);
    --fg: #1a2238;
    --muted: #6b7894;
    --accent: #4070e0;
    --accent-hover: #2855c8;
    --line: rgba(26, 34, 56, 0.10);
    --card-bg: #ffffff;
    --card-border: rgba(26, 34, 56, 0.08);
    --field-bg: #ffffff;
    --field-border: rgba(26, 34, 56, 0.16);
    --field-focus: rgba(64, 112, 224, 0.55);
    --shadow: 0 4px 16px rgba(26, 34, 56, 0.06);
    --sidebar-bg: #f0f2f7;
    --sidebar-border: rgba(26, 34, 56, 0.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--fg);
    background: var(--bg) var(--bg-grad);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--card-bg); padding: 2px 6px; border-radius: 6px;
    border: 1px solid var(--card-border); font-size: 0.92em;
}
.muted { color: var(--muted); }

/* ============================================================================
   Splash / welcome
   ============================================================================ */
.splash { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.splash__inner { width: 100%; max-width: 880px; }
.splash__inner--narrow { max-width: 640px; }

.pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
    color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 12px rgba(92, 201, 156, 0.45); }
.pill__dot--err { background: var(--danger); box-shadow: 0 0 12px rgba(255, 107, 107, 0.4); }
.pill__dot--warn { background: var(--warn); box-shadow: 0 0 12px rgba(245, 176, 74, 0.4); }

.hero { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.15; margin: 18px 0 12px; letter-spacing: -0.01em; font-weight: 700; }
.hero__accent { color: var(--accent); }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 60ch; font-size: 15px; }
.lead--muted { font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 24px 0; }
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; }
.card__k { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.card__v { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; margin-top: 6px; font-weight: 600; }
.link { color: var(--accent); }
.footer { margin-top: 24px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; }

/* Theme toggle button (lives in topbar now, not floating) */
.theme-toggle__moon { display: none; }
.theme-toggle__sun  { display: inline-block; }
[data-theme="light"] .theme-toggle__sun  { display: none; }
[data-theme="light"] .theme-toggle__moon { display: inline-block; }

/* ============================================================================
   Auth pages (login, change-password)
   ============================================================================ */
.auth-body { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-main { width: 100%; max-width: 420px; }

/* v2.18.0: top-right cluster on the auth pages — theme + lang toggle, same
   shape as the admin topbar buttons. Fixed-position so it stays in the corner
   regardless of viewport scroll. */
.auth-corner {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 10;
}
.auth-corner__btn {
    width: 36px;
    height: 36px;
    padding: 0;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
}

/* v3.93.10: login-page brand — "VDS Manager [DC77]" reads larger and the
   DC77 mark gets a pill chip so it scans as a product badge rather than
   another word in the title. */
.auth-brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.auth-brand__logo { font-weight: 800; font-size: 26px; letter-spacing: 0.06em; color: var(--accent); }
.auth-brand__name { font-weight: 700; font-size: 26px; letter-spacing: 0.02em; }
.auth-brand__badge {
    font-weight: 700; font-size: 11px; letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    align-self: center;
}
.auth-brand__sub  { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 4px; }

.auth-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 28px 28px 24px; box-shadow: var(--shadow); }
.auth-card__title { font-size: 20px; margin: 0 0 6px; font-weight: 700; }
.auth-card__sub   { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.auth-card__hint  { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.auth-footer { color: var(--muted); font-size: 12px; margin-top: 24px; text-align: center; }

/* Forms ----------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.field__input,
.field__select,
.field__textarea {
    width: 100%; padding: 11px 12px;
    background: var(--field-bg); color: var(--fg);
    border: 1px solid var(--field-border); border-radius: 8px;
    font: inherit; font-size: 14px; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field__input:focus, .field__select:focus, .field__textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--field-focus);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 14px; border-radius: 8px; border: 1px solid var(--card-border);
    background: var(--card-bg); color: var(--fg); cursor: pointer;
    font: inherit; font-weight: 600; font-size: 14px;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn--block { display: flex; width: 100%; }
.btn--danger { color: var(--danger); border-color: rgba(255,107,107,0.4); }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--ghost { background: transparent; padding: 7px 8px; border-color: transparent; }
.btn--ghost:hover { background: var(--card-bg); border-color: var(--card-border); }

.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; border: 1px solid var(--card-border); background: var(--card-bg); margin-bottom: 14px; }
.alert--err { border-color: rgba(255, 107, 107, 0.5); color: var(--danger); }
.alert--ok  { border-color: rgba(92, 201, 156, 0.5); color: var(--ok); }
.alert--warn{ border-color: rgba(245, 176, 74, 0.5); color: var(--warn); }

/* ============================================================================
   Admin layout (sidebar + topbar + content)
   ============================================================================ */
.adm-body { background: var(--bg) var(--bg-grad); }

.adm {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.adm-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 8px 0 12px;
    position: sticky; top: 0;
    height: 100vh;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

.adm-brand {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px 12px;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    transition: background-color .15s;
}
.adm-brand:hover { text-decoration: none; background: rgba(110, 168, 255, 0.05); }
/* DC77 — punch-y badge with gradient + uppercase */
.adm-brand__logo {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; padding: 3px 8px;
    font-weight: 800; font-size: 12px; letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, #6ea8ff 0%, #4178d4 100%);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.18);
}
[data-theme="light"] .adm-brand__logo {
    background: linear-gradient(135deg, #4178d4 0%, #2c5cad 100%);
}
.adm-brand__name {
    display: flex; flex-direction: column; line-height: 1.15;
}
.adm-brand__name__primary {
    font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
    color: var(--fg);
}
.adm-brand__name__sub {
    font-size: 9px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--muted); margin-top: 2px;
}

.adm-nav { padding: 6px 0; }
.adm-nav__group-title {
    font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
    color: var(--muted); padding: 8px 14px 3px;
}
.adm-nav__list { list-style: none; padding: 0; margin: 0; }
.adm-nav__item { margin: 0 6px; }
.adm-nav__link {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px; border-radius: 4px;
    color: var(--fg); font-size: 13px;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}
.adm-nav__link:hover { background: var(--card-bg); color: var(--fg); text-decoration: none; }
.adm-nav__icon { flex: 0 0 15px; height: 15px; color: var(--muted); display: inline-flex; align-items: center; }
.adm-nav__icon svg { width: 15px; height: 15px; }
.adm-nav__label { flex: 1; }
.adm-nav__item.is-active .adm-nav__link {
    background: rgba(110, 168, 255, 0.12);
    color: var(--accent); font-weight: 600;
}
[data-theme="light"] .adm-nav__item.is-active .adm-nav__link { background: rgba(64, 112, 224, 0.08); }
.adm-nav__item.is-active .adm-nav__icon { color: var(--accent); }

.adm-main { display: flex; flex-direction: column; min-width: 0; }

.adm-topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: var(--sidebar-bg);
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 20;
}
.adm-topbar__title { font-size: 15px; font-weight: 600; margin: 0; color: var(--muted); }
/* Center cluster — meta strip (local+UTC clocks, client IP, flag, ISP). flex:1
   on this and 0 on left/right makes the strip sit horizontally centered. */
/* v3.97.10: __left is a flex row so the page title + topbar search form
   sit on one line instead of stacking (the H1 was forcing a block break). */
/* v3.97.12: __left now grows so the title + search form claim ALL the
   horizontal space the meta strip used to centre into. Meta strip moves
   to flex-end (right-aligns next to the icon cluster) instead of centred
   — operator wanted "more room for search, push timestamps right." Input
   gets a meaningful nominal width (280px) so it doesn't look like a
   chip. The whole left row still flex-wraps to nowrap to keep title +
   form on one line; the meta strip can ellipsis-truncate if a narrow
   viewport forces the issue. */
/* v3.97.26: search field re-widened — the inline input has width:36ch
   (~252px) plus the "Search" button (~70px), so the wrapper needs
   ~360px to not clip them. Wrapper max-width bumped 260→380. The input's
   flex sizing stops mattering because the inline `width` takes over. */
.adm-topbar__left   { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; }
.adm-topbar__search { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 380px; }
.adm-topbar__search input[type="text"] { flex: 0 1 auto; min-width: 80px; }
.adm-topbar__center { flex: 1 1 auto; display: flex; justify-content: flex-end; min-width: 0; padding: 0 12px; overflow: hidden; }
@media (max-width: 1500px) {
    .adm-topbar__center { display: none; }
}
.adm-topbar__right  { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.adm-topbar__meta {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11px; font-family: ui-monospace, monospace;
    color: var(--muted); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}
.adm-topbar__btn { width: 36px; height: 36px; padding: 0; }
.adm-topbar__btn svg { width: 18px; height: 18px; }
.adm-logout-form { margin: 0; }

.adm-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 6px; }
.adm-user__name { font-size: 13px; font-weight: 600; }
.adm-user__role { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* v2.7.0: hamburger dropdown in the topbar. Trigger is `.btn--ghost.adm-topbar__btn`
   (matches the rest of the topbar buttons). v2.9.0 — popup positioned `fixed`
   instead of `absolute` so the topbar's stacking context (backdrop-filter +
   z-index:20) and any ancestor overflow can\'t clip the first menu item.
   Reports from user-role sessions had the top item invisible. */
.adm-topbar__menu { position: relative; }
.adm-topbar__menu > summary { list-style: none; cursor: pointer; }
.adm-topbar__menu > summary::-webkit-details-marker,
.adm-topbar__menu > summary::marker { display: none; }
.adm-topbar__hamburger { font-size: 18px; line-height: 1; }
.adm-topbar__menu-pop {
    position: fixed;
    top: calc(var(--topbar-h, 56px) + 6px);
    right: 16px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    min-width: 220px;
    padding: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
[data-theme="dark"] .adm-topbar__menu-pop { background: var(--surface, #1e1e1e); box-shadow: 0 6px 24px rgba(0,0,0,0.6); }
.adm-topbar__menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.adm-topbar__menu-item:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .adm-topbar__menu-item:hover { background: rgba(255,255,255,0.06); }
.adm-topbar__menu-item--danger { color: var(--err); }
.adm-topbar__menu-item--danger:hover { background: rgba(220,80,80,0.1); }
.adm-topbar__menu-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.adm-topbar__menu-icon svg { width: 16px; height: 16px; }

/* v2.9.0: subtle link wrapping on /stats?view=vms metric cells. Colors stay
   inherited so the column reads as a number, but a dotted underline + hover
   tells the user the cell is clickable (drills to /stats/vm/{id}). */
.stats-metric-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}
.stats-metric-link:hover { background: rgba(110,168,255,0.08); }

.adm-content { padding: 24px 28px; max-width: 1800px; width: 100%; }
/* Pages with wide data tables (VMs, IPAM, audit) — let them use the full content area. */
.adm-content--wide { max-width: none; }

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header__title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-header__sub { color: var(--muted); font-size: 14px; margin: 0; max-width: 78ch; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; }
.stat-card__k { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-card__v { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; margin-top: 6px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-card__sub { font-family: inherit; font-size: 12px; color: var(--muted); font-weight: 400; }
.stat-card__sub--err { color: var(--danger); }
.stat-card--warn { border-color: rgba(245, 176, 74, 0.3); }

/* Panels */
.panel {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius); padding: 18px 20px;
    margin-bottom: 18px;
}
.panel__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel__title { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: 0.02em; }
.panel--placeholder { padding: 28px 24px; }
.panel--placeholder p { color: var(--muted); font-size: 14px; margin: 8px 0; }
.placeholder-actions { margin-top: 18px; display: flex; gap: 10px; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
    text-align: left; padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.data-table th {
    font-weight: 600; color: var(--muted);
    font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table__time { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Next steps list */
.next-steps { margin: 0; padding-left: 20px; }
.next-steps li { padding: 4px 0; color: var(--muted); }
.next-steps li a { color: var(--accent); }

/* Status pills */
.status {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600;
    border: 1px solid var(--card-border); background: var(--card-bg); color: var(--muted);
}
.status--online,
.status--running { color: var(--ok); border-color: rgba(92, 201, 156, 0.4); background: rgba(92, 201, 156, 0.08); }
.status--offline,
.status--error,
.status--bootstrap_failed,
.status--failed { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); }
.status--pending,
.status--creating,
.status--rebooting,
.status--migrating,
.status--reinstalling,
.status--queued,
.status--deferred { color: var(--warn); border-color: rgba(245, 176, 74, 0.4); background: rgba(245, 176, 74, 0.08); }
.status--blocked { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); }
.status--free { color: var(--ok); border-color: rgba(92, 201, 156, 0.4); background: rgba(92, 201, 156, 0.08); }
.status--assigned { color: var(--accent); border-color: rgba(110, 168, 255, 0.4); background: rgba(110, 168, 255, 0.08); }
.status--released { color: var(--muted); }
.status--shutoff,
.status--shut_off,
.status--stopped,
.status--paused,
.status--suspended,
.status--maintenance,
.status--disabled { color: var(--muted); }

/* Two-column form */
.form--two-col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px;
}
.form--two-col .field { display: flex; flex-direction: column; gap: 6px; }
.form--two-col .form__actions--two-col {
    grid-column: span 2; display: flex; justify-content: flex-end; gap: 8px;
    border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px;
}

/* Inline form */
.form--inline { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-top: 6px; }
.form--inline .field__input { min-width: 240px; }

/* Action buttons row (VM lifecycle, Node actions) */
.actions-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}

/* SSH key pre-block */
.key-pre {
    background: var(--field-bg); border: 1px solid var(--field-border);
    border-radius: 8px; padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; word-break: break-all; white-space: pre-wrap;
    color: var(--fg); margin: 8px 0 0;
}

/* Key/value list */
.kv { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.kv strong { color: var(--fg); }

/* Remote VM list */
.vm-list-remote { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.vm-list-remote li { padding: 0; }
/* Vertical mode — one VM per row with status pill + name. Used on /nodes/{id}
   where the host can have hundreds of domains and the wrap-grid is unwieldy. */
.vm-list-remote--col { display: flex; flex-direction: column; gap: 2px; max-height: 480px; overflow-y: auto; padding: 6px; border: 1px solid var(--card-border); border-radius: 4px; }
.vm-list-remote--col li { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.vm-list-remote--col li code { font-size: 12px; }

/* Bridge members — wrap one per line so a 200-VM host doesn't stretch the page. */
.bridge-members { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; font-size: 11px; }
.bridge-members code { font-family: ui-monospace, monospace; padding: 1px 4px; }

/* IPAM pool card — two-column v4/v6 grid */
.pool-card { padding: 14px 16px; }
.pool-cols {
    display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px;
}
@media (max-width: 1100px) { .pool-cols { grid-template-columns: 1fr; } }
.pool-col { background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 6px; padding: 10px 12px; }
.pool-col__head {
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--field-border); padding-bottom: 6px; margin-bottom: 6px;
}
.pool-col__title {
    font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.data-table--compact th, .data-table--compact td { padding: 5px 8px; font-size: 12px; }
.data-table--compact th { font-size: 10px; }

/* Group chips — selectable filter pills above tables */
.chips {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 10px 0; margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.chips__label { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; margin-right: 4px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 4px;
    border: 1px solid var(--card-border); background: var(--card-bg);
    color: var(--fg); font-size: 13px; font-weight: 500; line-height: 1.2;
    text-decoration: none; transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip--active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--active:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.chip__count {
    display: inline-block; padding: 0 6px; border-radius: 10px;
    background: rgba(0,0,0,0.18); color: inherit;
    font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.5;
    min-width: 18px; text-align: center;
}
.chip--active .chip__count { background: rgba(255,255,255,0.22); }
.chip--small { padding: 2px 8px; font-size: 11px; margin-right: 3px; }
.col-nowrap { white-space: nowrap; }

/* v2.12.0: thousand-separator chunk — emitted by helpers.php num_fmt(). The
   comma is shown for readability but excluded from clipboard selections so
   admins can paste numbers like "6,143" into spreadsheets / calculators
   without manually stripping the separator. */
.num-sep { user-select: none; }

/* v2.12.0: right-align numeric metric columns. Operators read down a column
   of GB / MB / load values much faster when the digits stack. Apply via a
   cell class on the relevant <td> (RAM, disk, load, CPU%).
   v2.22.0: qualified with td/th to bump specificity above
   `.data-table th, .data-table td { text-align: left }` — without the element
   qualifier the bare .col-num (0,1,0) loses to the descendant selector
   (0,1,1) and the class silently no-ops on every data-table cell. */
td.col-num, th.col-num { text-align: right; font-variant-numeric: tabular-nums; }

/* v2.15.0: center-align "fraction" columns where a slash separates parts —
   e.g. "online / total" for nodes, "running / stopped / total" for VMs.
   Tabular-nums keeps the digits stacked while the slash sits in the middle.
   v2.22.0: same specificity fix as .col-num above. */
td.col-center, th.col-center { text-align: center; font-variant-numeric: tabular-nums; }

/* When a data-table runs with `table-layout: fixed` (per-cluster nodes / stats
   tables on /nodes and /stats?view=nodes), col-nowrap cells must truncate with
   an ellipsis instead of bleeding past their column — otherwise long hostnames
   or CPU model strings break the grid alignment between groups. */
table[style*="table-layout:fixed"] td.col-nowrap,
table[style*="table-layout: fixed"] td.col-nowrap {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compact one-line description that ellipsises rather than wrapping. */
/* Compact cron pill row on the dashboard — header and pills on one line. */
.cron-panel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 12px; }
.cron-panel__title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cron-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.cron-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255,255,255,0.03);
    font-size: 12px; line-height: 1.3;
}
.cron-pill strong { font-family: ui-monospace, monospace; font-weight: 600; }
.cron-pill__lbl { font-size: 10px; padding: 1px 7px; border-radius: 8px; font-weight: 600; text-transform: uppercase; }
.cron-pill--ok    .cron-pill__lbl { background: rgba(92,201,156,0.18); color: var(--ok); }
.cron-pill--err   .cron-pill__lbl { background: rgba(220,80,80,0.18);  color: var(--err); }
.cron-pill--stale .cron-pill__lbl { background: rgba(220,170,60,0.18); color: var(--warn); }
.cron-pill--warn  .cron-pill__lbl { background: rgba(220,170,60,0.18); color: var(--warn); }
.cron-pill--never .cron-pill__lbl { background: rgba(255,255,255,0.06); color: var(--muted); }
.plog-cron-line {
    font-size: 11px; line-height: 1.4;
    display: block; padding: 4px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    white-space: pre-wrap; word-break: break-all;
    user-select: all; -webkit-user-select: all;
    cursor: text;
}

/* Compact one-row filter strip — used on /tasks, /poll-log, etc. */
.filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
/* width:auto overrides the shared `.field__select { width:100% }` rule which
   would otherwise stretch each filter dropdown to row-width and force every
   select onto its own line — same root cause we hit on /vms in v0.84. */
.filter-row .field__select { width: auto; max-width: 280px; font-size: 12px; padding: 3px 8px; min-width: 0; }
.filter-row .btn { font-size: 12px; padding: 3px 12px; }
.filter-row__lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Compact one-row ISO attach controls on /vms/{id} */
.iso-attach-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; font-size: 13px; white-space: nowrap; overflow-x: auto; }
.iso-attach-row__form { display: inline-flex; align-items: center; gap: 6px; margin: 0; flex-shrink: 0; }
.iso-attach-row__form .field__select { min-width: 220px; max-width: 360px; padding: 3px 8px; font-size: 12px; }
.iso-attach-row__sep { display: inline-block; width: 1px; height: 18px; background: var(--card-border); flex-shrink: 0; }
.iso-attach-row__hint { font-size: 11px; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Country flag rendering — apply on cells/options that contain regional-
   indicator emoji so browsers fall through to a font with colour glyphs. */
.country-flag, select.country-select option, .country-cell {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
                 "Twemoji Mozilla", "Segoe UI Symbol", "EmojiOne Color",
                 ui-sans-serif, system-ui, sans-serif;
}

/* Threshold-coloured stats cells (used on /stats?view=nodes). */
.cell--ok   { background: rgba(92,201,156,0.10); }
.cell--warn { background: rgba(220,170,60,0.18); }
.cell--err  { background: rgba(220,80,80,0.20); }

/* libvirt-vms expand block on /nodes */
.libvirt-vms-row { background: rgba(255,255,255,0.02); }
.libvirt-vms-wrap { padding: 8px 12px; border-top: 1px solid var(--card-border); }
.libvirt-vms__head { font-size: 12px; }

/* Storage block inside the per-node panel on /storages */
.storage-block { padding: 8px 10px; margin-top: 8px; border: 1px solid var(--card-border); border-radius: 6px; background: rgba(255,255,255,0.02); }
.storage-block__head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }

/* DNS list: one IP per line, monospace */
.dns-stack { display: flex; flex-direction: column; gap: 2px; font-size: 11px; line-height: 1.3; }
.dns-stack code { font-family: ui-monospace, monospace; padding: 1px 4px; }

.ipam-net-desc {
    display: inline-block; vertical-align: middle;
    max-width: 320px; margin-left: 8px;
    font-size: 11px; line-height: 1.4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Compact settings table — one parameter per visual row */
.settings-table td { vertical-align: middle; padding: 4px 6px; }
.settings-table th { padding: 5px 6px; font-size: 10px; }
.settings-table code { font-size: 11px; padding: 1px 4px; }
.settings-table__key { max-width: 280px; }
/* Description sits inline next to the key on the same row — ellipsised so it
   never overlaps the value field. Full text shown on hover. */
.settings-table__hint {
    font-size: 11px; opacity: 0.7;
    display: inline-block; margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 220px;
}
.settings-table__value { width: 1%; }
.settings-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.settings-row__input {
    width: 320px; min-width: 220px; max-width: 420px;
    font-family: ui-monospace, monospace; font-size: 12px; padding: 3px 8px;
}
.settings-row__save { flex: 0 0 auto; padding: 2px 10px; font-size: 14px; line-height: 1; }
.settings-group + .settings-group { margin-top: 10px; }

/* Password show/hide field */
.pw-field { position: relative; display: block; }
.pw-field > input { width: 100%; padding-right: 36px; box-sizing: border-box; }
.pw-field__toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 28px; height: 28px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; cursor: pointer;
    color: var(--muted); border-radius: 4px;
}
.pw-field__toggle:hover { color: var(--accent); background: rgba(255,255,255,0.05); }
.pw-field__toggle svg { width: 16px; height: 16px; }

/* Changelog timeline */
.changelog { list-style: none; padding: 0; margin: 0; }
.changelog .changelog__entry { list-style: none; }
.changelog__entry { display: grid; grid-template-columns: 130px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--card-border); }
.changelog__entry:first-child { border-top: 0; padding-top: 4px; }
.changelog__when { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; padding-top: 2px; line-height: 1.4; }
.changelog__num  { display: inline-block; padding: 1px 7px; margin-bottom: 3px; border-radius: 4px; background: rgba(255,255,255,0.06); color: var(--text); font-weight: 600; font-size: 11px; }
.changelog__date { white-space: nowrap; display: block; }
.changelog__time { white-space: nowrap; display: block; opacity: 0.75; }
.changelog__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.changelog__version { display: inline-block; padding: 1px 7px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.06); color: var(--muted); border: 1px solid var(--card-border); }
.changelog__title { margin: 0; font-size: 14px; font-weight: 600; }
.changelog__list { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.changelog__list li { margin: 2px 0; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 8px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.5; }
.tag--ok    { background: rgba(92,201,156,0.18); color: var(--ok); }
.tag--err   { background: rgba(220,80,80,0.18);  color: var(--err); }
.tag--info  { background: rgba(80,150,220,0.18); color: #79b1ea; }
.tag--ui    { background: rgba(180,120,220,0.18); color: #c08fe0; }
.tag--ops   { background: rgba(220,170,60,0.18);  color: var(--warn); }
.tag--muted { background: rgba(255,255,255,0.06); color: var(--muted); }
[data-theme="light"] .chip__count { background: rgba(0,0,0,0.06); }
[data-theme="light"] .chip--active .chip__count { background: rgba(255,255,255,0.30); }

/* Sortable column headers
 * v2.41.0: switched from `nowrap` to `pre-line` so a header string with a
 * literal "\n" (Disk RD\nMB/s, IOPS\nRD, RX\nMbit/s, …) renders on two
 * lines and tightens the /stats?view=vms column widths. Single-line
 * headers (Name, Node, State, …) are unaffected — `pre-line` only honours
 * explicit newlines in the source string. */
.sort-h {
    color: var(--muted); text-decoration: none; font: inherit;
    white-space: pre-line; line-height: 1.15;
    display: inline-block;
}
.sort-h:hover { color: var(--accent); text-decoration: none; }
.sort-h--active { color: var(--accent); }

/* Inline icon buttons for VM list / table actions */
.btn--icon {
    width: 28px; height: 28px; padding: 0;
    font-size: 13px; line-height: 1;
    border-radius: 6px;
}
.btn--icon:hover { color: var(--accent); }
.btn--ok { color: var(--ok); border-color: rgba(92,201,156,0.4); }
.btn--ok:hover { background: var(--ok); border-color: var(--ok); color: #fff; }

.vm-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vm-state-cell { white-space: nowrap; }
.vm-state-cell__refresh { padding: 1px 4px; vertical-align: middle; }
.vm-state-cell__poll { font-size: 10px; line-height: 1; margin-left: 4px; vertical-align: middle; }
.vm-state-cell__migrate {
    display: inline-block; padding: 1px 6px; margin-left: 4px;
    background: rgba(80,150,220,0.18); color: #79b1ea;
    border-radius: 8px; font-size: 10px; font-weight: 600; line-height: 1.5;
    font-family: ui-monospace, monospace; vertical-align: middle;
}
/* v2.41.0: actions row stays on a single line. `flex-wrap: wrap` +
 * max-width: 220px would push the 6-7 lifecycle icons (start/stop/reboot/
 * force/vnc/edit/delete) onto a second line on narrow viewports — the
 * operator wanted them always horizontal. The action cell now sizes to
 * its content; the column header (`stats.col_actions` = "Actions" /
 * "Действия") is one short word, so it doesn't widen the column.
 * Header & cell pin to nowrap via the existing .col-nowrap helper. */
.vm-actions { display: flex; gap: 2px; flex-wrap: nowrap; }
.vm-actions__form { display: inline; margin: 0; }
/* Compacter icons inside the VM action cell — 6-8 icons per row was widening
   the table on busy hosts. 22px is still tap-friendly on touch and mac OS. */
.vm-actions .btn--icon { width: 22px; height: 22px; }
.vm-actions .btn--icon svg { width: 12px; height: 12px; }

/* v2.47.0: SSD/HDD toggle for /admin/disk-endurance missing-models lists.
 * Two side-by-side mini-buttons inside a rounded border; the active one
 * gets the accent fill, the inactive one stays muted. Click either to
 * POST a one-shot type override into disk_model_types. */
.de-toggle__btn {
    appearance: none; border: 0; background: transparent;
    color: var(--muted); padding: 2px 8px; font: inherit; font-size: 10px;
    line-height: 1.4; cursor: pointer;
}
.de-toggle__btn + .de-toggle__btn { border-left: 1px solid var(--border); }
.de-toggle__btn:hover { color: var(--accent); background: rgba(80,150,220,0.08); }
.de-toggle__btn--active { color: #fff; background: var(--accent); }
.de-toggle__btn--active:hover { background: var(--accent); color: #fff; }

.data-table--vms td { vertical-align: middle; padding: 4px 6px; }
.data-table--vms th { padding: 5px 6px; font-size: 10px; }
.data-table--vms code { font-size: 11px; padding: 1px 4px; }
/* All VM row cells stay on one line — extra IPs go into a hover popover. */
.data-table--vms td, .data-table--vms td a, .data-table--vms td > code { white-space: nowrap; }
.vm-ip-col { font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.35; }
.vm-ip-col__v6 { font-size: 10px; }
.vm-ip-col__primary { display: inline-flex; align-items: center; gap: 4px; }
.ip-more {
    position: relative;
    display: inline-block;
    padding: 0 5px;
    font-size: 10px;
    line-height: 1.4;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--field-border);
    border-radius: 8px;
    cursor: default;
}
.ip-more:hover, .ip-more:focus { color: var(--text); border-color: var(--accent); }
.ip-more__pop {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 6px 8px;
    z-index: 50;
    min-width: 180px;
    max-width: 320px;
    background: var(--card-bg, #1b1d22);
    border: 1px solid var(--card-border, #333);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    display: none;
    white-space: normal;
}
.ip-more:hover .ip-more__pop, .ip-more:focus .ip-more__pop, .ip-more__pop:hover { display: block; }
.ip-more__pop code { display: block; padding: 1px 4px; margin: 1px 0; user-select: text; -webkit-user-select: text; }
.vm-load { font-size: 11px; line-height: 1.3; white-space: nowrap; }
.panel--tight { padding: 10px 12px; }
.panel--tight + .panel--tight { margin-top: 10px; }

/* Fieldset groups inside two-col forms (used on /plans edit, etc.) */
.form--two-col .form__group {
    grid-column: 1 / -1;
    border: 1px solid var(--card-border, #333);
    border-radius: 6px;
    padding: 10px 14px 12px;
    margin: 0 0 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 14px;
    row-gap: 6px;
}
.form--two-col .form__group > legend {
    padding: 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.field__hint { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }

/* Quick search input on /vms */
.vms-search { display: inline-flex; align-items: center; gap: 4px; }
.vms-search__input {
    padding: 5px 10px; border-radius: 4px; border: 1px solid var(--field-border);
    background: var(--field-bg); color: var(--fg); font: inherit; font-size: 12px;
    min-width: 220px; outline: none;
}
.vms-search__input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--field-focus); }

/* Compact selects in the /vms single-row filter form. Without this override the
   shared `.field__select` uses width:100% + 11px padding, which forces each
   dropdown onto its own line. */
.vms-node-filter__select {
    width: auto;
    min-width: 0;
    max-width: 280px;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    background: var(--field-bg); color: var(--fg);
    border: 1px solid var(--field-border);
}
.vms-node-filter__select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--field-focus); outline: none; }

/* Permissions UI helpers */
.perm-actions { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 14px; }
.perm-actions li { font-size: 12px; padding: 2px 0; }
.perm-actions code { background: var(--field-bg); padding: 1px 6px; }

/* Sub-stats inside cards (cpu/mem/disk/la) */
.sub-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.sub-stats__k { font-weight: 500; }
.sub-stats__v { font-family: ui-monospace, monospace; color: var(--fg); text-align: right; }

/* Bar chart for load */
.bar { background: var(--card-border); border-radius: 4px; height: 6px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--accent); transition: width .2s ease; }
.bar__fill--ok   { background: var(--ok); }
.bar__fill--warn { background: var(--warn); }
.bar__fill--err  { background: var(--danger); }

/* Tabs */
.tabs {
    display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tabs__item {
    padding: 8px 14px; border: 1px solid transparent; border-bottom: 0;
    border-top-left-radius: 8px; border-top-right-radius: 8px;
    color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none;
    margin-bottom: -1px;
}
.tabs__item:hover { color: var(--fg); text-decoration: none; }
.tabs__item.is-active {
    color: var(--accent); border-color: var(--card-border); border-bottom-color: var(--bg);
    background: var(--card-bg);
}
.tabs__count {
    display: inline-block; margin-left: 6px; padding: 1px 6px;
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 999px;
    font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted);
}

/* Bulk add — collapsible groups on the network page */
.bulk-add { display: flex; flex-direction: column; gap: 10px; }
.bulk-add__group {
    border: 1px solid var(--card-border); border-radius: 8px;
    padding: 12px 14px; background: rgba(0,0,0,0.05);
}
[data-theme="light"] .bulk-add__group { background: rgba(0,0,0,0.02); }
.bulk-add__group summary {
    cursor: pointer; font-weight: 600; padding: 4px 0; color: var(--fg); user-select: none;
}
.bulk-add__group[open] { border-color: var(--accent); }
.bulk-add__group .form { margin-top: 10px; }
.field__textarea { font-family: ui-monospace, monospace; font-size: 13px; resize: vertical; min-height: 100px; }

/* Responsive — collapse sidebar on small screens */
@media (max-width: 900px) {
    .adm { grid-template-columns: 1fr; }
    .adm-sidebar { position: static; height: auto; }
    .adm-content { padding: 18px 16px; }
    .form--two-col { grid-template-columns: 1fr; }
    .form--two-col .form__actions--two-col,
    .form--two-col .field[style*="span 2"] { grid-column: span 1; }
}

/* Firewall rules — inline expandable block under a row/section */
.fw-rules {
    margin-top: 8px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .fw-rules { background: rgba(0, 0, 0, 0.02); }
.fw-rules__head {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px; font-size: 12px; color: var(--muted);
    border-bottom: 1px solid var(--card-border);
}
.fw-rules__head .btn { font-size: 11px; padding: 2px 8px; }
.fw-rules__pre {
    margin: 0; padding: 10px 12px;
    font: 12px/1.45 ui-monospace, "SFMono-Regular", Menlo, monospace;
    color: var(--fg);
    max-height: 480px; overflow: auto; white-space: pre;
}
.fw-rules--inline { margin: 6px 0 4px; }
.fw-rules tr td { padding: 0; } /* tight when used as a colspan row inside a table */
tr.fw-rules-row > td { padding: 6px 10px !important; background: rgba(0,0,0,0.02); }
[data-theme="dark"] tr.fw-rules-row > td { background: rgba(255,255,255,0.02); }
.btn--icon[data-fw-fetch] { color: var(--muted); }
.btn--icon[data-fw-fetch]:hover { color: var(--accent); }
