:root {
    color-scheme: dark;
    --bg: #07101f;
    --surface: #0d192b;
    --surface-2: #111f34;
    --surface-3: #162741;
    --border: #223553;
    --text: #e9f0fb;
    --muted: #8fa2bd;
    --accent: #46c2ff;
    --accent-2: #218bc2;
    --good: #42d392;
    --warn: #f0b84b;
    --bad: #ff667d;
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 10% -10%, rgba(40, 153, 215, .18), transparent 34rem),
        radial-gradient(circle at 95% 20%, rgba(66, 211, 146, .08), transparent 28rem),
        var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #8cddff; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 68px;
    padding: 10px max(24px, calc((100vw - 1500px) / 2));
    border-bottom: 1px solid rgba(64, 91, 126, .55);
    background: rgba(7, 16, 31, .88);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 750;
    letter-spacing: -.01em;
    white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand small { color: var(--muted); font-weight: 500; }
.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(100, 207, 255, .38);
    border-radius: 10px;
    color: #06111e;
    background: linear-gradient(135deg, #80dcff, #43d4aa);
    box-shadow: 0 6px 24px rgba(70, 194, 255, .23);
    font-weight: 900;
}
.topbar nav { display: flex; gap: 4px; margin-right: auto; }
.topbar nav a { padding: 8px 14px; border-radius: 8px; color: #acbdd3; }
.topbar nav a:hover { color: var(--text); background: var(--surface-2); }

.shell { width: min(1500px, calc(100% - 48px)); margin: 38px auto 80px; }
.login-shell { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.page-heading h1 { margin: 2px 0 3px; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; letter-spacing: -.04em; }
.page-heading p { margin: 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.auto-refresh { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.panel, .stat-card, .node-card, .login-card {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(17, 31, 52, .92), rgba(12, 24, 42, .92));
    box-shadow: var(--shadow);
}
.panel { padding: 24px; margin-bottom: 24px; }
.panel.narrow { max-width: 600px; margin: 15vh auto; }
.panel h1, .panel h2 { margin-top: 0; }
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading p { margin: 3px 0 0; }

.button {
    display: inline-flex;
    min-height: 38px;
    padding: 8px 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid #34506f;
    border-radius: 9px;
    color: #dce9f8;
    background: #172a43;
    font-weight: 650;
    line-height: 1.1;
}
.button:hover { border-color: #4b7198; color: white; background: #1d3452; }
.button-primary { border-color: #2ca3d8; color: #03111d; background: linear-gradient(135deg, #69d2ff, #44d5b1); }
.button-primary:hover { color: #03111d; filter: brightness(1.08); }
.button-danger { border-color: rgba(255, 102, 125, .46); color: #ff9aaa; background: rgba(180, 48, 72, .16); }
.button-quiet { border-color: transparent; background: transparent; }
.button-small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.button-block { width: 100%; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button-row form { margin: 0; }

.flash, .validation-errors, .token-panel, .error-panel {
    margin-bottom: 22px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
}
.flash-success { border-color: rgba(66, 211, 146, .5); color: #9ce7c7; }
.flash-error, .validation-errors, .error-panel { border-color: rgba(255, 102, 125, .52); color: #ffabb8; }
.flash-info { border-color: rgba(70, 194, 255, .5); }
.validation-errors ul { margin-bottom: 0; }
.error-panel pre { overflow: auto; margin-bottom: 0; color: #ffd1d8; white-space: pre-wrap; }

.login-card { width: min(430px, 100%); padding: 38px; }
.brand-login { margin-bottom: 36px; }
.login-card h1 { margin: 0 0 6px; font-size: 28px; }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }

label { display: grid; gap: 7px; color: #cbd8e9; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #2b4261;
    border-radius: 8px;
    outline: none;
    color: var(--text);
    background: #081426;
}
textarea { resize: vertical; }
textarea.tall { min-height: 240px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(70, 194, 255, .13); }
input[type="checkbox"] { width: 19px; min-height: 19px; accent-color: var(--accent); }
.check-row { display: flex; align-items: flex-start; gap: 12px; }
.check-row span { display: grid; gap: 2px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.profile-form { display: grid; gap: 0; }
.sticky-actions {
    position: sticky;
    z-index: 10;
    bottom: 18px;
    display: flex;
    justify-content: flex-end;
    padding: 13px;
    border: 1px solid rgba(57, 88, 124, .75);
    border-radius: 12px;
    background: rgba(8, 20, 38, .9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.inline-form { display: grid; grid-template-columns: 1.2fr .6fr .7fr 1fr auto; align-items: end; gap: 12px; margin-bottom: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-grid-detail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-card { min-height: 145px; padding: 20px; }
.stat-card > span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { display: block; margin: 16px 0 3px; font-size: clamp(24px, 2.5vw, 36px); letter-spacing: -.04em; }
.stat-card strong small { color: var(--muted); font-size: 16px; font-weight: 500; }
.stat-card > small { color: var(--muted); }
.status-tally { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; }
.dot { width: 7px; height: 7px; margin: 0 2px 0 3px; border-radius: 50%; }
.dot.online { background: var(--good); }
.dot.warning { background: var(--warn); }
.dot.offline { background: var(--bad); }

.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status-online { color: var(--good); background: rgba(66, 211, 146, .1); }
.status-warning { color: var(--warn); background: rgba(240, 184, 75, .1); }
.status-offline { color: #ff8295; background: rgba(255, 102, 125, .1); }
.text-good, .revision-ok { color: var(--good) !important; }
.text-warn, .revision-wait { color: var(--warn) !important; }
.text-bad { color: var(--bad) !important; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card {
    min-width: 0;
    margin: 0;
    padding: 15px;
    border: 1px solid rgba(52, 78, 111, .72);
    border-radius: 11px;
    background: #091528;
}
.chart-card figcaption { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.metric-chart { display: block; width: 100%; height: 190px; }
.metric-chart-frame { position: relative; min-width: 0; }
.metric-chart-interactive { cursor: crosshair; border-radius: 7px; outline: none; touch-action: pan-y; }
.metric-chart-interactive:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.metric-chart-overlay {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.chart-tooltip {
    position: absolute;
    z-index: 3;
    top: 8px;
    right: 8px;
    min-width: 168px;
    max-width: min(250px, calc(100% - 16px));
    padding: 9px 10px;
    border: 1px solid rgba(101, 139, 180, .72);
    border-radius: 8px;
    color: var(--text);
    background: rgba(5, 14, 28, .94);
    box-shadow: 0 9px 28px rgba(0, 0, 0, .34);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip-left { right: auto; left: 8px; }
.chart-tooltip-time { margin-bottom: 5px; color: #c8d8eb; font-weight: 750; }
.chart-tooltip-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 2px 0; }
.chart-tooltip-series { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.chart-tooltip-value { color: var(--text); font-weight: 750; }
.chart-tooltip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.series-default { color: var(--accent); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid rgba(47, 70, 100, .65); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: rgba(51, 85, 121, .1); }
td small { display: block; margin-top: 3px; color: var(--muted); }
.strong-link { color: var(--text); font-weight: 750; }
.wrap-cell { min-width: 280px; white-space: normal; }
.empty { padding: 60px 20px; color: var(--muted); text-align: center; }
.empty.compact { padding: 24px 10px; }

.node-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.node-card { display: block; padding: 20px; color: var(--text); transition: transform .16s ease, border-color .16s ease; }
.node-card:hover { transform: translateY(-2px); border-color: #3a6488; color: var(--text); }
.node-card-head, .node-card footer { display: flex; justify-content: space-between; gap: 12px; }
.node-card .revision { color: var(--muted); font-size: 12px; }
.node-card h2 { margin: 17px 0 2px; font-size: 20px; }
.node-card > p { margin: 0; color: var(--muted); }
.node-card footer { margin: 18px -20px -20px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.mini-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 20px 0 0; }
.mini-metrics div { min-width: 0; }
.mini-metrics dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.mini-metrics dd { overflow: hidden; margin: 3px 0 0; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

.fleet-panel { padding: 7px 9px; }
.fleet-panel .table-wrap { scrollbar-color: #365576 #0a1728; }
.node-table { min-width: 1200px; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
.node-table .node-col-identity { width: 15%; }
.node-table .node-col-requests { width: 10%; }
.node-table .node-col-bans { width: 11%; }
.node-table .node-col-tcp { width: 13%; }
.node-table .node-col-bandwidth { width: 21%; }
.node-table .node-col-quality { width: 10%; }
.node-table .node-col-host { width: 7%; }
.node-table .node-col-config { width: 9%; }
.node-table .node-col-action { width: 4%; }
.node-table th, .node-table td { padding: 10px 7px; vertical-align: top; }
.node-table thead th { position: sticky; z-index: 3; top: 0; background: #0d1a2d; }
.node-table th:first-child, .node-table td:first-child { position: sticky; z-index: 2; left: 0; background: #0d192b; }
.node-table thead th:first-child { z-index: 4; background: #0d1a2d; }
.node-table tbody td:first-child { box-shadow: 7px 0 12px rgba(0, 0, 0, .16); }
.node-table tbody tr:hover td:first-child { background: #12223a; }
.node-table tbody tr:last-child td { border-bottom: 0; }
.node-table .node-row-problem td:first-child { box-shadow: inset 3px 0 0 rgba(240, 184, 75, .78), 7px 0 12px rgba(0, 0, 0, .16); }
.node-row-stale td:not(:first-child) { opacity: .68; }
.node-identity-cell { white-space: normal; }
.node-title-line { display: flex; min-width: 0; align-items: center; gap: 6px; }
.node-identity-cell .node-name { display: block; min-width: 0; overflow: hidden; margin: 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.node-identity-cell > small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.issue-list span { padding: 2px 6px; border: 1px solid rgba(255, 102, 125, .28); border-radius: 999px; color: #ff9aaa; background: rgba(255, 102, 125, .08); font-size: 10px; }
.metric-cell { min-width: 0; font-variant-numeric: tabular-nums; }
.metric-cell > strong { display: block; color: var(--text); font-size: 17px; }
.metric-cell > span { display: block; margin-bottom: 4px; }
.metric-cell > small { display: block; max-width: 100%; overflow: hidden; margin-top: 3px; text-overflow: ellipsis; white-space: nowrap; }
.metric-cell-strong { min-width: 0; }
.metric-cell-strong > span { margin-top: 9px; font-weight: 750; }
.request-cell > span { margin-top: 6px; }
.ban-cell > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban-failure { margin-top: 5px !important; font-weight: 750; }
.tcp-cell { min-width: 0; }
.tcp-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin-bottom: 4px; }
.tcp-values > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bandwidth-cell { min-width: 0; }
.bandwidth-cell > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bandwidth-cell b { display: inline-block; width: 39px; color: var(--accent); }
.quality-cell, .config-cell { min-width: 0; }
.config-cell > span, .config-cell > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-table td:last-child { padding-right: 4px; padding-left: 4px; text-align: right; }
.node-table td:last-child .button { padding-right: 8px; padding-left: 8px; }

.cidr-line-count { color: var(--accent); font-variant-numeric: tabular-nums; }

.dashboard-stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.range-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: #081426; }
.range-tabs a { padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.range-tabs a:hover, .range-tabs a.active { color: #06111e; background: var(--accent); }
.status-coverage { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 17px; color: var(--muted); }
.status-coverage strong { color: var(--text); font-size: 24px; }
.status-class-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.status-class-card { padding: 14px; border: 1px solid rgba(52, 78, 111, .72); border-radius: 11px; background: #091528; }
.status-class-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-class-card > div strong { font-size: 17px; }
.status-class-card > div span, .status-class-card small { color: var(--muted); font-variant-numeric: tabular-nums; }
.status-class-card progress { width: 100%; height: 7px; margin: 12px 0 7px; overflow: hidden; border: 0; border-radius: 99px; background: var(--surface-3); appearance: none; }
.status-class-card progress::-webkit-progress-bar { border-radius: 99px; background: var(--surface-3); }
.status-class-card progress::-webkit-progress-value { border-radius: 99px; background: var(--status-color); }
.status-class-card progress::-moz-progress-bar { border-radius: 99px; background: var(--status-color); }
.status-class-2xx { --status-color: var(--good); }
.status-class-3xx { --status-color: var(--accent); }
.status-class-4xx { --status-color: var(--warn); }
.status-class-5xx { --status-color: var(--bad); }
.status-detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(230px, .8fr) minmax(230px, .8fr); gap: 14px; }
.status-rank-card, .status-source-card { min-width: 0; padding: 15px; border: 1px solid rgba(52, 78, 111, .72); border-radius: 11px; background: #091528; }
.status-rank-card h3, .status-source-card h3 { margin: 0 0 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.status-ranking { max-height: 246px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.status-ranking li { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid rgba(47, 70, 100, .45); font-variant-numeric: tabular-nums; }
.status-ranking li strong { text-align: right; }
.status-ranking li small { margin: 0; }
.status-code { display: inline-flex; justify-content: center; padding: 2px 6px; border-radius: 6px; color: var(--text); background: var(--surface-3); font-family: ui-monospace, monospace; font-weight: 750; }
.status-code-2xx { color: var(--good); }
.status-code-3xx { color: var(--accent); }
.status-code-4xx { color: var(--warn); }
.status-code-5xx { color: var(--bad); }
.source-breakdown { margin: 0; }
.source-breakdown > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(47, 70, 100, .45); }
.source-breakdown dt { color: var(--muted); }
.source-breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.source-breakdown dd small { margin-left: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 0 52px; color: var(--muted); font-size: 11px; }
.chart-legend span::before { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: currentColor; content: ''; }
.series-2xx { color: #42d392; }
.series-3xx { color: #46c2ff; }
.series-4xx { color: #f0b84b; }
.series-5xx { color: #ff667d; }

.heading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); }
.token-panel { display: grid; grid-template-columns: 1fr minmax(280px, auto); align-items: center; gap: 20px; border-color: rgba(70, 194, 255, .5); }
.token-panel p { margin: 3px 0 0; color: var(--muted); }
.command-panel { grid-template-columns: 1fr; }
.token-panel .command-block { display: block; overflow-wrap: anywhere; padding: 12px; border-radius: 8px; color: #b9efff; background: #05111e; white-space: pre-wrap; user-select: all; }
.command-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.command-copy-status { min-height: 1.4em; color: var(--muted); font-size: .88rem; }
.token-panel .command-note { margin-top: -6px; }
.token-panel .command-note code { padding: 1px 4px; border-radius: 4px; color: #b9efff; background: #05111e; }
.two-column { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; }
.details { margin: 0; }
.details div { display: grid; grid-template-columns: 180px 1fr; gap: 20px; padding: 10px 0; border-bottom: 1px solid rgba(47, 70, 100, .45); }
.details dt { color: var(--muted); }
.details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: rgba(255, 102, 125, .55); background: linear-gradient(145deg, rgba(55, 22, 34, .82), rgba(25, 18, 31, .9)); }
.danger-zone h2 { color: #ff9aaa; }
.danger-warning { max-width: 1050px; color: #ffc3cc; line-height: 1.7; }
.danger-form { display: grid; grid-template-columns: minmax(240px, 480px) auto; align-items: end; justify-content: start; gap: 12px; margin-top: 18px; }
.danger-form .button { min-height: 42px; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 55px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(47, 70, 100, .45); }
.timeline li > span { color: var(--accent); font-family: ui-monospace, monospace; }
.timeline strong { color: var(--text); font-size: 12px; text-transform: uppercase; }
.timeline p { margin: 2px 0; overflow-wrap: anywhere; }
.timeline small { color: var(--muted); }
.timeline-apply_error { border-left: 2px solid var(--bad); padding-left: 10px !important; }
.event { display: inline-flex; padding: 3px 7px; border-radius: 6px; color: var(--accent); background: rgba(70, 194, 255, .1); font-family: ui-monospace, monospace; font-size: 11px; }
.event-apply_error { color: var(--bad); background: rgba(255, 102, 125, .1); }
.event-recovered, .event-applied { color: var(--good); background: rgba(66, 211, 146, .1); }

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid-detail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inline-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inline-form .button { align-self: end; }
    .dashboard-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .status-detail-grid { grid-template-columns: 1fr 1fr; }
    .status-trend-card { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .topbar { position: static; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
    .topbar .brand { margin-right: auto; }
    .topbar nav { order: 3; width: 100%; overflow-x: auto; }
    .topbar nav a { flex: 1; text-align: center; }
    .shell { width: min(100% - 24px, 1500px); margin-top: 22px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .stat-grid, .stat-grid-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-grid, .node-grid, .two-column, .form-grid, .inline-form, .danger-form { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .panel { padding: 17px; }
    .fleet-panel { padding: 7px; }
    .node-card { padding: 17px; }
    .node-card footer { margin: 16px -17px -17px; padding: 11px 17px; }
    .token-panel { grid-template-columns: 1fr; }
    .details div { grid-template-columns: 1fr; gap: 2px; }
    .metric-chart { height: 165px; }
    .heading-actions { justify-content: flex-start; }
    .status-class-grid, .status-detail-grid { grid-template-columns: 1fr; }
    .status-trend-card { grid-column: auto; }
}

@media (max-width: 430px) {
    .stat-grid, .stat-grid-detail { grid-template-columns: 1fr; }
    .stat-card { min-height: 125px; }
    .login-card { padding: 25px; }
    .mini-metrics { grid-template-columns: repeat(2, 1fr); }
    .node-table .node-col-identity { width: 130px; }
    .node-table th:first-child, .node-table td:first-child { position: static; }
    .node-title-line { align-items: flex-start; flex-direction: column; }
}

.fold-panel { padding: 0; overflow: hidden; }
.fold-panel > summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 18px 24px;
    cursor: pointer;
    list-style: none;
}
.fold-panel > summary::-webkit-details-marker { display: none; }
.fold-panel > summary::before {
    content: '▸';
    color: var(--muted);
    font-size: 12px;
}
.fold-panel[open] > summary::before { content: '▾'; }
.fold-title { font-size: 18px; font-weight: 750; }
.fold-status { font-size: 13px; }
.fold-body { padding: 0 24px 24px; }
.domain-add-form { margin: 16px 0 22px; }
.domain-add-form label { display: block; }
.domain-add-form textarea { width: 100%; margin-top: 8px; }
.domain-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
