*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0d0d;
  --surface:  #1a1a1a;
  --surface2: #242424;
  --border:   #2e2e2e;
  --accent:   #c96442;
  --accent2:  #e07c56;
  --text:     #e8e8e8;
  --muted:    #888;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent2);
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.75rem 1.25rem;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

main { flex: 1; padding: 2rem; }

.state-msg {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.state-msg.error { color: #f87171; }

.tab-panel { display: none; }
.tab-panel.visible { display: block; }

/* Overview cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.card.highlight { border-color: var(--accent); }

.card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--mono);
}

.card.highlight .card-value { color: var(--accent2); }

.updated {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Models tab */
.model-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.model-name {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent2);
  margin-bottom: 0.75rem;
}

.model-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  font-size: 0.82rem;
}

.stat-label { color: var(--muted); font-size: 0.75rem; }
.stat-value { font-family: var(--mono); }

.bar-wrap {
  background: var(--surface2);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Footer */
footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

#refresh-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  transition: border-color 0.15s;
}

#refresh-btn:hover { border-color: var(--accent2); }

#refresh-status { font-size: 0.8rem; color: var(--muted); }

/* CC panel — mimics Claude Code Usage Stats */
.cc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.75rem;
}

.cc-panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
  font-weight: 600;
  white-space: nowrap;
}

.section-note {
  font-size: 0.75rem;
  color: var(--muted);
}

.cc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.cc-stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}

.cc-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.cc-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--mono);
}

/* Heatmap calendar */
.cc-heatmap {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  grid-auto-flow: column;
  gap: 2px;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 2px; /* prevent scrollbar clipping on some browsers */
}

.hm-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--surface2);
}

.hm-cell.hm-1 { background: #1a3d6e; }
.hm-cell.hm-2 { background: #1a5fa0; }
.hm-cell.hm-3 { background: #2181d4; }
.hm-cell.hm-4 { background: #60a5fa; }

@media (max-width: 640px) {
  .cc-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
