:root {
  --bg: #0d1110;
  --surface: #131918;
  --surface-2: #18201e;
  --line: #293330;
  --line-soft: #202926;
  --text: #edf3ef;
  --muted: #94a39e;
  --primary: #79c7a5;
  --spawned: #e6b96c;
  --auto: #b99ce8;
  --danger: #ff9e91;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -8%, rgba(121, 199, 165, 0.09), transparent 30rem),
    var(--bg);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

button, select { font: inherit; }

.shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 26px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.raymond-logo {
  display: block;
  width: 320px;
  max-width: min(82vw, 340px);
  height: auto;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h2, p { margin-top: 0; }

h2 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 610;
  letter-spacing: -0.02em;
}

.section-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
}

.export-actions { display: flex; gap: 6px; }
.export-actions button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.export-actions button:hover { border-color: var(--primary); }

.range-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 25, 24, 0.85);
}

.range-switch button {
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.range-switch button:hover { color: var(--text); }
.range-switch button.active { color: #0d1512; background: var(--primary); font-weight: 700; }

.project-filter {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-filter select {
  min-width: 160px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.status {
  margin-top: 20px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 158, 145, 0.35);
  color: var(--danger);
  background: rgba(255, 158, 145, 0.06);
  font-size: 13px;
}
.status.success {
  border-color: rgba(121, 199, 165, 0.35);
  color: var(--primary);
  background: rgba(121, 199, 165, 0.06);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 26px;
  border: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.kpi-strip article {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
}

.kpi-strip p {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
}

.kpi-strip strong {
  display: block;
  overflow: hidden;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: clamp(18px, 2vw, 25px);
  letter-spacing: -0.045em;
  text-overflow: ellipsis;
}

.kpi-strip small { color: var(--muted); font-size: 10px; }

.token-context {
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-top: 0;
  color: var(--muted);
  background: rgba(19, 25, 24, 0.72);
  font-size: 11px;
}

.token-context div { display: flex; gap: 8px; white-space: nowrap; }
.token-context strong { color: var(--text); font-family: var(--mono); }
.token-context p { margin: 0 0 0 auto; text-align: right; }

.panel {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: rgba(19, 25, 24, 0.92);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.legend { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend .primary { background: var(--primary); }
.legend .spawned { background: var(--spawned); }
.legend .auto { background: var(--auto); }
.legend .total { background: var(--primary); }

.chart-controls { display: grid; gap: 7px; }
.chart-control-row { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.chart-control-row > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}

.segmented button {
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}
.segmented button:hover:not(:disabled) { color: var(--text); }
.segmented button.active { color: #0d1512; background: var(--primary); font-weight: 700; }
.segmented button:disabled { cursor: not-allowed; opacity: 0.38; }
.segmented button:focus-visible,
.range-switch button:focus-visible,
.export-actions button:focus-visible,
.project-filter select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.chart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 38px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.chart-meta .section-note { text-align: right; }

.trend-chart {
  min-height: 260px;
  overflow-x: auto;
  padding: 18px 14px 8px;
}

.trend-chart svg { display: block; min-width: 100%; }
.trend-chart text { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.trend-chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.trend-chart .axis { stroke: var(--line); stroke-width: 1; }
.trend-chart .series-line { fill: none; stroke: var(--primary); stroke-width: 2; }
.trend-chart .bubble { fill: rgba(121, 199, 165, 0.42); stroke: var(--primary); stroke-width: 1.5; }
.trend-chart .empty { padding: 86px 20px; color: var(--muted); text-align: center; }

.table-scroll { overflow-x: auto; }

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

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

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td { font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; }
.mono { font-family: var(--mono); }
.unknown { color: var(--spawned); }
.muted { color: var(--muted); }

.diagnostic summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
}

.diagnostic summary > span:first-child { display: grid; gap: 4px; }
.diagnostic summary .eyebrow { margin: 0; }
.diagnostic summary strong { color: var(--text); font-size: 14px; }
.diagnostic[open] summary { border-bottom: 1px solid var(--line); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 2px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

@media (max-width: 1050px) {
  .masthead { align-items: flex-start; flex-direction: column; gap: 18px; }
  .controls { width: 100%; justify-content: space-between; }
  .export-actions { margin-left: auto; }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .token-context { flex-wrap: wrap; }
  .token-context p { flex-basis: 100%; margin-left: 0; text-align: left; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1440px); padding-top: 22px; }
  .masthead { gap: 16px; padding-bottom: 18px; }
  .raymond-logo { width: 280px; max-width: 82vw; }
  .controls { align-items: stretch; flex-direction: column; }
  .range-switch { display: grid; grid-template-columns: repeat(4, 1fr); }
  .project-filter select { width: 100%; }
  .export-actions { margin-left: 0; }
  .export-actions button { flex: 1; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip article { padding: 14px; }
  .token-context { gap: 10px 18px; }
  .token-context div { width: calc(50% - 9px); justify-content: space-between; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .chart-controls, .chart-control-row { width: 100%; }
  .chart-control-row { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .chart-types button { flex: 1 0 calc(33.333% - 4px); }
  .chart-meta { align-items: flex-start; flex-direction: column; gap: 6px; }
  .chart-meta .section-note { text-align: left; }
  .legend { flex-wrap: wrap; }
  th, td { padding: 11px 14px; }
  footer { flex-direction: column; gap: 5px; }
}
