:root {
  --paper: #ffffff;
  --surface: #f4f6f9;
  --bg-inset: #eaeef4;
  --line: #e2e6ec;
  --ink: #1f2a48;
  --body-c: #3d4658;
  --muted: #5b6270;
  --faint: #9aa6c4;
  --accent: #1b33d6;
  --accent-deep: #17389e;
  --electric: #3050ff;
  --ink-deep: #0a1229;
  --periwinkle: #7a8fff;
  --ok: #0e8a5a;
  --amber: #b07c1a;
  --hot: #c2452e;
  --fd: "Schibsted Grotesk", "Pretendard Variable", Pretendard, sans-serif;
  --fb: "Inter Variable", "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  padding: 0 0 48px;
  background: var(--surface);
  color: var(--body-c);
  font: 13px/1.5 var(--fb);
}
.wrap { max-width: 1560px; margin: 0 auto; padding: 0 16px; }

h1, h2 { margin: 0; font-family: var(--fd); font-weight: 700; color: var(--ink); }
h1 { font-size: 15px; letter-spacing: .06em; }
h2 { font-size: 13px; letter-spacing: .05em; }
.sub { color: var(--muted); font-family: var(--fb); font-weight: 400; letter-spacing: 0; font-size: 12px; }

/* header - vdlab dark section */
.topbar {
  background: var(--ink-deep);
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 16px;
}
.topbar-in {
  max-width: 1560px; margin: 0 auto; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { color: #fff; }
.title { display: flex; align-items: center; gap: 10px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.35);
  transition: background .3s, opacity .3s;
}
.dot.ok { background: var(--periwinkle); }
.dot.stale { background: #d9a441; }
.dot.pulse { animation: pulse .8s ease; }
@keyframes pulse { 0% { opacity: .2; } 100% { opacity: 1; } }
.updated { font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.68); }
.updated.stale { color: #d9a441; }

/* summary strip */
.summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.fig {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 18px; box-shadow: 0 1px 2px rgba(10,18,41,.04);
  display: flex; align-items: center; gap: 14px;
}
.fig-gauge { flex: 0 0 auto; line-height: 0; }
.fig-num { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--ink); }
.fig-num .of { color: var(--faint); font-size: 15px; }
.fig-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

/* panels */
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(10,18,41,.04);
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.section-head { margin: 0 2px 10px; }

.badge {
  font-family: var(--mono); font-size: 11px; padding: 2px 10px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  background: var(--paper);
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--paper)); }
.badge.busy { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 8%, var(--paper)); }
.badge.down { color: var(--hot); border-color: color-mix(in srgb, var(--hot) 35%, transparent); background: color-mix(in srgb, var(--hot) 7%, var(--paper)); }

/* orca node tiles */
.node-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.node {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--surface);
  display: flex; align-items: center; gap: 10px;
}
.node .ring { flex: 0 0 auto; }
.node-name { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.node-state { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.node.idle .node-state { color: var(--ok); }
.node.allocated .node-state, .node.mixed .node-state { color: var(--amber); }
.node.down .node-state, .node.drained .node-state { color: var(--hot); }
.node-cpus { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* conic donut */
.ring-wrap { position: relative; display: inline-block; flex: 0 0 auto; }
.cring {
  position: absolute; inset: 0; border-radius: 50%;
  -webkit-mask: radial-gradient(circle closest-side, transparent calc(100% - var(--stroke) - 1px), #000 calc(100% - var(--stroke)));
  mask: radial-gradient(circle closest-side, transparent calc(100% - var(--stroke) - 1px), #000 calc(100% - var(--stroke)));
}
.cring-in {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.cring-main { font-family: var(--mono); font-weight: 600; color: var(--ink); line-height: 1.1; }
.cring-sub { font-family: var(--mono); font-size: 8.5px; color: var(--muted); }

/* bars */
.bar {
  height: 5px; border-radius: 4px; background: var(--bg-inset);
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%; background: var(--electric);
  transition: width .5s ease, background .5s ease;
}
.bar.warn > i { background: var(--amber); }
.bar.hot > i { background: var(--hot); }

/* jobs table */
.jobs-wrap { overflow-x: auto; }
table.jobs { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
table.jobs th {
  text-align: left; font-weight: 500; font-size: 10px; letter-spacing: .08em;
  color: var(--muted); padding: 5px 10px; background: var(--bg-inset);
}
table.jobs th:first-child { border-radius: 6px 0 0 6px; }
table.jobs th:last-child { border-radius: 0 6px 6px 0; }
table.jobs td { padding: 4px 10px; border-top: 1px solid var(--line); white-space: nowrap; color: var(--body-c); }
table.jobs tr:first-child td { border-top: 0; }
table.jobs td.state-RUNNING { color: var(--ok); }
table.jobs td.state-PENDING { color: var(--amber); }
table.jobs .name-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* host cards */
.host-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 1279px) { .host-grid { grid-template-columns: repeat(2, 1fr); } .summary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px) { .host-grid, .summary { grid-template-columns: 1fr; } .node-grid { grid-template-columns: repeat(2, 1fr); } }

.host {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; box-shadow: 0 1px 2px rgba(10,18,41,.04);
}
.host.down { opacity: .6; }
.host-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.host-name { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--ink); }
.host-kind { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-left: 6px; }

.host-rings { display: flex; gap: 24px; padding: 6px 0 8px; }
.hr-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hr-cap { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.gpu-row {
  display: grid; grid-template-columns: 38px 1fr 64px; gap: 10px; align-items: center;
  padding: 5px 0; border-top: 1px solid var(--line);
}
.gpu-mid { min-width: 0; }
.gpu-label { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.gpu-vram-line .bar { height: 4px; }
.gpu-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: right; white-space: nowrap; line-height: 1.4; }
.gpu-meta .t-hot { color: var(--hot); }
.gpu-users { grid-column: 2 / 4; font-family: var(--mono); font-size: 10px; color: var(--faint); padding-bottom: 2px; }
.gpu-users span { color: var(--accent-deep); }

.host-gpuname { font-size: 10px; color: var(--faint); margin: 6px 0 2px; }
.unreach { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 8px 0; }

/* skeleton */
.skel { border-radius: 16px; border: 1px solid var(--line); background: var(--paper); height: 120px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(10,18,41,.04) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  .bar > i, .dot { transition: none; }
  .dot.pulse, .skel::after { animation: none; }
}
