:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #10151d;
  --panel-2: #151b24;
  --line: #27303d;
  --muted: #8994a3;
  --text: #edf3f8;
  --green: #53e6a8;
  --amber: #f6c453;
  --red: #ff6b72;
  --cyan: #70d7ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 70% -20%, #18283a 0, transparent 38%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 24px; }
.header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.eyebrow, .panel-kicker { color: var(--cyan); font-size: 11px; letter-spacing: .14em; font-weight: 700; }
h1 { margin: 7px 0 2px; font-size: clamp(32px, 4vw, 52px); letter-spacing: -.045em; }
.brand-logo { display: block; width: min(315px, 58vw); height: auto; margin: 6px 0 0; }
h2 { margin: 4px 0 0; font-size: 20px; }
.header p, .panel-heading > span, footer { color: var(--muted); }
.header-status { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.experiment-picker { display: grid; gap: 4px; margin-right: 5px; }
.experiment-picker span { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.experiment-picker select {
  max-width: 230px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 6px 28px 6px 9px;
}
.logout-form { margin: 0 0 0 7px; }
.logout-form button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  cursor: pointer;
}
.logout-form button:hover,
.logout-form button:focus-visible { border-color: #566274; color: var(--text); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 14px currentColor; }
.status-dot.online { background: var(--green); color: var(--green); }
.status-dot.stale { background: var(--amber); color: var(--amber); }
.status-dot.offline { background: var(--red); color: var(--red); }
.notice { border: 1px solid #5f4d25; background: rgba(69, 52, 18, .45); color: #d8c99f; border-radius: 8px; padding: 12px 15px; margin-bottom: 18px; font-size: 13px; }
.notice strong { color: var(--amber); }
.notice.real { border-color: #285f4b; background: rgba(16, 55, 43, .45); color: #b6dacd; }
.notice.real strong { color: var(--green); }
.notice.unavailable { border-color: #74363a; background: rgba(72, 18, 23, .62); color: #ffc4c7; }
.notice.unavailable strong { color: var(--red); }
.data-alerts { display: grid; gap: 8px; border-radius: 8px; padding: 15px 17px; margin-bottom: 18px; font-size: 12px; line-height: 1.45; }
.data-alerts strong { letter-spacing: .055em; }
.data-alerts ul { margin: 0; padding-left: 19px; }
.data-alerts.critical { border: 2px solid var(--red); background: rgba(104, 16, 24, .72); color: #ffe3e5; box-shadow: 0 0 24px rgba(255, 107, 114, .12); }
.data-alerts.critical strong { color: #fff; }
.data-alerts.ok { border: 1px solid #285f4b; background: rgba(16, 55, 43, .45); color: #b6dacd; }
.summary-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.economics-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 9px; }
.economic-metric { border: 1px solid var(--line); background: rgba(8, 11, 16, .45); border-radius: 7px; padding: 13px; display: grid; gap: 7px; min-width: 0; }
.economic-metric span, .instance-row span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.economic-metric strong { font-size: 18px; overflow-wrap: anywhere; }
.economic-metric.missing, .metric.missing { border-color: #74363a; background: rgba(72, 18, 23, .38); }
.economic-metric.missing strong, .metric.missing .metric-value { color: var(--red); font-size: 13px; letter-spacing: .025em; }
.economic-metric small, .instance-row small { color: var(--muted); font-size: 10px; }
.source-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 12px; }
.instance-list { display: grid; gap: 8px; margin-top: 14px; }
.instance-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; align-items: center; gap: 18px; border-top: 1px solid var(--line); padding: 14px 2px 5px; }
.instance-row > div:not(.instance-actions) { display: grid; gap: 5px; }
.instance-id { color: var(--cyan) !important; }
.instance-actions { display: flex; gap: 7px; }
.instance-actions button, .reconcile button { border: 1px solid #3d4b5d; border-radius: 5px; padding: 7px 10px; background: #19212c; color: var(--text); cursor: pointer; }
.instance-actions button.danger { border-color: #74363a; color: #ff9ba0; background: #2a1518; }
.instance-actions button:disabled { opacity: .35; cursor: not-allowed; }
.empty-row { color: var(--muted); border-top: 1px solid var(--line); padding: 18px 2px 4px; font-size: 12px; }
.reconcile { margin-top: 14px; color: var(--muted); font-size: 11px; }
.reconcile summary { cursor: pointer; }
.reconcile form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.reconcile label { display: grid; gap: 5px; }
.reconcile input { width: 170px; border: 1px solid var(--line); border-radius: 5px; background: #080b10; color: var(--text); padding: 7px 8px; }
.metric, .panel, .gpu-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(20,27,36,.97), rgba(13,18,25,.97)); border-radius: 9px; }
.metric { padding: 15px 16px; min-height: 91px; }
.metric-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.metric-value { margin-top: 13px; font-size: 23px; font-weight: 720; letter-spacing: -.025em; }
.metric-value small { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 3px; }
.panel { padding: 20px; margin-top: 14px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.panel-unit { font-size: 12px; }
.chart-panel { min-height: 290px; }
.chart-empty { display: grid; place-items: center; height: 205px; color: var(--muted); }
.unavailable-block { min-height: 120px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.unavailable-block strong { color: var(--red); font-size: 13px; letter-spacing: .06em; }
.chart { width: 100%; height: 205px; overflow: visible; }
.chart-grid { stroke: #222b36; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#chart-gradient); opacity: .28; }
.chart-label { fill: var(--muted); font-size: 11px; }
.gpu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gpu-card { padding: 18px; background: var(--panel-2); }
.gpu-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.gpu-title h3 { margin: 0; font-size: 16px; }
.state { text-transform: uppercase; font-size: 10px; letter-spacing: .09em; font-weight: 800; }
.state.online { color: var(--green); }
.state.stale { color: var(--amber); }
.state.offline { color: var(--red); }
.gpu-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-top: 22px; }
.gpu-stat span { color: var(--muted); font-size: 11px; display: block; margin-bottom: 6px; }
.gpu-stat strong { font-size: 16px; }
footer { display: flex; justify-content: space-between; font-size: 11px; padding: 18px 3px 0; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #000;
}
.login-shell {
  width: min(340px, calc(100% - 40px));
  display: grid;
  justify-items: center;
  gap: 26px;
  transform: translateY(-3vh);
}
.login-logo { display: block; width: min(300px, 88vw); height: auto; }
.login-form { width: min(260px, 78vw); }
.login-form input {
  width: 100%;
  height: 40px;
  border: 1px solid #343a43;
  border-radius: 7px;
  background: #0b0d10;
  color: #fff;
  font: inherit;
  font-size: 17px;
  letter-spacing: .08em;
  padding: 0 14px;
  text-align: center;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.login-form input:focus {
  border-color: #7b8796;
  box-shadow: 0 0 0 3px rgba(123, 135, 150, .13);
}
.login-form input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 107, 114, .10);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) { .summary-grid, .economics-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1440px); padding-top: 24px; }
  .header { align-items: flex-start; gap: 18px; flex-direction: column; }
  .header-status { flex-wrap: wrap; justify-content: flex-end; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .economics-grid { grid-template-columns: repeat(2, 1fr); }
  .instance-row { grid-template-columns: 1fr 1fr; }
  .gpu-grid { grid-template-columns: 1fr; }
  .gpu-stats { grid-template-columns: repeat(2, 1fr); }
}
