/* NAS Hub web console — visual language
 *
 * Calm home-server console: neutral cool-grey surfaces, ONE accent (indigo, "Ban Mai" dawn sky)
 * used only for interaction and the primary data series. Status never relies on colour alone:
 * every state pill carries an icon whose SHAPE differs (dot = chạy, square = dừng, clock = chờ,
 * spinner = đang chuyển, triangle = cảnh báo, octagon = lỗi, question = chưa rõ) plus text.
 *
 * Type: system UI stack (Segoe UI Variable / SF / Roboto / Noto), never embedded. Scale
 * 12 · 13 · 14 (base) · 16 · 20 · 24 · 32 px; big tabular numbers for values that matter, quiet 12–13 px
 * labels. Line-height ≥ 1.35 on headings so Vietnamese stacked diacritics (ễ, ậ, ỗ) never clip.
 * Space: 8 px grid (4 for hairline nudges). Radii: 6 controls · 12 cards · 999 pills.
 * Elevation: light theme uses soft two-layer shadows; dark theme uses lighter surfaces + hairline
 * borders instead of shadows (shadows vanish on dark), and desaturated, lighter status hues.
 * Motion: 120–200 ms on transform/opacity, ease-out; gauges move their stroke once per value change.
 * prefers-reduced-motion turns all of it off. Text contrast ≥ WCAG AA (4.5:1) in both themes.
 */

/* ------------------------------------------------------------------ tokens */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Roboto", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", "Roboto Mono", "Noto Sans Mono", monospace;
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 24px; --t-3xl: 32px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  --fast: 120ms; --med: 180ms; --slow: 600ms; --ease: cubic-bezier(.2, .7, .2, 1);
  --side-w: 236px; --top-h: 56px; --tab-h: 64px;

  --bg: #f3f4f7; --surface: #ffffff; --surface-2: #f8f9fb; --sunken: #eceef3; --hover: #f0f2f6;
  --line: #e2e5eb; --line-strong: #cdd2db;
  --text: #161a23; --text-2: #465062; --text-3: #5f6879;
  --accent: #4453d6; --accent-hi: #3442bf; --accent-soft: #eceefe; --accent-text: #3a48c8; --on-accent: #ffffff;
  --ok: #12733a; --ok-bg: #e6f5eb; --warn: #8f5100; --warn-bg: #fcf0d9; --fail: #be2530; --fail-bg: #fdeaea;
  --wait: #0b6a90; --wait-bg: #e2f1f8; --off: #5b6375; --off-bg: #eceef2;
  --c1: #4453d6; --c2: #0f8f84; --c3: #d4483b;
  --ring: 0 0 0 3px rgba(68, 83, 214, .35);
  --sh-1: 0 1px 2px rgba(20, 25, 40, .06), 0 1px 1px rgba(20, 25, 40, .04);
  --sh-2: 0 4px 12px rgba(20, 25, 40, .08), 0 1px 3px rgba(20, 25, 40, .06);
  --sh-3: 0 16px 40px rgba(20, 25, 40, .16), 0 4px 12px rgba(20, 25, 40, .08);
  --scrim: rgba(18, 22, 32, .38);
  --log-bg: #fbfbfd;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --surface: #161b23; --surface-2: #1b212b; --sunken: #11151c; --hover: #202734;
    --line: #262e3b; --line-strong: #364052;
    --text: #e6e9ef; --text-2: #b3bbc8; --text-3: #8e98aa;
    --accent: #8b97ff; --accent-hi: #a4aeff; --accent-soft: rgba(139, 151, 255, .14); --accent-text: #a9b2ff; --on-accent: #0e1117;
    --ok: #63d394; --ok-bg: rgba(99, 211, 148, .12); --warn: #f2b85c; --warn-bg: rgba(242, 184, 92, .12); --fail: #ff8b90; --fail-bg: rgba(255, 139, 144, .12);
    --wait: #6cc7ef; --wait-bg: rgba(108, 199, 239, .12); --off: #9ba4b5; --off-bg: rgba(155, 164, 181, .12);
    --c1: #8b97ff; --c2: #45cbb9; --c3: #ff8a76;
    --ring: 0 0 0 3px rgba(139, 151, 255, .45);
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .02); --sh-2: 0 6px 18px rgba(0, 0, 0, .35); --sh-3: 0 18px 48px rgba(0, 0, 0, .55);
    --scrim: rgba(0, 0, 0, .55);
    --log-bg: #10141a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --surface: #161b23; --surface-2: #1b212b; --sunken: #11151c; --hover: #202734;
  --line: #262e3b; --line-strong: #364052;
  --text: #e6e9ef; --text-2: #b3bbc8; --text-3: #8e98aa;
  --accent: #8b97ff; --accent-hi: #a4aeff; --accent-soft: rgba(139, 151, 255, .14); --accent-text: #a9b2ff; --on-accent: #0e1117;
  --ok: #63d394; --ok-bg: rgba(99, 211, 148, .12); --warn: #f2b85c; --warn-bg: rgba(242, 184, 92, .12); --fail: #ff8b90; --fail-bg: rgba(255, 139, 144, .12);
  --wait: #6cc7ef; --wait-bg: rgba(108, 199, 239, .12); --off: #9ba4b5; --off-bg: rgba(155, 164, 181, .12);
  --c1: #8b97ff; --c2: #45cbb9; --c3: #ff8a76;
  --ring: 0 0 0 3px rgba(139, 151, 255, .45);
  --sh-1: 0 0 0 1px rgba(255, 255, 255, .02); --sh-2: 0 6px 18px rgba(0, 0, 0, .35); --sh-3: 0 18px 48px rgba(0, 0, 0, .55);
  --scrim: rgba(0, 0, 0, .55);
  --log-bg: #10141a;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--t-md)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 650; letter-spacing: -.005em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .92em; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 11px; line-height: 1.5; text-align: center; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.quiet { color: var(--text-3); }
.sub { color: var(--text-3); font-size: var(--t-sm); }
.small { font-size: var(--t-xs); }
.strong { font-weight: 600; color: var(--text); }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.min0 { min-width: 0; }
.grow { flex: 1 1 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.t-fail { color: var(--fail); } .t-warn { color: var(--warn); } .t-wait { color: var(--wait); } .t-ok { color: var(--ok); }
.skip { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: var(--r); transition: top var(--fast); }
.skip:focus { top: 8px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.inline { width: 14px; height: 14px; vertical-align: -2px; }
.boot { display: flex; gap: 12px; align-items: center; justify-content: center; min-height: 60vh; color: var(--text-3); }
.boot-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); animation: breathe 1.4s var(--ease) infinite alternate; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--top-h) auto; min-height: 100vh; min-height: 100dvh; }
.side { grid-row: 1 / 3; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 6px 8px 14px; color: var(--text); border-bottom: 1px solid var(--line); margin-bottom: var(--s2); }
.brand:hover { text-decoration: none; }
.brand-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.brand-t strong { font-size: var(--t-lg); }
.brand-t small { color: var(--text-3); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, var(--accent), var(--accent-hi)); color: var(--on-accent); flex: none; box-shadow: var(--sh-1); }
.logo .ic { width: 20px; height: 20px; }
.logo.sm { width: 28px; height: 28px; border-radius: 8px; } .logo.sm .ic { width: 16px; height: 16px; }
.logo.lg { width: 44px; height: 44px; border-radius: 12px; } .logo.lg .ic { width: 24px; height: 24px; }
.logo.xl { width: 56px; height: 56px; border-radius: 16px; } .logo.xl .ic { width: 30px; height: 30px; }
.nav { display: flex; flex-direction: column; flex: 1; }
.nav-main { display: flex; flex-direction: column; gap: 2px; }
.nav-phone { display: none; }
.nav-a { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 8px 12px; border-radius: var(--r); color: var(--text-2); font-weight: 500; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; transition: background var(--fast), color var(--fast); }
.nav-a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-a[aria-current="page"], .nav-a.current { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-a .ic { width: 20px; height: 20px; }
.nav-apps { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.nav-group { padding: 0 12px 4px; color: var(--text-3); font-size: var(--t-xs); font-weight: 600; }
.nav-a.muted { color: var(--text-3); }
.nav-off { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--off); flex: none; }
.btn.primary-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn.primary-soft:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.side-foot { margin-top: auto; }
.kbd-hint { width: 100%; justify-content: flex-start; color: var(--text-3); }
.kbd-hint kbd { margin-left: auto; }

.topbar { grid-column: 2; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); height: var(--top-h); padding: 0 var(--s6); background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); }
.top-host { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-size: var(--t-md); color: var(--text-2); }
.top-host .logo { display: none; }
.top-host strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: var(--s1); }
.conn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: var(--t-xs); font-weight: 500; margin-right: var(--s2); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.conn .dot.up { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.conn[data-state="down"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.conn[data-state="down"] .dot { background: transparent; border: 2px solid var(--warn); animation: breathe 1s ease-in-out infinite alternate; }
.conn[data-state="paused"] .dot { background: transparent; border: 2px solid var(--off); }
.jobs-btn { position: relative; }
.jobs-btn.active { color: var(--accent-text); }
.jobs-btn.active .ic { animation: wiggle 1.6s var(--ease) infinite; }
.jobs-n:not(:empty) { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.account { gap: 8px; padding-left: 6px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.avatar .ic { width: 16px; height: 16px; }
.account .chev { width: 14px; height: 14px; color: var(--text-3); }

#view { grid-column: 2; min-width: 0; padding: var(--s5) var(--s6) var(--s7); outline: none; }
.page-body { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s4); animation: page-in var(--med) var(--ease) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s2) 0 var(--s1); }
.page-head h1 { outline: none; }
.lead { color: var(--text-2); font-size: var(--t-md); margin-top: 2px; }
.page-actions { display: flex; gap: var(--s2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); }
.section-head h2, .group-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lg); }
.section-head h2 .ic, .group-title .ic { color: var(--text-3); }
.count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--sunken); color: var(--text-2); font-size: var(--t-xs); font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.section-head .count { margin-left: 2px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) var(--s5); box-shadow: var(--sh-1); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); min-height: 28px; }
.card-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-md); font-weight: 650; color: var(--text); }
.card-title .ic { color: var(--text-3); width: 18px; height: 18px; }
section.card > .card-title { margin-bottom: var(--s3); }
.callout { display: flex; gap: var(--s2); align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); color: var(--text); font-size: var(--t-sm); }
.callout .ic { margin-top: 1px; color: var(--accent-text); }
.callout.warn { background: var(--warn-bg); } .callout.warn .ic { color: var(--warn); }
.callout.fail { background: var(--fail-bg); } .callout.fail .ic { color: var(--fail); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; font-size: var(--t-md); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: var(--t-md); line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast), box-shadow var(--fast); }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { background: var(--fail); border-color: var(--fail); color: #fff; }
:root[data-theme="dark"] .btn.danger { color: #1a0d0e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #1a0d0e; } }
.btn.danger:hover { filter: brightness(1.08); }
.btn.danger-soft { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 35%, var(--line)); }
.btn.danger-soft:hover { background: var(--fail-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn.icon-only { padding: 0; width: 36px; min-width: 36px; }
.btn.sm.icon-only { width: 30px; min-width: 30px; }
.btn.block { width: 100%; min-height: 44px; font-size: var(--t-lg); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) transparent; animation: spin .8s linear infinite; }
.btn.primary.busy::after { border-color: var(--on-accent) transparent var(--on-accent) transparent; }
.viewer .w { display: none !important; }

/* ------------------------------------------------------------------ pills, tags, chips */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px 0 7px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; background: var(--off-bg); color: var(--off); line-height: 1; }
.pill .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.fail { background: var(--fail-bg); color: var(--fail); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.off, .pill.unknown { background: var(--off-bg); color: var(--off); }
.ic.filled path { fill: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--sunken); color: var(--text-2); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.fail { background: var(--fail-bg); color: var(--fail); }
.tag .ic { width: 13px; height: 13px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: var(--t-xs); font-family: var(--mono); white-space: nowrap; }
a.chip:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.chip.port .pdot { width: 7px; height: 7px; border-radius: 50%; }
.chip.port.on .pdot { background: var(--ok); }
.chip.port.off .pdot { border: 1.5px solid var(--off); }
.chip.port.off { color: var(--text-3); }
.btnchip { cursor: pointer; font-family: var(--font); transition: border-color var(--fast), background var(--fast); }
.btnchip:hover { border-color: var(--accent); }
.btnchip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btnchip .count { background: transparent; padding: 0 0 0 2px; min-width: 0; color: var(--text-3); }
.chips-inline { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: var(--t-sm); font-weight: 550; cursor: pointer; transition: background var(--fast), color var(--fast), box-shadow var(--fast); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.seg button .ic { width: 15px; height: 15px; }
.seg .count { background: var(--line); min-width: 20px; line-height: 18px; }
.seg button[aria-pressed="true"] .count { background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------------ forms */
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  min-height: 38px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text); width: 100%; transition: border-color var(--fast), box-shadow var(--fast);
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder { color: var(--text-3); opacity: 1; }
select { padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: right 15px top 50%, right 10px top 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
input.mono { font-family: var(--mono); font-size: 13px; }
input.narrow { max-width: 180px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .set-label { font-weight: 600; font-size: var(--t-sm); color: var(--text); }
.help, .hint { color: var(--text-3); font-size: var(--t-xs); line-height: 1.45; }
.formerr { display: flex; gap: 6px; align-items: flex-start; color: var(--fail); font-size: var(--t-sm); }
.formerr:empty { display: none; }
.formerr .ic { width: 16px; height: 16px; margin-top: 1px; }
.search-wrap { position: relative; display: flex; align-items: center; min-width: 220px; }
.search-wrap > .ic { position: absolute; left: 11px; color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.search-wrap input { padding-left: 34px; padding-right: 36px; }
.search-k { position: absolute; right: 9px; pointer-events: none; }
.search-wrap input:focus ~ .search-k, .search-wrap input:not(:placeholder-shown) ~ .search-k { display: none; }
.find-n { position: absolute; right: 12px; color: var(--text-3); font-size: var(--t-xs); pointer-events: none; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.input-clear { position: relative; display: flex; align-items: center; }
.input-clear .btn { position: absolute; right: 4px; }
/* switch */
input.switch { appearance: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: var(--line-strong); cursor: pointer; transition: background var(--med) var(--ease); flex: none; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform var(--med) var(--ease); }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { box-shadow: var(--ring); outline: none; }
input.switch:disabled { opacity: .5; cursor: default; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 2px; top: 1px; }
.pw-eye[aria-pressed="true"] { color: var(--accent-text); }

/* ------------------------------------------------------------------ tables */
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.card .tblwrap { border: 0; border-radius: 0; margin: 0 calc(-1 * var(--s5)) calc(-1 * var(--s4)); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.tbl th { text-align: left; font-weight: 600; font-size: var(--t-xs); color: var(--text-3); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; text-transform: none; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl th:first-child, .tbl td:first-child { padding-left: var(--s5); }
.tblwrap.sticky { overflow: visible; }
.tblwrap.sticky .tbl thead th { position: sticky; top: var(--top-h); z-index: 2; }
.tblwrap.sticky .tbl thead th:first-child { border-top-left-radius: var(--r-lg); }
.tblwrap.sticky .tbl thead th:last-child { border-top-right-radius: var(--r-lg); }
.sorter { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; margin: -2px -4px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 4px; }
.sorter:hover { color: var(--text); }
.sorter .sort-ic { width: 13px; height: 13px; opacity: 0; transition: opacity var(--fast), transform var(--fast); }
.sorter:hover .sort-ic { opacity: .5; }
.sorter.on { color: var(--accent-text); }
.sorter.on .sort-ic { opacity: 1; }
.row-fail td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
.cell-name { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.cell-name .sub { max-width: 360px; }
.kind-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--sunken); color: var(--text-3); flex: none; }
.kind-ic .ic { width: 16px; height: 16px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.memcell { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.timer-cell { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.svc td:nth-child(1) { max-width: 300px; }
.svc .cell-name .sub { max-width: 240px; }
.svc .memcell { min-width: 96px; }
.svc td, .svc th { padding-left: 10px; padding-right: 10px; }
.svc td:last-child { width: 1%; white-space: nowrap; }
.path { display: inline-block; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ------------------------------------------------------------------ meters, gauges */
.bar { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.bar.thin { height: 5px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left center; transition: transform var(--slow) var(--ease), background var(--med); }
.bar[data-tone="ok"] > i { background: var(--accent); }
.bar[data-tone="warn"] > i { background: var(--warn); }
.bar[data-tone="fail"] > i { background: var(--fail); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.meter-label { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; }
.meter-pct { font-weight: 650; font-size: var(--t-md); }
.meter-sub { color: var(--text-2); font-size: var(--t-xs); }
.gauge { position: relative; display: inline-grid; place-items: center; flex: none; }
.gauge svg { display: block; }
.g-track, .g-val { fill: none; stroke-width: 10; stroke-linecap: round; }
.g-track { stroke: var(--sunken); }
.g-val { stroke: var(--accent); transition: stroke-dashoffset var(--slow) var(--ease), stroke var(--med); }
.g-val.snap { transition: none; }
.gauge[data-tone="warn"] .g-val { stroke: var(--warn); }
.gauge[data-tone="fail"] .g-val { stroke: var(--fail); }
.gauge[data-tone="unknown"] .g-val { stroke: var(--off); }
.g-center { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 44%; gap: 2px; transform: translateY(-22%); }
.g-num { font-size: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.g-unit { font-size: var(--t-sm); color: var(--text-3); font-weight: 600; }
.gauge.sm .g-num { font-size: 17px; }
.gauge.sm .g-unit { font-size: 10px; }
.gauge.sm .g-track, .gauge.sm .g-val { stroke-width: 12; }
.gauge[data-tone="warn"]::after, .gauge[data-tone="fail"]::after { content: "!"; position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--surface); background: var(--warn); }
.gauge[data-tone="fail"]::after { background: var(--fail); border-radius: 5px; }
.progress { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transform-origin: left center; transition: transform 400ms var(--ease); }
.progress.indet > i { width: 35%; animation: indet 1.3s ease-in-out infinite; }

/* ------------------------------------------------------------------ dashboard */
.hero { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s5); background: linear-gradient(120deg, var(--surface) 55%, var(--accent-soft)); }
.hero-main { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.hero-t { min-width: 0; }
.hero-t h1 { font-size: var(--t-3xl); line-height: 1.25; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; color: var(--text-2); font-size: var(--t-sm); }
.hero-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .ic { width: 15px; height: 15px; color: var(--text-3); }
.hero-side { display: flex; align-items: center; gap: var(--s3); }
.hero-status .pill { height: 32px; padding: 0 14px 0 10px; font-size: var(--t-sm); }
.hero-status .pill .ic { width: 17px; height: 17px; }
.attention { border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--warn-bg); padding: var(--s3) var(--s4); animation: slide-in var(--med) var(--ease) both; }
.attention:has(.att.fail) { border-color: color-mix(in srgb, var(--fail) 40%, var(--line)); background: var(--fail-bg); }
.attention-t { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); text-transform: none; margin-bottom: 6px; }
.attention ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.att { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 8px; border-radius: var(--r); }
.att:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.att-ic { display: inline-grid; color: var(--warn); }
.att.fail .att-ic { color: var(--fail); }
.att-t { flex: 1; min-width: 0; }
.att-a { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }
.att-a .ic { width: 14px; height: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.stat { display: flex; flex-direction: column; contain: layout paint; }
.stat-body { display: flex; flex-direction: column; align-items: center; gap: var(--s3); flex: 1; }
.stat-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: 100%; font-size: var(--t-sm); }
.stat-sub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.stat-side > .kvs { flex-direction: row; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px dashed var(--line); }
.kvs strong { overflow-wrap: anywhere; }
.kvs { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.kvs > span:first-child { color: var(--text-3); font-size: var(--t-xs); }
.kvs strong, .kvs > span:last-child { font-weight: 600; color: var(--text); }
.swap { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.swap .kvs { flex-direction: row; justify-content: space-between; }
.net-rows { display: flex; flex-direction: column; gap: var(--s3); }
.net-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: var(--s3); align-items: center; }
.net-k { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--t-xs); }
.net-k .ic { width: 14px; height: 14px; }
.net-row.c1 .net-k .ic { color: var(--c1); } .net-row.c2 .net-k .ic { color: var(--c2); }
.net-n { grid-row: 2; font-size: var(--t-xl); font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.spark { grid-row: 1 / 3; grid-column: 2; width: 96px; height: 34px; }
.spark-line { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { opacity: .14; }
.spark.c1 .spark-line { stroke: var(--c1); } .spark.c1 .spark-area { fill: var(--c1); }
.spark.c2 .spark-line { stroke: var(--c2); } .spark.c2 .spark-area { fill: var(--c2); }
.ifaces { list-style: none; margin: var(--s3) 0 0; padding: var(--s3) 0 0; border-top: 1px dashed var(--line); display: grid; gap: 4px; font-size: var(--t-sm); }
.ifaces li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: center; }
.ifaces li.down { color: var(--text-3); }
.if-dot { width: 8px; height: 8px; border-radius: 50%; }
.if-dot.up { background: var(--ok); }
.if-dot.down { border: 1.5px solid var(--off); }
.fslist { display: grid; gap: var(--s4); }
/* module tiles */
.modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: var(--s3); }
.modtile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease), border-color var(--med); min-width: 0; }
.modtile:hover, .modtile:focus-within { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-strong); }
.modtile.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.modtile.fail { border-color: color-mix(in srgb, var(--fail) 50%, var(--line)); background: linear-gradient(180deg, var(--fail-bg), var(--surface) 60%); }
.modtile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.modtile-name { font-size: var(--t-lg); line-height: 1.35; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modtile-name a { color: var(--text); }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.stretch:hover { text-decoration: none; }
.stretch:focus-visible { outline: none; }
.stretch:focus-visible::after { box-shadow: var(--ring); }
.modtile-state { display: flex; gap: 6px; flex-wrap: wrap; }
.modtile-note { color: var(--text-2); font-size: var(--t-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; line-height: 1.45; }
.modtile-note.warn { color: var(--warn); } .modtile-note.fail { color: var(--fail); }
.modtile-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); min-height: 40px; }
.modtile-mem { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-sm); color: var(--text-2); }
.modtile-mem .ic { width: 15px; height: 15px; color: var(--text-3); }
.quick { position: relative; z-index: 1; display: flex; gap: 2px; opacity: 0; transform: translateX(4px); transition: opacity var(--med), transform var(--med) var(--ease); }
.modtile:hover .quick, .modtile:focus-within .quick { opacity: 1; transform: none; }
@media (hover: none) { .quick { opacity: 1; transform: none; } }
.modicon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.modicon .ic { width: 21px; height: 21px; }
.modicon.sm { width: 32px; height: 32px; border-radius: 9px; } .modicon.sm .ic { width: 17px; height: 17px; }
.modicon.lg { width: 56px; height: 56px; border-radius: 15px; } .modicon.lg .ic { width: 28px; height: 28px; }
/* category tints: hue only for recognition; the label is always next to it */
.modicon[data-cat="gia-dinh"] { background: color-mix(in srgb, #e3843a 15%, var(--surface)); color: color-mix(in srgb, #c2611a 80%, var(--text)); }
.modicon[data-cat="phim"] { background: color-mix(in srgb, #c0449a 14%, var(--surface)); color: color-mix(in srgb, #a83388 80%, var(--text)); }
.modicon[data-cat="mang"] { background: color-mix(in srgb, #1f8fc4 15%, var(--surface)); color: color-mix(in srgb, #157aa9 80%, var(--text)); }
.modicon[data-cat="he-thong"] { background: color-mix(in srgb, #6b7487 16%, var(--surface)); color: var(--text-2); }
.modicon[data-cat="tai-file"], .modicon[data-cat="tai-ve"] { background: color-mix(in srgb, #2a9d6a 15%, var(--surface)); color: color-mix(in srgb, #1e8457 80%, var(--text)); }
.modicon[data-cat="an-ninh"] { background: color-mix(in srgb, #c94848 14%, var(--surface)); color: color-mix(in srgb, #b13a3a 80%, var(--text)); }
.modicon[data-cat="chia-se"] { background: color-mix(in srgb, #7a5bd0 15%, var(--surface)); color: color-mix(in srgb, #6446bb 80%, var(--text)); }
.sdot { position: relative; width: 10px; height: 10px; border-radius: 50%; margin: 6px 2px; }
.sdot.t-ok { background: var(--ok); } .sdot.t-warn { background: var(--warn); border-radius: 2px; transform: rotate(45deg); }
.sdot.t-fail { background: var(--fail); border-radius: 2px; } .sdot.t-off { border: 2px solid var(--off); }
.sdot.live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: pulse 2.4s var(--ease) 3; }
.modtile:hover .sdot.live::after { animation: pulse 2.4s var(--ease) infinite; }
/* charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); transition: opacity var(--med); }
.charts.loading { opacity: .55; }
.chartcard { margin: 0; padding-bottom: var(--s3); contain: layout; }
.chartcard .card-head { flex-wrap: wrap; }
.chartwrap { position: relative; }
.chart { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart .grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .grid line.base { stroke: var(--line-strong); stroke-dasharray: none; }
.chart .axis, .chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.c1, .dot.c1 { stroke: var(--c1); } .chart .line.c2, .dot.c2 { stroke: var(--c2); } .chart .line.c3, .dot.c3 { stroke: var(--c3); }
.chart .dot { fill: var(--surface); stroke-width: 2.5; }
.st-top { stop-opacity: .28; } .st-bot { stop-opacity: 0; }
.st-top.c1, .st-bot.c1 { stop-color: var(--c1); } .st-top.c2, .st-bot.c2 { stop-color: var(--c2); } .st-top.c3, .st-bot.c3 { stop-color: var(--c3); }
.chart .cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-xs); color: var(--text-3); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i, .tip-r i { width: 10px; height: 3px; border-radius: 2px; background: var(--c1); }
.lg.c2 i, .tip-r.c2 i { background: var(--c2); } .lg.c3 i, .tip-r.c3 i { background: var(--c3); }
.lg b { color: var(--text); font-size: var(--t-md); font-weight: 650; }
.tip { position: absolute; top: -6px; left: 0; z-index: 3; min-width: 120px; padding: 8px 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--sh-2); font-size: var(--t-xs); pointer-events: none; transform-origin: top; }
.tip-t { color: var(--text-3); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.tip-r { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip-r b { margin-left: auto; padding-left: 12px; font-weight: 650; }

/* ------------------------------------------------------------------ modules */
.modgroups { display: flex; flex-direction: column; gap: var(--s5); }
.group { display: flex; flex-direction: column; gap: var(--s3); }
.modlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s4); }
.mod { position: relative; display: flex; flex-direction: column; gap: var(--s3); transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease), border-color var(--med); }
.mod:hover { box-shadow: var(--sh-2); border-color: var(--line-strong); }
.mod.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.mod.fail { border-color: color-mix(in srgb, var(--fail) 50%, var(--line)); }
.mod-head { display: flex; gap: var(--s3); align-items: flex-start; }
.mod-title { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mod-title h3 { font-size: var(--t-lg); }
.mod-title h3 a { color: var(--text); }
.mod-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mod-desc { color: var(--text-2); font-size: var(--t-sm); }
.mod-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: var(--t-xs); color: var(--text-3); }
.meta { display: inline-flex; align-items: center; gap: 4px; }
.meta .ic { width: 14px; height: 14px; }
.mod-actions { position: relative; z-index: 1; display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); }
.mod-actions:empty { display: none; }
.modtable .cell-name .sub { max-width: 340px; }
.modtable a.strong { color: var(--text); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-3); }
.crumb a { display: inline-flex; align-items: center; gap: 2px; }
.crumb .ic { width: 15px; height: 15px; }
.detail-head-wrap { display: flex; flex-direction: column; gap: var(--s3); }
.detail-head { display: flex; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; padding: var(--s5); }
.detail-head.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.detail-head.fail { border-color: color-mix(in srgb, var(--fail) 50%, var(--line)); }
.detail-title { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.detail-title h1 { font-size: var(--t-2xl); }
.detail-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.tabs { position: sticky; top: var(--top-h); z-index: 5; display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 16px; border: 0; background: none; color: var(--text-2); font-weight: 550; cursor: pointer; white-space: nowrap; transition: color var(--fast); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform var(--med) var(--ease); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-text); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .ic { width: 16px; height: 16px; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.tabpanel { display: flex; flex-direction: column; gap: var(--s4); outline: none; animation: page-in var(--med) var(--ease) both; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.fact { display: flex; flex-direction: column; gap: 4px; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.fact-k { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--t-xs); }
.fact-k .ic { width: 14px; height: 14px; }
.fact-v { font-size: var(--t-lg); font-weight: 600; min-width: 0; }
.probes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.probe { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.probe:last-child { border-bottom: 0; }
.probe-b { display: flex; flex-direction: column; min-width: 0; }
.probe time { color: var(--text-3); font-size: var(--t-xs); white-space: nowrap; }
.actions-list { display: flex; flex-direction: column; }
.action-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.action-row:last-child { border-bottom: 0; }
.action-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--sunken); color: var(--text-2); }
.action-b { min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

/* ------------------------------------------------------------------ settings */
.setform { display: flex; flex-direction: column; gap: var(--s4); }
.set-groups { display: flex; flex-direction: column; gap: var(--s4); }
.set-group { padding-top: var(--s3); padding-bottom: var(--s2); }
.set-group > .card-title { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 0; }
.set-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s2) var(--s6); padding: var(--s4) 0; border-bottom: 1px solid var(--line); align-items: start; position: relative; }
.set-row:last-child { border-bottom: 0; }
.set-row.changed::before { content: ""; position: absolute; left: calc(-1 * var(--s5)); top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--warn); }
.set-row.invalid input, .set-row.invalid select { border-color: var(--fail); }
.set-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.set-label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.req { color: var(--fail); font-weight: 700; }
.set-ctl { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 460px; }
.set-row.is-bool .set-ctl { padding-top: 2px; }
.field-err { color: var(--fail); font-size: var(--t-xs); min-height: 0; }
.field-err:empty { display: none; }
.unit-input { display: flex; gap: var(--s2); }
.unit-input input { max-width: 160px; }
.unit-input select { width: auto; min-width: 88px; }
.savebar { position: sticky; bottom: var(--s4); z-index: 6; display: flex; align-items: center; gap: var(--s3); padding: 10px 12px 10px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--sh-3); animation: rise var(--med) var(--ease) both; }
.savebar-ic { color: var(--warn); display: inline-grid; }
.savebar-t { font-weight: 600; }

/* ------------------------------------------------------------------ logs */
.filters { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; padding: var(--s3) var(--s4); }
.filters .field.grow { flex: 1 1 260px; }
.filters .field:not(.grow) { flex: 0 1 190px; }
.log-quick { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.unit-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: var(--t-xs); }
.logview { display: flex; flex-direction: column; gap: var(--s2); }
.log-tools { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.log-tools .search-wrap { flex: 1 1 240px; }
.log-tools .search-wrap input { padding-right: 96px; }
.log-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.log-btns .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.logframe { position: relative; }
.logbox { height: min(64vh, 640px); overflow: auto; overscroll-behavior: contain; background: var(--log-bg); border: 1px solid var(--line); border-radius: var(--r-lg); font: 12.5px/1.6 var(--mono); padding: 6px 0; contain: content; }
.logview.compact .logbox { height: min(56vh, 520px); }
.ll { display: grid; grid-template-columns: 58px 92px minmax(90px, 160px) minmax(0, 1fr); gap: 0 12px; padding: 1px 14px 1px 0; border-left: 3px solid transparent; }
.logbox.no-unit .ll { grid-template-columns: 58px 92px minmax(0, 1fr); }
.logview.compact .ll { grid-template-columns: 58px 68px minmax(90px, 160px) minmax(0, 1fr); }
.logview.compact .logbox.no-unit .ll { grid-template-columns: 58px 68px minmax(0, 1fr); }
.ll:hover { background: var(--hover); }
.ll .lv { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: var(--text-3); align-self: start; margin-top: 2px; line-height: 1.5; border-radius: 3px; margin-left: 6px; }
.ll time { color: var(--text-3); white-space: nowrap; }
.ll .unit { color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ll .msg { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.ll.err { border-left-color: var(--fail); background: color-mix(in srgb, var(--fail-bg) 60%, transparent); }
.ll.err .lv { background: var(--fail); color: var(--surface); }
.ll.err .msg { color: var(--fail); }
.ll.warn { border-left-color: var(--warn); }
.ll.warn .lv { background: var(--warn-bg); color: var(--warn); }
.ll.warn .msg { color: var(--warn); }
.ll.note .lv { color: var(--accent-text); }
.ll.debug { color: var(--text-3); }
mark { background: color-mix(in srgb, #ffd54a 55%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.newpill { position: absolute; left: 50%; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: var(--t-sm); box-shadow: var(--sh-2); cursor: pointer; transform: translateX(-50%); animation: rise-c var(--med) var(--ease) both; }
.newpill .ic { width: 15px; height: 15px; }
.log-foot { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--t-xs); color: var(--text-3); flex-wrap: wrap; }
.log-status { display: inline-flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: breathe 1.2s ease-in-out 3 alternate; }
.log-empty, .log-loading { padding: var(--s3) var(--s4); display: grid; gap: 8px; font-family: var(--font); }

/* ------------------------------------------------------------------ storage */
.fsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.fs { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.fs-b { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--t-sm); }
.fs-t { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fs-n { font-size: var(--t-lg); font-weight: 600; }
.disks { display: flex; flex-direction: column; gap: var(--s4); }
.disk { display: flex; flex-direction: column; gap: var(--s3); }
.disk-head { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.disk-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--sunken); color: var(--text-2); flex: none; }
.disk-ic .ic { width: 28px; height: 28px; stroke-width: 1.5; }
.disk-t { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.disk-t h3 { font-size: var(--t-lg); }
.disk-model { font-weight: 450; color: var(--text-2); }
.disk-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.disk-size { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.big { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -.01em; }
.pbar { display: flex; gap: 3px; height: 30px; border-radius: var(--r); overflow: hidden; }
.pseg { display: flex; align-items: center; min-width: 6px; padding: 0 8px; color: #fff; font-size: var(--t-xs); font-weight: 600; overflow: hidden; white-space: nowrap; flex-basis: 0; transform-origin: left; animation: grow-x var(--slow) var(--ease) both; }
.pseg-t { overflow: hidden; text-overflow: ellipsis; }
.pseg.c0, .sw.c0 { background: var(--c1); } .pseg.c1, .sw.c1 { background: var(--c2); } .pseg.c2, .sw.c2 { background: #b26cd6; } .pseg.c3, .sw.c3 { background: #d98a2b; } .pseg.c4, .sw.c4 { background: #5d8fbf; }
.pseg.c0 { color: var(--on-accent); }
.pseg.free { background: repeating-linear-gradient(135deg, var(--sunken) 0 6px, var(--surface-2) 6px 12px); border: 1px dashed var(--line-strong); }
.parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s2) var(--s4); }
.part { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 8px 0; }
.sw { width: 12px; height: 12px; border-radius: 3px; }
.part-b { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.part-b .tag { margin-left: 6px; height: 20px; }
.part-n { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; }
.smart-d summary, .job-d summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent-text); font-weight: 600; font-size: var(--t-sm); list-style: none; padding: 4px 0; min-height: 32px; }
.smart-d summary::-webkit-details-marker, .job-d summary::-webkit-details-marker { display: none; }
.smart-d .chev, .job-d .chev { width: 15px; height: 15px; transition: transform var(--med) var(--ease); }
.smart-d[open] .chev, .job-d[open] .chev { transform: rotate(90deg); }
.smart { margin-top: var(--s2); padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: var(--r); }

/* ------------------------------------------------------------------ jobs, devices */
.joblist { display: flex; flex-direction: column; gap: var(--s3); }
.job { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); }
.job-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--s3); align-items: center; }
.job-ic, .jobrow-ic, .dev-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sunken); color: var(--text-2); flex: none; }
.job.ok .job-ic, .jobrow.ok .jobrow-ic { background: var(--ok-bg); color: var(--ok); }
.job.fail .job-ic, .jobrow.fail .jobrow-ic { background: var(--fail-bg); color: var(--fail); }
.job.wait .job-ic, .jobrow.wait .jobrow-ic { background: var(--wait-bg); color: var(--wait); }
.job-t { min-width: 0; }
.job-prog { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-xs); color: var(--text-2); }
.job-prog .progress { flex: 1; }
pre.out { margin: var(--s2) 0; padding: var(--s3); max-height: 280px; overflow: auto; background: var(--log-bg); border: 1px solid var(--line); border-radius: var(--r); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.devlist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.dev { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); flex-wrap: wrap; }
.dev-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.dev-b { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dev-b strong { font-size: var(--t-lg); }

/* activity drawer */
.drawer { position: fixed; z-index: 60; top: 8px; right: 8px; bottom: 8px; width: min(400px, calc(100vw - 16px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--sh-3); outline: none; animation: drawer-in var(--med) var(--ease) both; }
.drawer.out { animation: drawer-out 160ms var(--ease) both; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s3) var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.drawer-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.joblist-mini { list-style: none; margin: 0; padding: var(--s2); overflow: auto; flex: 1; }
.jobrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s3); border-radius: var(--r); }
.jobrow:hover { background: var(--surface-2); }
.jobrow-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.jobrow-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobrow-sub { color: var(--text-3); font-size: var(--t-xs); }
.jobrow-err { color: var(--fail); font-size: var(--t-xs); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; z-index: 80; right: var(--s4); bottom: var(--s4); width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: var(--s2); pointer-events: none; }
.toast { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: 12px 8px 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--sh-3); pointer-events: auto; overflow: hidden; animation: toast-in 220ms var(--ease) both; font-size: var(--t-sm); }
.toast.out { animation: toast-out 180ms var(--ease) both; }
.toast-ic { display: inline-grid; color: var(--accent-text); margin-top: 1px; }
.toast.ok .toast-ic { color: var(--ok); } .toast.error .toast-ic { color: var(--fail); } .toast.busy .toast-ic { color: var(--wait); }
.toast.error { border-color: color-mix(in srgb, var(--fail) 45%, var(--line)); }
.toast-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.toast-body small { color: var(--text-3); }
.toast-t { font-weight: 550; overflow-wrap: anywhere; }
.toast-err { color: var(--fail) !important; overflow-wrap: anywhere; }
.toast .x { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.toast .x:hover { background: var(--hover); color: var(--text); }
.toast .x .ic { width: 15px; height: 15px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; color: var(--accent); opacity: .5; transform-origin: left; animation: countdown linear both; }
.toast.ok .toast-timer { color: var(--ok); } .toast.error .toast-timer { color: var(--fail); }
.toast:hover .toast-timer, .toast:focus-within .toast-timer { animation-play-state: paused; }

/* ------------------------------------------------------------------ dialogs, menus */
.dlg { border: 1px solid var(--line-strong); border-radius: var(--r-xl); padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--sh-3); }
.dlg[open] { animation: pop-in var(--med) var(--ease) both; }
.dlg::backdrop { background: var(--scrim); animation: fade-in var(--med) both; }
.dlg form { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3) var(--s4); padding: var(--s5); }
.dlg-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.dlg.danger .dlg-ic { background: var(--fail-bg); color: var(--fail); }
.dlg-ic .ic { width: 22px; height: 22px; }
.dlg-body { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.dlg-body h2 { font-size: var(--t-lg); margin-top: 8px; overflow-wrap: anywhere; }
.dlg-body p { color: var(--text-2); }
.dlg-list { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 4px; }
.dlg-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.dlg-actions .btn { min-width: 96px; }
.sheet { width: min(560px, calc(100vw - 32px)); padding: 0 var(--s5) var(--s5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) 0; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0 0 var(--s4); align-items: center; }
.keys dt { display: flex; align-items: center; gap: 6px; }
.keys dd { margin: 0; color: var(--text-2); }
.then { color: var(--text-3); font-size: var(--t-xs); }
.menu-host { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); z-index: 70; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--sh-3); animation: pop-in 140ms var(--ease) both; transform-origin: top right; }
.menu.end { right: 0; }
.menu.up { top: auto; bottom: calc(100% + 8px); right: 0; transform-origin: bottom right; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-size: var(--t-md); text-align: left; cursor: pointer; white-space: nowrap; }
.menu-item:hover, .menu-item:focus { background: var(--hover); text-decoration: none; outline: none; }
.menu-item .ic { width: 17px; height: 17px; color: var(--text-3); }
.menu-item.danger, .menu-item.danger .ic { color: var(--fail); }
.menu-item kbd { margin-left: auto; }
.menu-head { padding: 6px 10px 8px; color: var(--text-3); font-size: var(--t-xs); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ------------------------------------------------------------------ auth */
.authwrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s5) var(--s4); background:
  radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--c2) 12%, transparent), transparent 60%), var(--bg); }
.authbox { width: min(420px, 100%); display: flex; flex-direction: column; gap: var(--s4); animation: page-in 260ms var(--ease) both; }
.auth-brand { display: flex; align-items: center; gap: var(--s3); justify-content: center; }
.auth-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.auth-brand strong { font-size: var(--t-xl); }
.auth-brand small { color: var(--text-3); }
.auth-card { padding: var(--s6) var(--s6) var(--s5); box-shadow: var(--sh-2); display: flex; flex-direction: column; gap: var(--s2); }
.auth-card form { display: flex; flex-direction: column; gap: var(--s4); margin-top: var(--s3); }
.auth-ic { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--s2); }
.auth-ic .ic { width: 24px; height: 24px; }
.auth-foot { text-align: center; color: var(--text-3); font-size: var(--t-xs); }
.steps { list-style: none; display: flex; gap: var(--s2); margin: 0; padding: 0; counter-reset: st; font-size: var(--t-xs); color: var(--text-3); }
.steps li { flex: 1; counter-increment: st; padding-top: 8px; border-top: 3px solid var(--line); transition: border-color var(--med), color var(--med); }
.steps li::before { content: counter(st) ". "; }
.steps li.on { border-color: var(--accent); color: var(--text); font-weight: 600; }
.steps li.done { border-color: var(--ok); color: var(--ok); }
.steps li.done::before { content: "✓ "; }
.shake { animation: shake 320ms var(--ease); }
.errbox { display: flex; gap: var(--s4); align-items: flex-start; border-color: color-mix(in srgb, var(--fail) 40%, var(--line)); }
.errbox-ic { color: var(--fail); }
.errbox-ic .ic { width: 28px; height: 28px; }
.errbox-t { margin-bottom: var(--s3); font-weight: 550; }

/* ------------------------------------------------------------------ empty, skeleton, flash */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--s6) var(--s4); text-align: center; color: var(--text-2); }
.empty-ic { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--sunken); color: var(--text-3); margin-bottom: 4px; }
.empty-ic .ic { width: 22px; height: 22px; }
.empty-t { font-weight: 600; color: var(--text); }
.empty-h { font-size: var(--t-sm); max-width: 420px; color: var(--text-3); }
.empty .btn { margin-top: var(--s2); }
.skeleton { display: flex; flex-direction: column; gap: var(--s4); max-width: 1400px; margin: 0 auto; }
.sk { border-radius: var(--r); background: var(--sunken); animation: shimmer 1.2s ease-in-out infinite alternate; }
.sk-title { width: 220px; height: 30px; } .sk-line { width: 360px; max-width: 80%; height: 14px; }
.sk-grid { display: grid; gap: var(--s4); }
.sk-grid.four { grid-template-columns: repeat(4, 1fr); } .sk-grid.two { grid-template-columns: 3fr 2fr; } .sk-grid.three { grid-template-columns: repeat(3, 1fr); }
.sk-card { height: 168px; border-radius: var(--r-lg); }
.sk-block { height: 60vh; border-radius: var(--r-lg); }
.flash { animation: flash 1.1s var(--ease); }

/* ------------------------------------------------------------------ motion */
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes drawer-in { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes drawer-out { to { opacity: 0; transform: translateX(32px); } }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: .7; transform: scale(.6); } 70%, 100% { opacity: 0; transform: scale(1.5); } }
@keyframes breathe { from { opacity: .45; } to { opacity: 1; } }
@keyframes shimmer { from { opacity: .55; } to { opacity: 1; } }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(8deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent), var(--sh-1); } 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent), var(--sh-2); } 100% { box-shadow: 0 0 0 0 transparent, var(--sh-1); } }
.spinning { animation: spin 1.1s linear infinite; }
@keyframes rise-c { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --side-w: 76px; }
  .side { padding: var(--s3) var(--s2); align-items: center; }
  .brand { padding: 6px 0 14px; justify-content: center; width: 100%; }
  .brand-t, .nav-t, .kbd-hint span, .kbd-hint kbd, .nav-group { display: none; }
  .nav-off { position: absolute; top: 8px; right: 10px; }
  .nav-a { justify-content: center; padding: 10px; min-height: 44px; }
  .nav-a[aria-current="page"]::before { left: -8px; }
  .kbd-hint { justify-content: center; }
  .topbar { padding: 0 var(--s5); }
  #view { padding: var(--s5) var(--s5) var(--s7); }
  .cols, .cols.wide-left, .charts { grid-template-columns: minmax(0, 1fr); }
  .set-row { grid-template-columns: minmax(0, 1fr); }
  .set-ctl { max-width: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top-h) auto; }
  .side { position: fixed; top: auto; left: 0; right: 0; bottom: 0; height: auto; flex-direction: row; padding: 0 4px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); z-index: 40; }
  .brand, .side-foot, .nav-main, .nav-apps { display: none !important; }
  .nav { flex-direction: row; }
  .nav-phone { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .nav-phone .menu-host { display: flex; }
  .nav-a { flex-direction: column; gap: 2px; min-height: var(--tab-h); padding: 8px 2px 6px; border-radius: 0; font-size: 11px; font-weight: 550; justify-content: center; align-items: center; }
  .nav-a .nav-t { display: block; line-height: 1.3; }
  .nav-a[aria-current="page"], .nav-a.current { background: none; }
  .nav-a[aria-current="page"]::before, .nav-a.current::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .nav-a .ic { width: 22px; height: 22px; }
  .topbar { grid-column: 1; padding: 0 var(--s2) 0 var(--s4); }
  .top-host .logo { display: inline-grid; }
  .conn { padding: 0; width: 32px; justify-content: center; margin-right: 0; border: 0; background: none; }
  .conn-t, .account-t, .account .chev { display: none; }
  #view { grid-column: 1; padding: var(--s4) var(--s4) calc(var(--tab-h) + var(--s6) + env(safe-area-inset-bottom)); }
  h1 { font-size: var(--t-xl); }
  .hero { padding: var(--s4); }
  .hero-t h1 { font-size: var(--t-2xl); }
  .logo.xl { width: 44px; height: 44px; border-radius: 12px; }
  .hero-side { width: 100%; justify-content: space-between; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .stat.net { grid-column: 1 / -1; }
  .stat .card-head { margin-bottom: 0; }
  .stat-body { gap: var(--s2); }
  .stat-body .gauge svg { width: 104px; height: 104px; }
  .stat-body .g-num { font-size: 24px; }
  .stat-sub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .hero .logo.xl { display: none; }
  .hero-meta > span:nth-child(3) { display: none; }
  .card { padding: var(--s4); }
  .card .tblwrap { margin: 0 calc(-1 * var(--s4)) calc(-1 * var(--s4)); }
  .modgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .modtile { padding: var(--s3); }
  .modtile-name { font-size: var(--t-md); }
  .modlist, .fsgrid, .parts { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .search-wrap { min-width: 0; flex: 1 1 100%; }
  .toolbar > .grow { display: none; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .btn.icon-only { width: 44px; min-width: 44px; }
  .btn.sm.icon-only { width: 40px; min-width: 40px; }
  .seg button { min-height: 38px; }
  input[type="text"], input[type="password"], input[type="number"], input[type="search"], select { min-height: 44px; font-size: 16px; }
  .detail-head { padding: var(--s4); }
  .detail-actions { width: 100%; }
  .set-row.changed::before { left: calc(-1 * var(--s4)); }
  .savebar { bottom: calc(var(--tab-h) + var(--s2) + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .savebar .grow { display: none; }
  #toasts { right: var(--s2); left: var(--s2); width: auto; bottom: calc(var(--tab-h) + var(--s2) + env(safe-area-inset-bottom)); }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 80vh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation-name: sheet-in; padding-bottom: env(safe-area-inset-bottom); }
  .drawer.out { animation-name: sheet-out; }
  /* tables become cards */
  .tblwrap, .tblwrap.sticky { border: 0; background: none; overflow: visible; }
  .card .tblwrap { margin: 0; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { position: relative; margin-bottom: var(--s2); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
  .card .tbl tr { background: var(--surface-2); }
  .tbl td, .tbl th:first-child, .tbl td:first-child { padding: 4px 0; border: 0; }
  .tbl td[data-label]:not(:first-child) { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--s2); align-items: center; justify-items: start; }
  .tbl td[data-label]:not(:first-child)::before { content: attr(data-label); color: var(--text-3); font-size: var(--t-xs); }
  .tbl td:first-child { padding-bottom: 8px; }
  .row-actions { justify-content: flex-start; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 6px; }
  .row-fail td:first-child { box-shadow: none; }
  .tbl tr.row-fail { border-color: color-mix(in srgb, var(--fail) 50%, var(--line)); }
  .cell-name .sub { max-width: none; white-space: normal; }
  /* log rows wrap: meta line, then message */
  .logbox { height: 62vh; font-size: 12px; }
  .ll, .logbox.no-unit .ll, .logview.compact .ll, .logview.compact .logbox.no-unit .ll { grid-template-columns: auto auto minmax(0, 1fr); padding: 4px 10px 4px 0; row-gap: 0; }
  .ll .msg { grid-column: 1 / -1; padding-left: 8px; }
  .ll .lv { margin-left: 6px; padding: 0 4px; }
  .filters .field:not(.grow) { flex: 1 1 130px; }
  .filters > .btn { flex: 1 1 100%; }
  .log-tools .search-wrap { flex-basis: 100%; }
  .disk-size { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .job-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .job-head > .btn { grid-column: 1 / -1; }
  .dlg form { grid-template-columns: minmax(0, 1fr); padding: var(--s4); }
  .dlg-actions .btn { flex: 1; }
  .menu.up { position: fixed; right: 8px; bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .modgrid { grid-template-columns: minmax(0, 1fr); }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .toast-timer { display: none; }
  .spinning, .jobs-btn.active .ic { animation: none !important; }
}
@media print { .side, .topbar, #toasts { display: none; } .shell { display: block; } }

/* Hệ thống page */
.sub-gap { height: 14px; }
.dns { margin-right: 6px; }
.note { margin: 0; padding: 12px 14px 4px; }
