/* 机群监控 2026-11-23 设计规范：深浅主题切换；数字等宽；单一强调色表示「选中」，指标各有固定色。 */
:root {
  --bg: #f3f4f7; --panel: #ffffff; --panel-2: #f7f8fa; --line: #e4e7ec; --line-strong: #d3d8e0;
  --text: #121620; --text-2: #4d5565; --text-3: #626d80;
  --accent: #3b6ef5; --accent-soft: rgba(59,110,245,.10);
  --cpu: #6d5ce8; --gpu: #0f9f86; --mem: #d1891b; --rx: #246cc8; --tx: #128153; --link: #c2410c; --temp: #e0533d;
  --ok: #17a36b; --warn: #91600a; --bad: #c23b2a;
  --chart-grid: #eceef2; --chart-text: #626d80; --chart-crosshair: #b7bfcc;
  --bar-track: #eceef2; --bar-bg: #ffffff;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0d12; --panel: #13161d; --panel-2: #171b23; --line: #222733; --line-strong: #2e3443;
  --text: #e8ebf1; --text-2: #a3abba; --text-3: #8d97a9;
  --accent: #6b93ff; --accent-soft: rgba(107,147,255,.12);
  --cpu: #9b8cff; --gpu: #36d3b4; --mem: #f2b552; --rx: #5ea6ff; --tx: #42d392; --link: #fb8a4c; --temp: #ff7a66;
  --ok: #42d392; --warn: #f2b552; --bad: #ff6b6b;
  --chart-grid: #1f2430; --chart-text: #8d97a9; --chart-crosshair: #4b5468;
  --bar-track: #222733; --bar-bg: #0b0d12;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
:where(.theme-switching) :where(.topbar, .alert-strip, .alert-pill, .alert-chip, .seg, .seg button, .icon-button, .ghost-button, .host, .quota-box, .notice, .stats, .stat, .panel, .chart-tooltip, .empty-card, .disk-type, .foot, .login-card, .pw-wrap input, .pw-toggle, .login-error, .primary-button) { transition: background-color .25s, border-color .25s, color .25s !important; }
button, input { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 2vw, 48px); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 7px); gap: 2px; flex: none; }
.brand-mark i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.brand-mark i:nth-child(2) { background: var(--gpu); } .brand-mark i:nth-child(3) { background: var(--mem); } .brand-mark i:nth-child(4) { background: var(--cpu); }
.brand-name { font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.brand-sub { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 12px; }
.conn { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.clock { font: 13px var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.waiting { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.dot.offline { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 20%, transparent); }
.dot.none { background: var(--text-3); box-shadow: none; }

.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 12px; min-height: 34px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.selected, .seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.seg.small button { padding: 3px 9px; font-size: 12px; min-height: 26px; }
.icon-button, .ghost-button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; cursor: pointer; color: var(--text-2); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.icon-button svg { width: 16px; height: 16px; }
.ghost-button { padding: 7px 12px; min-width: 86px; min-height: 40px; font-size: 13px; }
.ghost-button.compact { min-width: auto; padding: 7px 14px; }
.ghost-button:hover, .icon-button:hover { color: var(--text); border-color: var(--line-strong); }
.ghost-button[aria-pressed="true"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }

main { margin: 0 auto; padding: 20px clamp(16px, 2vw, 48px) 32px; }

/* 状态摘要条与分组切换 */
.alert-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 12px; }
.alert-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; font-weight: 550;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); font-variant-numeric: tabular-nums; }
.alert-pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.alert-pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.alert-pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.alert-pill.neutral { font-family: var(--mono); }
.alert-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.alert-chip { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; padding: 2px 7px; font-size: 11px;
  font-family: var(--mono); cursor: pointer; color: var(--text); transition: border-color .15s, background-color .15s; }
.alert-chip:hover { border-color: var(--accent); background: var(--accent-soft); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.group-tabs { flex-wrap: wrap; max-width: 100%; }

/* 总览卡片 */
.fleet { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.host { position: relative; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 18px 18px 14px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: border-color .15s, transform .15s; }
.host:hover { border-color: var(--line-strong); }
.host.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--panel)); box-shadow: 0 0 0 2px var(--accent-soft); }
.host.down, .host.unconfirmed { border-style: dashed; }
.host.unconfirmed .host-age { color: var(--warn); }
.host-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.host-name { font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-kind { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-age { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; flex: none; }
.host.down .host-age { color: var(--bad); }
.host-sub { display: flex; align-items: center; justify-content: space-between; gap: 4px 10px; margin-top: -6px; height: 18px; line-height: 18px; min-width: 0; }
.host-model { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-metrics, .spark, .host-net, .stats { transition: opacity .2s; }
.host.down .host-metrics, .host.down .spark, .host.down .host-net,
.host.unconfirmed .host-metrics, .host.unconfirmed .spark, .host.unconfirmed .host-net { opacity: .45; }
.detail[data-status="offline"] .stats, .detail[data-status="error"] .stats { opacity: .55; }
.host-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.m label { display: block; font-size: 11px; color: var(--text-3); letter-spacing: .04em; white-space: nowrap; }
.m b { display: block; font: 600 22px/1.4 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.m b small { font-size: 11px; color: var(--text-3); font-weight: 500; margin-left: 1px; }
.spark { width: 100%; height: 42px; display: block; }
.host-net { display: flex; gap: 14px; font: 12px/18px var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; flex-wrap: wrap; min-height: 18px; }
.host-net i { font-style: normal; margin-right: 3px; }
.v-link { color: var(--link); font: 12px/18px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.m b.warm { color: var(--warn); } .m b.hot { color: var(--bad); }

/* 流量配额条 */
.quota-box { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; }
.quota-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.q-used { color: var(--text); font-weight: 600; }
.q-rem { color: var(--text-2); }
.quota-box .bar.thin { margin-top: 2px; }
.q-bar { background: var(--ok); }
.q-bar.quota-ok { background: var(--ok); }
.q-bar.quota-warn { background: var(--warn); }
.q-bar.quota-bad { background: var(--bad); }
.quota-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--text-3); flex-wrap: wrap; }
.q-badge { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 10px; border: 1px solid var(--line-strong); color: var(--text-2); margin-left: 4px; }
.q-badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.q-badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.bar { height: 4px; border-radius: 4px; background: var(--bar-track); overflow: hidden; margin-top: 5px; }
.bar span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .4s ease; }
.bar.thin { height: 3px; margin-top: 8px; }
.cpu { background: var(--cpu); } .gpu { background: var(--gpu); } .mem { background: var(--mem); }
.temp { background: var(--text-3); } .temp.warm { background: var(--warn); } .temp.hot { background: var(--bad); }
.rx { background: var(--rx); } .tx { background: var(--tx); } .link { background: var(--link); } .cap { background: var(--text-3); } .cap.full { background: var(--bad); }
.gpu.warn { background: var(--warn); } .gpu.bad { background: var(--bad); }
.rx-text { color: var(--rx); } .tx-text { color: var(--tx); }

.notice { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); color: var(--text); font-size: 13px; }

/* 详情 */
.detail { margin-top: 20px; scroll-margin-top: 90px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.eyebrow { font-size: 13px; color: var(--text-2); white-space: nowrap; }
h1 { margin: 0; font-size: 22px; font-weight: 680; letter-spacing: -.01em; white-space: nowrap; }
.machine-line { margin: 0; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.machine-line::before { content: "·"; margin-right: 10px; color: var(--text-3); }
.detail-state { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; margin-left: 6px; }
.detail[data-status="offline"] .detail-state, .detail[data-status="error"] .detail-state { color: var(--bad); }
.detail[data-status="paused"] .detail-state { color: var(--warn); }
.detail-body, .performance, .storage { min-width: 0; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.stat { padding: 14px 18px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat header { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat header em { margin-left: auto; font-style: normal; font-weight: 400; color: var(--text-3); font-size: 12px; text-align: right; }
.chip { width: 8px; height: 8px; border-radius: 2px; }
.big { font: 600 34px/1.2 var(--mono); font-variant-numeric: tabular-nums; margin: 10px 0 2px; white-space: nowrap; }
.big small { font-size: 15px; color: var(--text-3); margin-left: 3px; font-weight: 500; }
.stat footer { margin-top: 9px; font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.stat footer span { color: var(--text-2); }
.stat footer span.warm { color: var(--warn); } .stat footer span.hot { color: var(--bad); }
.net-pair { display: grid; gap: 2px; margin: 8px 0 0; }
.net-pair div { display: flex; align-items: baseline; gap: 8px; }
.net-pair i { font-style: normal; font-weight: 700; width: 12px; }
.net-pair strong { font: 600 22px/1.25 var(--mono); font-variant-numeric: tabular-nums; }
.net-pair strong small { font-size: 12px; color: var(--text-3); margin-left: 3px; font-weight: 500; }
#link-line b { color: var(--link); font-weight: 500; font-family: var(--mono); }

.charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.panel { padding: 16px 18px 10px; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 28px; }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 620; }
.legend { margin-left: auto; display: flex; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; }
.chart-wrap { position: relative; height: clamp(200px, 23vh, 420px); margin-top: 6px; font-size: 11px; }
.chart-wrap.small { height: clamp(120px, 12vh, 200px); font-size: 10px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 9px; font-size: 12px; min-width: 130px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 2; }
.chart-tooltip div { display: flex; justify-content: space-between; gap: 12px; }
.chart-tooltip strong { font-family: var(--mono); font-weight: 600; }
.tooltip-time { color: var(--text-3); margin-bottom: 3px; }
.tooltip-peak { color: var(--text-3); font-size: 11px; }
.history-info { margin: 8px 2px 0; font-size: 12px; color: var(--text-3); }

.disk-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.disk-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.hint { color: var(--text-3); font-size: 12px; }
.disk-head .seg { margin-left: auto; }
.disk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.disk { padding: 16px; }
.disk.offline { background: var(--panel-2); border-style: dashed; }
.disk-top { display: flex; align-items: flex-start; gap: 8px; }
.disk-title { min-width: 0; flex: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.disk-title h3 { margin: 0; font-size: 14px; font-weight: 620; overflow-wrap: anywhere; }
.disk-device { font: 11px var(--mono); color: var(--text-3); }
.disk-type { font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.disk-temp { font: 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.disk-temp.warm { color: var(--warn); } .disk-temp.hot { color: var(--bad); } .disk-temp.na { display: none; color: var(--text-3); font-family: var(--sans); font-size: 11px; }
.storage[data-mode="temperature"] .disk-temp.na { display: inline; }
.storage[data-mode="temperature"] .disk.no-temp { opacity: .6; }
.disk-rates { display: grid; grid-template-columns: repeat(2, minmax(0, 230px)); gap: 8px; margin-top: 10px; }
.disk-rates label { font-size: 11px; font-weight: 600; margin-right: 6px; }
.disk-rates strong { font: 600 17px var(--mono); font-variant-numeric: tabular-nums; }
.disk-rates strong small { font-size: 11px; color: var(--text-3); margin-left: 2px; font-weight: 500; }
.disk-rates .sub { display: block; font: 11px/1.5 var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.disk-rates .sub b { font-weight: 500; color: var(--text-2); }
.disk-rates .sub b:not(:empty)::before { content: " · "; color: var(--text-3); font-weight: 400; }
.disk-rates .sub b.slow { color: var(--bad); font-weight: 600; }
.disk-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.disk-foot b { font-family: var(--mono); font-weight: 600; color: var(--text-2); }
.empty-card { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.note { font-size: 12px; color: var(--text-3); margin: 10px 2px 0; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

/* 登录页 */
.login-shell { min-height: 100vh; display: flex; flex-direction: column; }
.login-main { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 390px; padding: 28px 26px 24px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card h1 { font-size: 20px; }
.login-sub { margin: 0 0 20px; color: var(--text-2); font-size: 13px; }
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.login-field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { width: 100%; padding: 10px 64px 10px 12px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--panel-2); color: var(--text); font: 14px var(--mono); }
.pw-wrap input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-toggle { position: absolute; right: 6px; border: 0; background: transparent; color: var(--text-2); font-size: 12px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--panel); }
.login-error { margin: 0 0 14px; padding: 9px 12px; border-radius: 9px; font-size: 13px;
  background: color-mix(in srgb, var(--bad) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); }
.primary-button { width: 100%; padding: 10px 16px; min-height: 42px; border: 0; border-radius: 9px; background: var(--accent);
  color: #ffffff; font-weight: 600; cursor: pointer; transition: opacity .15s; }
.primary-button:hover { opacity: .92; }
.primary-button:disabled { opacity: .6; cursor: wait; }

@media (min-width: 1800px) {
  .detail-body[data-layout="split"] { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .detail-body[data-layout="split"] .performance { position: sticky; top: 88px; }
  .detail-body[data-layout="split"] .charts { grid-template-columns: minmax(0, 1fr); }
  .detail-body[data-layout="split"] .chart-wrap:not(.small) { height: clamp(190px, 20vh, 300px); }
  .detail-body[data-layout="split"] .chart-wrap.small { height: 120px; }
  .detail-body[data-layout="split"] .disk-head { margin-top: 0; min-height: 40px; }
}
@media (min-width: 3600px) {
  body { font-size: 16px; }
  .host { padding: 24px; }
  .host-name { font-size: 24px; }
  .m b { font-size: 30px; }
  .spark { height: 64px; }
  .host-model, .host-net, .host-age, .host-kind, .v-link { font-size: 15px; }
  .host-sub, .host-net, .v-link { min-height: 22px; line-height: 22px; }
  .chart-wrap { font-size: 14px; }
  .chart-wrap.small { font-size: 12px; }
  .detail-body[data-layout="split"] .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-body[data-layout="split"] .chart-wrap:not(.small) { height: 340px; }
  .detail-body[data-layout="split"] .disk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .big { font-size: 44px; }
}
@media (max-width: 1439px) { .host-kind { display: none; } }
@media (max-width: 1100px) { .fleet { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .seg button, .seg.small button { min-height: 44px; min-width: 44px; }
  .icon-button, .ghost-button { min-height: 44px; min-width: 44px; }
  .brand { min-height: 44px; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  main { padding: 16px 12px 24px; }
  .topbar { display: grid; grid-template-columns: 1fr auto; padding: 6px 12px 8px; gap: 4px 8px; }
  .top-right { display: contents; }
  .conn { grid-column: 2; grid-row: 1; justify-self: end; }
  .theme-switch { grid-column: 1; grid-row: 2; justify-self: start; }
  #fullscreen { display: none; }
  #logout-btn { grid-column: 2; grid-row: 2; justify-self: end; min-width: 60px; padding: 6px 10px; }
  .clock { display: none; }
  .fleet { gap: 10px; }
  .host { padding: 12px; gap: 10px; }
  .host-top { flex-wrap: wrap; gap: 6px; }
  .host-name { font-size: 16px; }
  .host-age { width: 100%; margin: -4px 0 0 14px; font-size: 11px; }
  .host-sub { flex-wrap: wrap; height: auto; min-height: 18px; }
  .host-model, .v-link { font-size: 11px; }
  .detail-state { width: 100%; margin-left: 0; }
  .machine-line { width: 100%; }
  .machine-line::before { content: none; }
  .host-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .m label { font-size: 10px; letter-spacing: 0; }
  .m b { font-size: 18px; }
  .host .bar { display: none; }
  .host .quota-box .bar { display: block; }
  .spark { height: 24px; }
  .host-net { gap: 5px 10px; font-size: 11px; }
  .host-net > span { white-space: nowrap; }
  .detail { margin-top: 24px; }
  .detail-head { gap: 12px; }
  .controls { width: 100%; gap: 8px; }
  .controls > .seg { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .controls .seg button { padding: 5px 2px; font-size: 12px; }
  .controls .ghost-button { min-width: 66px; padding: 6px; font-size: 12px; }
  .stat { padding: 14px 12px; }
  .stat header { gap: 5px; flex-wrap: wrap; }
  .stat header em { font-size: 11px; }
  .stat footer { gap: 4px; }
  .big { font-size: 28px; }
  .net-pair strong { font-size: 19px; }
  h1 { font-size: 20px; }
  .panel { padding: 12px; }
  .panel-head { gap: 8px; }
  .panel-head .legend { width: 100%; margin: 2px 0; }
  .chart-wrap { height: 200px; }
  .disk-grid { grid-template-columns: minmax(0, 1fr); }
  .disk-head { gap: 8px; }
  .disk-head .seg { margin-left: 0; }
  .foot { line-height: 1.7; }
}
@media (prefers-reduced-motion: reduce) {
  *, .theme-switching, .theme-switching * { transition: none !important; scroll-behavior: auto !important; }
}
