/* Warm, editorial look: cream paper, serif display type, terracotta accent,
   Apple-style frosted chrome and segmented controls. */
:root {
  color-scheme: light;
  --page: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --surface-3: #ebe8df;
  --ink: #141413;
  --ink-2: #5e5d59;
  --muted: #8f8d86;
  --hair: #ece9e1;
  --border: rgba(20, 20, 19, 0.08);
  --track: #efece4;
  --accent: #c96442;
  --accent-hover: #b4583a;
  --accent-ink: #a64d2f;
  --accent-wash: #f6ebe4;
  --accent-soft: #e8b49c;
  --good: #3f8f5a;
  --good-wash: #e7f1ea;
  --warn-ink: #9a5b12;
  --warn-wash: #fbf0dc;
  --critical: #c0453a;
  --grid: #ece9e1;
  --axis: #d6d2c6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --other: #c4c0b4;
  --seq-0: #f4f2ec; --seq-1: #f6e2d6; --seq-2: #f0c8b2; --seq-3: #e8a88a;
  --seq-4: #dd8764; --seq-5: #c96442; --seq-6: #a24c30; --seq-7: #74351f;
  --gpu-idle: #4caf72; --gpu-mid: #efb424; --gpu-hi: #dc4c43;
  --av1: #f1e4d8; --av2: #e2eadf; --av3: #dfe7f1; --av4: #eee1ea; --av5: #ebe5d2; --av6: #dceae8;
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, .04);
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 8px 24px -8px rgba(20, 20, 19, .08);
  --shadow-lg: 0 2px 4px rgba(20, 20, 19, .04), 0 24px 48px -12px rgba(20, 20, 19, .18);
  --r-lg: 22px;
  --r: 16px;
  --serif: "Newsreader", "Source Serif 4", "Iowan Old Style", Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #1f1e1c; --surface: #2a2926; --surface-2: #33322e; --surface-3: #3d3c37;
    --ink: #f5f4ee; --ink-2: #bfbdb4; --muted: #8f8d86; --hair: #383732;
    --border: rgba(255, 255, 255, 0.08); --track: #3a3934;
    --accent: #d97757; --accent-hover: #e48a6b; --accent-ink: #eb9c7e; --accent-wash: #3d2a22; --accent-soft: #8a4a33;
    --good: #5cb27a; --good-wash: #263a2d; --warn-ink: #f0b65c; --warn-wash: #3b3020; --critical: #e0675b;
    --grid: #383732; --axis: #4a4943;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #5f5d56;
    --seq-0: #33322e; --seq-1: #4a2e23; --seq-2: #6b3a28; --seq-3: #8f4a31; --seq-4: #b65c3d;
    --seq-5: #d97757; --seq-6: #e9a185; --seq-7: #f6cfbd;
    --gpu-idle: #4fb877; --gpu-mid: #e9b02e; --gpu-hi: #e8625a;
    --av1: #4a3a2e; --av2: #34412f; --av3: #2f3a48; --av4: #45333f; --av5: #45402c; --av6: #2d4240;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.04); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #1f1e1c; --surface: #2a2926; --surface-2: #33322e; --surface-3: #3d3c37;
  --ink: #f5f4ee; --ink-2: #bfbdb4; --muted: #8f8d86; --hair: #383732;
  --border: rgba(255, 255, 255, 0.08); --track: #3a3934;
  --accent: #d97757; --accent-hover: #e48a6b; --accent-ink: #eb9c7e; --accent-wash: #3d2a22; --accent-soft: #8a4a33;
  --good: #5cb27a; --good-wash: #263a2d; --warn-ink: #f0b65c; --warn-wash: #3b3020; --critical: #e0675b;
  --grid: #383732; --axis: #4a4943;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #5f5d56;
  --seq-0: #33322e; --seq-1: #4a2e23; --seq-2: #6b3a28; --seq-3: #8f4a31; --seq-4: #b65c3d;
  --seq-5: #d97757; --seq-6: #e9a185; --seq-7: #f6cfbd;
  --gpu-idle: #4fb877; --gpu-mid: #e9b02e; --gpu-hi: #e8625a;
  --av1: #4a3a2e; --av2: #34412f; --av3: #2f3a48; --av4: #45333f; --av5: #45402c; --av6: #2d4240;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.04); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 14.5px/1.55 var(--sans); letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; }
h2 { font-size: 30px; line-height: 1.15; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 6px 0 0; }
a { color: var(--accent-ink); }
::selection { background: var(--accent-wash); }

/* ---------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(201,100,66,.3); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.icon { width: 36px; padding: 0; }
.btn.danger { color: var(--critical); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; height: 38px; padding: 0 13px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input[type=search] { border-radius: 999px; padding-left: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f8d86' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center; }
textarea { height: auto; padding: 10px 13px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; font-size: 13.5px;
  height: 30px; padding: 0 14px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg.small button { height: 26px; padding: 0 12px; font-size: 12.5px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20,20,19,.12), 0 0 0 .5px rgba(20,20,19,.04); }

/* ---------- brand */
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(201,100,66,.35), inset 0 1px 0 rgba(255,255,255,.18);
}
.brand-mark::before {
  content: ""; width: 16px; height: 13px; border-radius: 2px;
  background:
    linear-gradient(#fff, #fff) 0 0 / 100% 5px no-repeat,
    linear-gradient(rgba(255,255,255,.65), rgba(255,255,255,.65)) 0 8px / 100% 5px no-repeat;
}

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% -10%, var(--accent-wash), transparent 60%), var(--page); }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 28px; padding: 40px 32px 32px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-lg); text-align: center; align-items: stretch;
}
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 6px; }
.login-card .brand-mark::before { width: 24px; height: 20px; background:
  linear-gradient(#fff, #fff) 0 0 / 100% 8px no-repeat, linear-gradient(rgba(255,255,255,.65), rgba(255,255,255,.65)) 0 12px / 100% 8px no-repeat; }
.login-card h1 { font-size: 30px; }
.login-card p { margin: -6px 0 8px; }
.login-card input { height: 46px; text-align: center; font-size: 15px; }
.login-card .btn { height: 46px; font-size: 15px; }
.err { color: var(--critical); min-height: 20px; font-size: 13px; }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px 32px; background: color-mix(in srgb, var(--page) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-title { font-family: var(--serif); font-size: 19px; letter-spacing: -0.015em; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.brand-sub::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-wash); }
.tabs { justify-self: center; }
.top-actions { justify-self: end; display: flex; gap: 4px; align-items: center; }

main { padding: 8px 32px 48px; max-width: 1480px; margin: 0 auto; }
.foot { text-align: center; font-size: 12.5px; padding: 8px 16px 36px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 36px 0 20px; flex-wrap: wrap; }
.section-head p { color: var(--ink-2); max-width: 640px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.legend-inline { font-size: 13px; }

/* ---------- hero */
.hero { padding: 48px 0 28px; }
.hero .eyebrow { font-size: 13px; font-weight: 500; color: var(--accent-ink); letter-spacing: .02em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hero h1 { font-size: clamp(30px, 3.8vw, 48px); line-height: 1.15; text-wrap: balance; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { font-size: 17px; color: var(--ink-2); margin-top: 14px; }

/* ---------- KPI strip: one card, hairline dividers */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.kpi { padding: 22px 24px; position: relative; }
.kpi + .kpi::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 1px; background: var(--hair); }
.kpi .k-label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .k-value { font-family: var(--serif); font-size: 42px; line-height: 1.1; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: lining-nums; }
.kpi .k-value small { font-family: var(--sans); font-size: 14px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; min-height: 19px; }
.kpi.warn { cursor: pointer; transition: background .15s; }
.kpi.warn:hover { background: var(--surface-2); }
.kpi.warn .k-value { color: var(--accent); }
.kpi.warn .k-sub::after { content: " →"; }

/* ---------- server cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px 22px 18px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s;
  display: flex; flex-direction: column; gap: 18px; min-width: 0;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card.down { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-name { font-family: var(--serif); font-size: 25px; line-height: 1.1; letter-spacing: -0.02em; }
.card-spec { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--good-wash); color: var(--good); }
.pill.bad { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--critical); }
.pill.none { background: var(--surface-3); color: var(--muted); }
.pill.idle-p { background: var(--surface-2); color: var(--muted); }

.rings { display: flex; gap: 6px; align-items: center; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 76px; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring .tr { stroke: var(--track); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1); }
.ring.lo .fg { stroke: var(--accent-soft); }
.ring-wrap { position: relative; width: 64px; height: 64px; }
.ring-val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ring-val small { font-size: 10px; font-weight: 500; color: var(--muted); margin: 3px 0 0 1px; }
.ring-lbl { font-size: 12px; color: var(--ink-2); }
.gpu-strip { margin-left: auto; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; min-width: 0; flex: 1; max-width: 170px; }
.gpu-strip .gs-l { font-size: 12px; color: var(--ink-2); }
.gpu-strip .gs-l b { font-weight: 600; color: var(--ink); }
.gpu-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%; }
.gpu-cells.big { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.gpu-cells.big i { height: 34px; border-radius: 8px; }
.gpu-cells i { height: 18px; border-radius: 5px; transition: transform .15s; background: var(--surface); box-shadow: inset 0 0 0 1px var(--axis); }
.gpu-cells i:hover { transform: scale(1.12); }
.gpu-cells i.idle, .gpu-key i.idle { background: var(--gpu-idle); box-shadow: none; }
.gpu-cells i.mid, .gpu-key i.mid { background: var(--gpu-mid); box-shadow: none; }
.gpu-cells i.hi, .gpu-key i.hi { background: var(--gpu-hi); box-shadow: none; }
.gpu-key { font-size: 11.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: -8px; }
.gpu-key span { display: inline-flex; align-items: center; gap: 5px; }
.gpu-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--surface); box-shadow: inset 0 0 0 1px var(--axis); }
.panel-head .gpu-key { margin-top: 0; }

/* disks */
.fs-list { display: flex; flex-direction: column; gap: 7px; }
.fs-row { display: grid; grid-template-columns: 76px 1fr 38px auto; gap: 10px; align-items: center; font-size: 12.5px; }
.fs-p { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); line-height: 1.25; }
.fs-p small { display: block; font-size: 10px; color: var(--muted); }
.fs-bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.fs-bar i { display: block; height: 100%; border-radius: 999px; background: var(--ink-2); opacity: .55; }
.fs-row.warn .fs-bar i { background: var(--gpu-mid); opacity: 1; }
.fs-row.crit .fs-bar i { background: var(--gpu-hi); opacity: 1; }
.fs-row.crit .fs-v { color: var(--gpu-hi); font-weight: 600; }
.fs-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.fs-s { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.fs-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.fs-host { font-family: var(--serif); font-size: 20px; margin-bottom: 10px; letter-spacing: -0.01em; }
.mini-bar { height: 4px; background: var(--track); border-radius: 999px; margin-top: 6px; width: 120px; margin-left: auto; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.callout code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* containers, active list */
.tag.ctr { background: var(--surface-3); color: var(--ink-2); height: 19px; font-size: 11px; padding: 0 7px; }
.avatar.ctr { background: var(--surface-3); color: var(--ink-2); }
.age { color: var(--muted); white-space: nowrap; font-size: 12px; }
.doing { display: flex; flex-direction: column; gap: 5px; max-width: 520px; }
.doing-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.doing-row .sub { white-space: nowrap; }
.table .note { max-width: 260px; }
.kpi.link { cursor: pointer; transition: background .15s; }
.kpi.link:hover { background: var(--surface-2); }

.users { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--hair); padding-top: 12px; margin: 0 -8px; }
.u-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 0 11px; align-items: center; padding: 7px 8px; border-radius: 12px; }
.u-row:hover { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; grid-row: span 2;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; text-transform: uppercase;
}
.u-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.u-name .real { color: var(--muted); font-weight: 400; margin-left: 5px; }
.u-res { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.u-what { grid-column: 2 / -1; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; flex: none;
}
.tag.reg { background: var(--accent-wash); color: var(--accent-ink); }
.tag.unreg { background: var(--warn-wash); color: var(--warn-ink); }
.tag.ok { background: var(--good-wash); color: var(--good); }
.tag.ended { background: var(--surface-2); color: var(--muted); }
.tag.host { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); color: var(--ink-2); border-radius: 7px; }
.lbl { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.purpose { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.idle { color: var(--muted); font-size: 13.5px; padding: 4px 8px; }
.more { font-size: 12.5px; color: var(--muted); padding: 4px 8px 0 53px; }

/* ---------- callout */
.callout {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 18px;
  display: flex; gap: 8px 12px; align-items: baseline; flex-wrap: wrap; box-shadow: var(--shadow);
  border-left: 3px solid var(--accent);
}
.callout b { font-weight: 600; }
.callout .chips { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 6px; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; height: 30px;
  padding: 0 13px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); transition: all .15s;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }

/* ---------- tables */
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { width: 300px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow); }
.panel .table-wrap { box-shadow: none; border: 0; border-radius: 0; margin: 0 -24px -22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 14px 18px 10px;
  border-bottom: 1px solid var(--hair); white-space: nowrap; background: var(--surface); position: sticky; top: 0;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--ink); }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr, .table tr { transition: background .12s; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table td.r { white-space: nowrap; }
.table .sub { color: var(--muted); font-size: 12.5px; }
.table .acts { display: flex; flex-wrap: wrap; gap: 5px; max-width: 440px; }
.table .empty { text-align: center; color: var(--muted); padding: 56px; font-family: var(--serif); font-size: 18px; }
.table .u-name { display: inline; }
.hosts-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 28px; height: 28px; font-size: 11px; grid-row: auto; flex: none; }

/* ---------- panels & charts */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.panel h3 { margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col .panel { margin-bottom: 18px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: 150px 1fr 64px; gap: 12px; align-items: center; font-size: 13.5px; padding: 2px 0; border-radius: 8px; cursor: default; }
.hb .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hb .t { height: 10px; display: flex; gap: 2px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hb .t i { display: block; height: 100%; min-width: 3px; border-radius: 999px !important; }
.hb .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 500; }
.hb:hover .t i { filter: brightness(1.08); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; gap: 3px; font-size: 11.5px; }
.heat .hl { color: var(--ink-2); padding-right: 12px; display: flex; align-items: center; font-family: var(--mono); font-size: 12px; }
.heat .hc { height: 26px; min-width: 6px; border-radius: 5px; background: var(--seq-0); transition: transform .12s; }
.heat .hc:hover { transform: scale(1.15); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink-2); }
.heat .hx { color: var(--muted); text-align: left; font-size: 10.5px; padding-top: 6px; white-space: nowrap; }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 14px; }
.heat-scale i { width: 20px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- drawer (sheet) */
.drawer-bg, .modal-bg {
  position: fixed; inset: 0; background: rgba(20, 20, 19, .28); z-index: 40;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.drawer {
  position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(900px, calc(100vw - 20px)); background: var(--page);
  z-index: 41; overflow-y: auto; box-shadow: var(--shadow-lg); border-radius: 26px; border: 1px solid var(--border);
  animation: slide .28s cubic-bezier(.2,.8,.2,1);
}
.drawer-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 20px 28px;
  background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hair);
}
.drawer-head h2 { font-size: 30px; }
.drawer-body { padding: 22px 28px 28px; }
.drawer .close { margin-left: auto; }
.spec-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.spec { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; min-width: 120px; }
.spec .s-l { font-size: 12px; color: var(--muted); }
.spec .s-v { font-size: 14px; font-weight: 600; margin-top: 1px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-t { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--sans); }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.proc-cmd { font-family: var(--mono); font-size: 11.5px; color: var(--muted); word-break: break-all; margin-top: 4px; line-height: 1.5; }

/* ---------- modal (sheet) */
.modal-bg { display: grid; place-items: center; padding: 16px; }
.modal {
  width: 100%; max-width: 580px; background: var(--surface); border-radius: 26px; padding: 28px 30px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 16px; max-height: 92vh; overflow-y: auto;
  animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
.modal h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: -0.02em; margin-bottom: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.host-picks { display: flex; flex-wrap: wrap; gap: 7px; }
.host-picks label {
  display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 13px; cursor: pointer; font-weight: 500; color: var(--ink-2);
  font-family: var(--mono); transition: all .15s; background: var(--surface);
}
.host-picks label:hover { border-color: var(--accent-soft); }
.host-picks input { display: none; }
.host-picks label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ---------- tooltip */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 14px; padding: 10px 13px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); max-width: 320px; min-width: 150px;
}
.tooltip .tt-h { font-weight: 600; margin-bottom: 5px; }
.tooltip .tt-r { display: flex; align-items: center; gap: 12px; justify-content: space-between; line-height: 1.7; }
.tooltip .tt-r span:first-child { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.tooltip .tt-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip i.sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

@media (max-width: 1000px) {
  .top { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; overflow-x: auto; }
  .tabs button { flex: 1; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  main { padding: 0 16px 32px; }
  .hero { padding: 28px 0 20px; }
  .hero p { font-size: 15px; }
  .grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 16px 18px; }
  .kpi + .kpi::before { display: none; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .kpi:nth-child(even) { border-left: 1px solid var(--hair); }
  .kpi .k-value { font-size: 32px; }
  .filters input[type=search] { width: 100%; }
  .hb { grid-template-columns: 96px 1fr 52px; }
  .field-row { grid-template-columns: 1fr; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; }
  .drawer-body, .drawer-head { padding-left: 16px; padding-right: 16px; }
  .brand-title { font-size: 17px; }
  .brand-sub { display: none; }
  #refreshBtn span { display: none; }
  #refreshBtn { width: 36px; padding: 0; }
  .gpu-strip { max-width: 130px; }
  .ring { width: 66px; }
}
.drawer .proc-cmd { max-width: 420px; }

/* per-user GPU chips, coloured by that GPU's state */
.gchips { display: inline-flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; vertical-align: middle; }
.gchip {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px;
  font-style: normal; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: #fff;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--axis);
}
.gchip.free { color: var(--ink-2); }
.gchip.idle { background: var(--gpu-idle); box-shadow: none; }
.gchip.mid { background: var(--gpu-mid); box-shadow: none; color: #3a2a00; }
.gchip.hi { background: var(--gpu-hi); box-shadow: none; }
.u-res { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.u-res .gl { font-size: 11px; color: var(--muted); font-weight: 500; margin-right: -4px; }
.gpu-by { display: flex; gap: 6px; align-items: flex-start; justify-content: flex-end; }
.gpu-by > .sub { line-height: 20px; white-space: nowrap; }
.gpu-by .gchips { max-width: 100px; }
.gpu-by + .gpu-by { margin-top: 4px; }

/* storage: server subset filter */
.host-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.hf-btn {
  height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 12.5px; font-family: var(--mono); color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.hf-btn:first-child { font-family: var(--sans); }
.hf-btn:hover { border-color: var(--accent-soft); color: var(--ink); }
.hf-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* DSF · JC STEM Lab logo */
.brand-logo { height: 38px; width: auto; display: block; flex: none; }
.brand-text { border-left: 1px solid var(--hair); padding-left: 12px; }
.login-logo { height: 64px; width: auto; margin: 0 auto 8px; display: block; }
@media (max-width: 700px) { .brand-logo { height: 30px; } .brand-text { display: none; } }

.more-btn { align-self: flex-start; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12.5px; color: var(--accent-ink); cursor: pointer; }
.more-btn:hover { text-decoration: underline; }
.gpu-by { min-width: 190px; } .gpu-by .gchips { width: 100px; justify-content: flex-start; }
