:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(12, 18, 30, 0.92);
  --panel-solid: #0d1420;
  --border: rgba(138, 176, 196, 0.28);
  --text: #e8f4ff;
  --muted: #b7c7d6;
  --accent: #7cffd6;
  --accent-2: #ffd166;
  --accent-3: #9db4ff;
  --danger: #ff8f8f;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #13283a, var(--bg) 52%);
  color: var(--text);
  line-height: 1.45;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 255, 214, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 255, 214, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 2;
  background: var(--accent);
  color: #041018;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.shell {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

h1 {
  margin: 0.15rem 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

h2,
h3,
h4 {
  margin: 0;
  font-size: 1.05rem;
}

h3 {
  margin: 8px 0 12px;
}

h4 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.subtitle,
.status-line,
.summary {
  color: var(--muted);
  max-width: 62ch;
  margin: 0;
}

.summary {
  margin-bottom: 8px;
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.split > .panel {
  margin-bottom: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

label,
.hint {
  display: block;
  color: var(--muted);
  margin: 0 0 8px;
}

.notice {
  color: var(--danger);
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.notice:empty {
  display: none;
}

textarea,
input[type="password"],
input[type="text"],
input[type="email"],
input[type="file"] {
  width: 100%;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

::placeholder {
  color: var(--muted);
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  margin-top: 12px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}

.btn.primary {
  background: var(--accent);
  color: #041018;
}

.btn.secondary {
  margin-top: 0;
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}

.btn:hover {
  filter: brightness(1.08);
}

.output {
  margin-top: 14px;
  min-height: 72px;
  background: var(--panel-solid);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.chart-host {
  min-height: 120px;
}

.chart-frame {
  height: 280px;
}

.chart-host-short .chart-frame {
  height: 180px;
}

.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--muted);
}

.chart-svg text {
  font-size: 11px;
  fill: currentColor;
}

.chart-grid {
  stroke: rgba(183, 199, 214, 0.2);
  stroke-width: 1;
}

.chart-zero {
  stroke: rgba(232, 244, 255, 0.35);
  stroke-width: 1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.swatch {
  width: 22px;
  border-top: 3px solid var(--accent);
}

.swatch.is-dashed {
  border-top-style: dashed;
}

.swatch.is-band {
  height: 10px;
  border: 0;
  border-radius: 3px;
  opacity: 0.8;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.table-scroll {
  max-height: 32rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 8px 0 12px;
}

.account-grid,
.starter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.starter-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

[hidden] {
  display: none !important;
}

.header-sort {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 0;
  min-height: 44px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody tr.is-selected {
  background: rgba(124, 255, 214, 0.08);
}

.row-button {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 0;
  cursor: pointer;
  min-height: 44px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.running {
  color: var(--accent-2);
  border-color: rgba(255, 209, 102, 0.55);
}

.badge.completed {
  color: var(--accent);
  border-color: rgba(124, 255, 214, 0.55);
}

.badge.failed {
  color: var(--danger);
  border-color: rgba(255, 143, 143, 0.55);
}

details summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
}

details .hint,
details .status-grid,
details .output {
  margin-top: 8px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  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: 720px) {
  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-frame,
  .chart-host-short .chart-frame {
    height: 220px;
  }

  th,
  td {
    padding: 8px;
  }
}

@media (forced-colors: active) {
  .btn,
  .panel,
  .stat-card,
  .badge {
    border: 1px solid ButtonText;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
