:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f1f6;
  --border: rgba(16, 16, 24, 0.08);
  --border-strong: rgba(16, 16, 24, 0.15);
  --text: #16161c;
  --text-dim: #5c5c68;
  --text-faint: #767684;

  /* Signature gradient — single electric-blue identity, sky into
     deep blue. Used sparingly: logo, primary button, focus glows,
     status ring, chart fill. */
  --g1: #4fc3f7;
  --g2: #00a8e8;
  --g3: #065a7c;
  --gradient: linear-gradient(120deg, var(--g1), var(--g2) 55%, var(--g3));

  --accent: #00a8e8;
  --running: #12b76a;
  --running-dim: rgba(18, 183, 106, 0.12);
  --amber: #f59f0a;
  --orange: #f97316;
  --red: #e8384f;

  --card-shadow: 0 1px 2px rgba(16, 16, 24, 0.04), 0 10px 28px -14px rgba(16, 16, 24, 0.12);
  --card-shadow-hover: 0 4px 10px rgba(16, 16, 24, 0.05), 0 20px 44px -16px rgba(16, 16, 24, 0.16);

  /* Empty heatmap dots / bar tracks. Needs to read clearly against the page,
     not just exist — the old surface-2 value was nearly invisible. */
  --track: rgba(16, 16, 24, 0.1);
  --heat4: #065a7c;
  --topbar-bg: rgba(247, 247, 251, 0.78);
  --glass: rgba(255, 255, 255, 0.78);
  --hover: rgba(16, 16, 24, 0.045);
  --tooltip-bg: #16161c;
  color-scheme: light;

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] {
  --bg: #0b1118;
  --surface: #121b26;
  --surface-2: #19242f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #e9eff6;
  --text-dim: #aab7c5;
  --text-faint: #7f8d9d;
  --running-dim: rgba(18, 183, 106, 0.16);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  --card-shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.45), 0 20px 44px -16px rgba(0, 0, 0, 0.7);
  --track: rgba(255, 255, 255, 0.12);
  --heat4: #4fc3f7;
  --topbar-bg: rgba(11, 17, 24, 0.78);
  --glass: rgba(18, 27, 38, 0.72);
  --hover: rgba(255, 255, 255, 0.07);
  --tooltip-bg: #1d2a38;
  color-scheme: dark;
}
:root[data-theme="dark"] body::before,
:root[data-theme="dark"] body::after { opacity: 0.2; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* Ambient background glow — two slow-drifting soft blobs behind
   everything. This is what turns "flat dark panel" into "product". */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 60vw;
  height: 60vw;
  max-width: 720px;
  max-height: 720px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
}
body::before {
  top: -18vw;
  left: -12vw;
  background: radial-gradient(circle, var(--g2), transparent 70%);
  animation: driftA 26s ease-in-out infinite alternate;
}
body::after {
  bottom: -22vw;
  right: -14vw;
  background: radial-gradient(circle, var(--g3), transparent 70%);
  animation: driftB 30s ease-in-out infinite alternate;
}
@keyframes driftA {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4vw, 3vw) scale(1.08); }
}
@keyframes driftB {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3vw, -4vw) scale(1.05); }
}

a { color: inherit; }

::selection { background: rgba(0, 168, 232, 0.35); }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
  animation: markPulse 2.8s ease-in-out infinite;
}
.brand:hover .brand-mark { filter: drop-shadow(0 0 16px rgba(0, 168, 232, 0.65)); }

/* A slow "powered on" pulse, like an active chip under load. */
@keyframes markPulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(0, 168, 232, 0.35)); }
  50% { filter: drop-shadow(0 0 15px rgba(0, 168, 232, 0.7)); }
}

@keyframes markShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-dim);
  font-size: 13px;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), background 0.2s;
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--hover); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(0); }

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Layout ---------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 70px;
  position: relative;
  z-index: 1;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 4px;
  border-bottom: 1px solid var(--border-strong);
}

@media (max-width: 780px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(odd) { border-left: none; }
  body::before, body::after { width: 90vw; height: 90vw; }
}

/* Entrance animation, staggered by DOM order via --i custom property */
.animate-in {
  opacity: 0;
  animation: riseIn 0.6s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */

/* Dashboard sections sit directly on the page, separated by hairlines —
   boxed, shadowed tiles are what make a dashboard read as templated. */
.card {
  position: relative;
}

.stat-card {
  overflow: hidden;
  padding: 26px 28px 24px;
}
.stat-card + .stat-card { border-left: 1px solid var(--border-strong); }
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--gradient);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.stat-card:hover::before { opacity: 1; animation: markShift 3s linear infinite; }

.card-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
}
.card-label svg { display: none; }

.stat-value {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 5px;
}

/* ---------- Status / hero card ---------- */

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 4px 0 28px;
  border-bottom: 1px solid var(--border-strong);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Boot progress — only shown while the pod is starting. flex-basis:100%
   pushes it onto its own row under the status-card's flex-wrap layout. */
.boot-progress { flex-basis: 100%; display: none; }
.status-card.is-starting .boot-progress { display: block; }
.boot-progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.boot-progress-fill {
  height: 100%;
  width: 28%;
  border-radius: 999px;
  background: var(--gradient);
  animation: bootSlide 1.6s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(460%); }
}
.boot-progress-label {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--mono);
}

.status-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 0.3s var(--ease);
}
.status-ring.running { border-color: rgba(18, 183, 106, 0.4); box-shadow: 0 0 0 4px var(--running-dim), 0 0 22px rgba(18, 183, 106, 0.28); }
.status-ring.running .status-dot { background: var(--running); }
.status-ring.pending { border-color: rgba(245, 159, 10, 0.4); }
.status-ring.pending .status-dot { background: var(--amber); animation: pulse 1.3s ease infinite; }
.status-ring.stopped .status-dot { background: var(--text-faint); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Radar ping — concentric rings expanding outward while running,
   like a live heartbeat/radar sweep. */
.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--running);
  opacity: 0;
}
.status-ring.running .radar-ring { animation: radarPing 2.2s var(--ease) infinite; }
.status-ring.running .radar-ring.r2 { animation-delay: 1.1s; }
@keyframes radarPing {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}

.status-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.status-meta {
  font-size: 12.5px;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-top: 4px;
}

/* ---------- Buttons ---------- */

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: transform 0.15s var(--ease), box-shadow 0.25s var(--ease), opacity 0.15s;
  position: relative;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-start {
  background: var(--gradient);
  background-size: 200% 200%;
  color: #16060d;
  box-shadow: 0 8px 24px -8px rgba(0, 168, 232, 0.55);
  overflow: hidden;
}
.btn-start:hover:not(:disabled) { box-shadow: 0 10px 30px -6px rgba(0, 168, 232, 0.7); animation: markShift 2.5s linear infinite; }

.btn-shine {
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.btn-start:hover .btn-shine { animation: shineSweep 0.9s var(--ease); }
@keyframes shineSweep {
  from { left: -60%; }
  to { left: 130%; }
}

.btn-stop {
  background: var(--surface-2);
  color: var(--red);
  border: 1px solid rgba(232, 56, 79, 0.3);
}
.btn-stop:hover:not(:disabled) { background: rgba(232, 56, 79, 0.08); border-color: rgba(232, 56, 79, 0.5); }

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Section headings ---------- */

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 36px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ---------- ComfyUI embed ---------- */

.embed-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.3s;
  position: relative;
}
.embed-wrap iframe {
  width: 100%;
  height: 88vh;
  border: none;
  display: block;
}
.embed-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 7px 13px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: color 0.15s, border-color 0.15s;
}
.embed-fullscreen-btn:hover { color: var(--accent); border-color: var(--accent); }
.embed-wrap:fullscreen iframe { height: 100vh; }
.embed-empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.embed-empty svg { width: 28px; height: 28px; opacity: 0.3; margin-bottom: 10px; }

/* ---------- Chart ---------- */

.chart-card { padding: 4px 0 0; height: 240px; position: relative; }
.chart-card canvas { max-height: 240px; }

/* ---------- Login ---------- */

.login-split {
  min-height: 100vh;
  display: flex;
}

.login-brandside {
  flex: 1 1 45%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 56px 64px;
  background: linear-gradient(160deg, #0a1420 0%, #11253a 55%, #0a1420 100%);
  color: #eef4fa;
}
.neural-bg-host { position: absolute; inset: 0; }
.login-brandside::after {
  /* soft vignette so the animation doesn't fight the logo */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 55%, transparent 0%, rgba(10,20,32,0.5) 78%);
  pointer-events: none;
}
.login-brandside-content {
  position: relative;
  z-index: 2;
  animation: riseIn 0.6s var(--ease) forwards;
}
.login-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.login-wordmark .brand-mark { width: 26px; height: 26px; }

.login-hero-wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: riseIn 0.7s var(--ease) 0.15s forwards;
  opacity: 0;
}
.hero-mark {
  width: min(42vh, 260px);
  height: min(42vh, 260px);
  animation: heroPulse 2.8s ease-in-out infinite;
}
@keyframes heroPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(0, 168, 232, 0.22)); }
  50% { filter: drop-shadow(0 0 50px rgba(0, 168, 232, 0.4)); }
}

.login-formside {
  flex: 1 1 55%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 40px;
}
.login-formside::after {
  /* keep the network visible but let it fall off toward the edges,
     so the form card in the middle reads clean */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0%, var(--bg) 72%);
  pointer-events: none;
}
.login-form {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 320px;
  padding: 36px 34px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  box-shadow: var(--card-shadow);
  animation: riseIn 0.5s var(--ease) 0.1s forwards;
  opacity: 0;
}
.login-form-head { margin-bottom: 30px; }
.login-form-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.login-form-head p { margin: 0; color: var(--text-faint); font-size: 13.5px; }

.field-icon {
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1.5px solid var(--border-strong);
  padding: 9px 2px;
  margin-bottom: 22px;
  transition: border-color 0.2s var(--ease);
}
.field-icon svg {
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: color 0.2s var(--ease);
}
.field-icon input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
}
.field-icon input:focus { outline: none; }
.field-icon:focus-within { border-color: var(--g2); }
.field-icon:focus-within svg { color: var(--g2); }

.login-form .btn { width: 100%; margin-top: 8px; }
.login-error {
  color: var(--red);
  font-size: 12.5px;
  margin-top: 10px;
  min-height: 16px;
}

@media (max-width: 860px) {
  .login-split { flex-direction: column; }
  .login-brandside { flex: none; padding: 40px 28px; min-height: 280px; }
  .login-brandside h1 { font-size: 24px; }
  .login-tagline { margin-bottom: 28px; }
  .login-features { display: none; }
  .login-formside { flex: none; padding: 36px 24px; }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 13px 17px;
  font-size: 13px;
  max-width: 320px;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
  box-shadow: var(--card-shadow-hover);
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-color: rgba(232, 56, 79, 0.35); color: #b91c34; }
.toast.success { border-color: rgba(18, 183, 106, 0.35); color: #0a7a49; }

/* ---------- Confirm modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 26, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal-box {
  width: 340px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-hover);
  transform: scale(0.95) translateY(8px);
  transition: transform 0.25s var(--ease);
}
.modal-backdrop.show .modal-box { transform: scale(1) translateY(0); }
.modal-box h3 { margin: 0 0 8px; font-size: 15px; }
.modal-box p { margin: 0 0 18px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Balance gauge ---------- */

.gauge-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
}
.gauge { width: 54px; height: 54px; flex-shrink: 0; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--track); stroke-width: 7; }
.gauge-fill {
  fill: none;
  stroke: url(#gaugeGrad);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  transition: stroke-dashoffset 1s var(--ease);
}
.gauge-row .stat-value { font-size: 22px; }

/* ---------- Live rate pulse bars ---------- */

.pulse-row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  margin: 8px 0 2px;
}
.pulse-row span {
  flex: 1;
  border-radius: 2px;
  background: var(--gradient);
  opacity: 0.85;
  transform-origin: bottom;
  animation: pulseBar 1.2s ease-in-out infinite;
}
.pulse-row span:nth-child(1) { animation-delay: -1.1s; }
.pulse-row span:nth-child(2) { animation-delay: -0.9s; }
.pulse-row span:nth-child(3) { animation-delay: -0.7s; }
.pulse-row span:nth-child(4) { animation-delay: -0.5s; }
.pulse-row span:nth-child(5) { animation-delay: -0.3s; }
.pulse-row span:nth-child(6) { animation-delay: -0.6s; }
.pulse-row span:nth-child(7) { animation-delay: -0.8s; }
.pulse-row span:nth-child(8) { animation-delay: -1.0s; }
@keyframes pulseBar {
  0%, 100% { height: 20%; }
  50% { height: 100%; }
}
.pulse-row.idle span { animation-play-state: paused; height: 12%; opacity: 0.35; }

/* ---------- Sparkline ---------- */

.sparkline {
  width: 100%;
  height: 28px;
  margin: 6px 0 2px;
  overflow: visible;
}
.sparkline path.line {
  fill: none;
  stroke: url(#gaugeGrad);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sparkline path.fill { fill: rgba(0, 168, 232, 0.08); stroke: none; }

/* ---------- Storage disk icon ---------- */

.disk-spin {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 22px;
  margin: 8px 0 2px;
}
.disk-spin span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g3);
  opacity: 0.35;
  animation: diskBlink 1.6s ease-in-out infinite;
}
.disk-spin span:nth-child(1) { background: var(--g1); animation-delay: 0s; }
.disk-spin span:nth-child(2) { background: var(--g2); animation-delay: 0.2s; }
.disk-spin span:nth-child(3) { background: var(--g3); animation-delay: 0.4s; }
@keyframes diskBlink {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.3); }
}

/* ---------- Heatmap ---------- */

/* Dots, not squares, sized by the column so the grid fills its half of
   the row instead of leaving dead space beside it. */
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  width: 100%;
  max-width: 440px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--track);
  cursor: pointer;
  transition: transform 0.12s var(--ease);
}
.hm-cell:hover { transform: scale(1.25); }
.hm-cell[data-level="1"] { background: rgba(0, 168, 232, 0.35); }
.hm-cell[data-level="2"] { background: rgba(0, 168, 232, 0.6); }
.hm-cell[data-level="3"] { background: var(--g2); }
.hm-cell[data-level="4"] { background: var(--heat4); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
}
.hm-swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--track);
  display: inline-block;
}
.hm-swatch[data-level="1"] { background: rgba(0, 168, 232, 0.35); }
.hm-swatch[data-level="2"] { background: rgba(0, 168, 232, 0.6); }
.hm-swatch[data-level="3"] { background: var(--g2); }
.hm-swatch[data-level="4"] { background: var(--heat4); }

.hm-tooltip {
  position: fixed;
  background: var(--tooltip-bg);
  color: #f5f4f8;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--mono);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.12s;
  z-index: 60;
  white-space: nowrap;
}
.hm-tooltip.show { opacity: 1; }

/* ---------- GPU availability badge ---------- */

.gpu-avail {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.gpu-avail-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.gpu-avail.high .gpu-avail-dot { background: var(--running); box-shadow: 0 0 6px rgba(18,183,106,0.6); }
.gpu-avail.medium .gpu-avail-dot { background: var(--amber); box-shadow: 0 0 6px rgba(245,159,10,0.6); }
.gpu-avail.low .gpu-avail-dot { background: var(--orange); box-shadow: 0 0 6px rgba(249,115,22,0.6); }
.gpu-avail.none .gpu-avail-dot { background: var(--red); box-shadow: 0 0 6px rgba(232,56,79,0.6); }

/* ---------- Runway line ---------- */

.runway {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--mono);
}
.runway b { color: var(--text-dim); font-weight: 600; }

/* ---------- Split row (chart + donut) ---------- */

.split-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
}
@media (max-width: 780px) {
  .split-row { grid-template-columns: 1fr; }
  .donut-card { border-left: none; padding-left: 0; margin-top: 24px; }
}
.donut-card {
  display: flex;
  flex-direction: column;
  padding-left: 32px;
  border-left: 1px solid var(--border-strong);
}

/* Sessions and activity share one row, split by a hairline. */
.duo-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.duo-side { padding-left: 40px; border-left: 1px solid var(--border-strong); }
.duo-main { padding-right: 40px; }
@media (max-width: 860px) {
  .duo-row { grid-template-columns: 1fr; }
  .duo-main { padding-right: 0; }
  .duo-side { padding-left: 0; border-left: none; }
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  flex: 1;
}
.donut {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}
.donut-track { fill: none; stroke: var(--track); stroke-width: 14; }
.donut-seg {
  fill: none;
  stroke-width: 14;
  stroke-dasharray: 251.2 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1s var(--ease);
}
.donut-gpu { stroke: url(#gaugeGrad); }
.donut-disk { stroke: var(--text-faint); }

.donut-legend {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.donut-legend div { display: flex; align-items: center; gap: 7px; }
.donut-legend b { margin-left: auto; font-family: var(--mono); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-gpu { background: linear-gradient(135deg, var(--g2), var(--g3)); }
.dot-disk { background: var(--text-faint); }

/* ---------- Sessions timeline ---------- */

.sessions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.session-row {
  display: grid;
  grid-template-columns: 90px 1fr 64px;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.session-date {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12.5px;
}
.session-bar-track {
  height: 10px;
  border-radius: 5px;
  background: var(--track);
  overflow: hidden;
}
.session-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--gradient);
  background-size: 200% 100%;
  width: 0%;
  transition: width 0.8s var(--ease);
}
.session-amount {
  text-align: right;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}
