:root {
  --bg: #0f1b2d;
  --panel: #16263d;
  --border: #27405f;
  --text: #e8eef5;
  --muted: #8ba0ba;
  --accent: #4f9cff;
  --danger: #e5484d;
  --ok: #30a46c;
  --warn: #e2a336;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 18px;
  margin: 0;
}

.user-alias {
  color: var(--muted);
  font-size: 13px;
  margin-left: 10px;
  margin-right: auto;
}

nav {
  display: flex;
  gap: 8px;
}

.nav-btn,
button {
  font: inherit;
  cursor: pointer;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
}

.nav-btn.active {
  color: var(--text);
  border-color: var(--accent);
}

main {
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
}

.supported-note {
  max-width: 960px;
  margin: 16px auto -8px;
  padding: 10px 16px;
  background: rgba(79, 156, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.supported-note code {
  color: var(--text);
  font-size: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

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

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.start {
  background: rgba(48, 163, 108, 0.2);
  color: var(--ok);
}

.badge.stop {
  background: rgba(139, 160, 186, 0.2);
  color: var(--muted);
}

button.primary {
  background: var(--accent);
  color: #04101f;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
}

button.danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
}

/* A clear, filled action that is lower-stakes than the accent `primary` (Start): used for
   "Apply ramp". Prominent enough to read as a real button, visually distinct from Start. */
button.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

label {
  display: block;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

textarea {
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

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

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.stepper button:not(.secondary) {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

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

.readiness {
  display: flex;
  gap: 20px;
  margin: 8px 0;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot.ok {
  background: var(--ok);
}

.dot.no {
  background: var(--danger);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  max-width: 80%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-msg {
  flex: 1;
}

.toast-close {
  flex: none;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

.toast.err {
  border-color: var(--danger);
}

.toast.info {
  border-color: var(--accent);
}

.hidden {
  display: none;
}

.hint {
  font-size: 12px;
  margin-top: 4px;
}

.hint.ok {
  color: var(--ok);
}

.hint.err {
  color: var(--danger);
}

.hint.warn {
  color: var(--warn);
}

.warn-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(226, 163, 54, 0.18);
  color: var(--warn);
  white-space: nowrap;
}

.readiness-warn {
  padding: 8px 10px;
  margin: 8px -10px 0;
  border-radius: 6px;
  background: rgba(226, 163, 54, 0.1);
}

/* ---- Metrics panel (detail page) ---------------------------------------- */

.metrics h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.metrics-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.range-group {
  display: inline-flex;
  gap: 4px;
}

.range-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}

.range-btn[aria-pressed='true'] {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(79, 156, 255, 0.12);
}

.custom-range {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Override the full-width form-input default for the compact range pickers. */
.custom-range input {
  width: auto;
  padding: 4px 6px;
  color-scheme: dark;
}

.chart {
  margin-top: 16px;
}

.chart-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

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

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

.console-link {
  font-size: 12px;
  white-space: nowrap;
}

.console-link:hover,
.console-link:focus-visible {
  text-decoration: underline;
}

.stat-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font: inherit;
  font-size: 12px;
  color-scheme: dark;
}

.chart-empty {
  margin: 8px 0;
}

.chart-wrap {
  position: relative;
}

.chart-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.chart-svg .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-svg .axis {
  fill: var(--muted);
  font-size: 11px;
}

.chart-svg .series {
  fill: none;
  stroke-width: 1.75;
  stroke-linejoin: round;
}

.chart-svg .overlay {
  fill: transparent;
  cursor: crosshair;
  /* Horizontal drags zoom; let vertical swipes still scroll the page on touch screens. */
  touch-action: pan-y;
}

.chart-svg .cursor {
  stroke: var(--muted);
  stroke-dasharray: 3 3;
}

.chart-svg .selection {
  fill: var(--accent);
  fill-opacity: 0.15;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1;
}

.tooltip-time {
  color: var(--muted);
  margin-bottom: 2px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}

/* Not-shown entries are dimmed and their swatch is hollow (a shape cue, not only color), with no
   strikethrough: after a focus click most entries are not shown, and crossed-out text read as
   "removed" rather than "available to select". */
.legend-item[aria-pressed='false'] {
  opacity: 0.7;
}

.legend-item[aria-pressed='false'] .swatch {
  background: transparent !important;
  border: 2px solid var(--muted);
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}

/* In the tooltip the swatch is inline with text (no flex gap), so it needs its own spacing. */
.chart-tooltip .swatch {
  margin-right: 6px;
}

.data-details {
  margin-top: 8px;
  font-size: 12px;
}

.data-details summary {
  cursor: pointer;
  color: var(--muted);
}

.data-table-wrap {
  max-height: 260px;
  overflow: auto;
  margin-top: 6px;
}

.data-table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.data-table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table caption {
  text-align: left;
  color: var(--muted);
  padding-bottom: 4px;
}

.data-table tbody th {
  font-weight: normal;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 4px 8px;
  white-space: nowrap;
}
