:root {
  --bg: #0f1115;
  --fg: #e6e8eb;
  --muted: #8a8f99;
  --panel: #161a21;
  --border: #232830;
  --accent: #5e9eff;
  --stt: #7bd389;
  --tts: #f0b35d;
  --llm: #b791ff;
  --danger: #ef6b6b;
  --warn: #f0b35d;
  --ok: #7bd389;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }

.hdr {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}
.hdr .brand { font-weight: 600; letter-spacing: 0.4px; color: var(--accent); }
.hdr .title { flex: 1; font-size: 15px; color: var(--muted); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #555; transition: background 200ms;
}
.live.online .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.live.online #liveLabel { color: var(--ok); }

.auth-gate {
  max-width: 480px;
  margin: 80px auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.auth-gate input {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 6px;
  font: inherit;
}
.auth-gate button {
  margin-top: 10px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.auth-gate .hint { font-size: 12px; color: var(--muted); margin-top: 12px; }
.auth-gate code { background: var(--bg); padding: 1px 4px; border-radius: 3px; }

.content { max-width: 1200px; margin: 0 auto; padding: 20px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.card .value { font-size: 28px; font-weight: 600; margin: 6px 0 4px; }
.card .sub { color: var(--muted); font-size: 12px; }

.card.budget .bar {
  margin-top: 8px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.card.budget .bar-fill {
  height: 100%;
  background: var(--ok);
  width: 0%;
  transition: width 300ms;
}
.card.budget.warn .bar-fill { background: var(--warn); }
.card.budget.over .bar-fill { background: var(--danger); }

.panel {
  margin: 18px 0;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.panel-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-hdr h2 { margin: 0; font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }

#hourlyChart, #dailyChart { width: 100%; height: auto; display: block; }

.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before {
  content: ""; width: 10px; height: 10px; border-radius: 2px; display: inline-block;
}
.lg-stt::before { background: var(--stt); }
.lg-tts::before { background: var(--tts); }
.lg-llm::before { background: var(--llm); }

.totals { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.totals b { color: var(--fg); }

.event-log {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  font: 12px/1.45 ui-monospace, "Cascadia Mono", Menlo, monospace;
}
.event-log li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.event-log li:last-child { border-bottom: none; }
.event-log .ts { color: var(--muted); margin-right: 8px; }
.event-log .cost { color: var(--accent); font-weight: 600; }

select, button.ghost {
  padding: 6px 10px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
