:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --sidebar-bg: #f3f1ed;
  --text: #1f1d1a;
  --muted: #6f6a62;
  --border: #e4e0d9;
  --hover: rgba(0, 0, 0, 0.05);
  --accent: #d9622b;
  --accent-contrast: #ffffff;
  --ai: #6a45d6;
  --hl: #ff8c1a;
  --spec: #6a45d6;
  --ir: #b8860b;
  --ok: #2e8b57;
  --warn: #b7791f;
  --bad: #c0392b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 30px rgba(40, 30, 20, 0.07);
  --radius: 22px;
  --sidebar-w: 280px;
  --btn-grad: linear-gradient(115deg, #c2501a, #6a45d6);
  --btn-grad-alt: linear-gradient(115deg, #6a45d6, #2a6fd0);
  --on-grad: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #1b1a18;
  --surface: #262522;
  --sidebar-bg: #151413;
  --text: #f1eee8;
  --muted: #a39d93;
  --border: #36342f;
  --hover: rgba(255, 255, 255, 0.07);
  --accent: #e8794a;
  --accent-contrast: #1b1a18;
  --ai: #a78bfa;
  --spec: #a78bfa;
  --ir: #e5b04a;
  --ok: #55c58a;
  --warn: #e0a84a;
  --bad: #ef7a6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 30px rgba(0, 0, 0, 0.35);
  --btn-grad: linear-gradient(115deg, #e8794a, #a78bfa);
  --btn-grad-alt: linear-gradient(115deg, #a78bfa, #60a5fa);
  --on-grad: #1b1a18;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a18;
    --surface: #262522;
    --sidebar-bg: #151413;
    --text: #f1eee8;
    --muted: #a39d93;
    --border: #36342f;
    --hover: rgba(255, 255, 255, 0.07);
    --accent: #e8794a;
    --accent-contrast: #1b1a18;
    --ai: #a78bfa;
    --spec: #a78bfa;
    --ir: #e5b04a;
    --ok: #55c58a;
    --warn: #e0a84a;
    --bad: #ef7a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 30px rgba(0, 0, 0, 0.35);
    --btn-grad: linear-gradient(115deg, #e8794a, #a78bfa);
    --btn-grad-alt: linear-gradient(115deg, #a78bfa, #60a5fa);
    --on-grad: #1b1a18;
  }
}

.credit-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding-inline: 12px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; white-space: nowrap; text-decoration: none;
  transition: border-color .2s, background .2s;
}
.credit-chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.credit-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
.credit-chip b { font-weight: 700; font-variant-numeric: tabular-nums; }
.credit-chip span { color: var(--muted); font-size: 13px; }
.credit-chip[data-level="low"] { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.credit-chip[data-level="low"] svg { color: var(--warn); }
.credit-chip[data-level="empty"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.credit-chip[data-level="empty"] svg, .credit-chip[data-level="empty"] b { color: var(--bad); }
.credit-chip[hidden] { display: none; }

.credit-cost { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; color: var(--muted); }
.credit-cost:empty { display: none; }
.credit-cost b { color: var(--text); font-weight: 600; }
.credit-cost .is-short, .credit-cost .cost__short { color: var(--bad); }
.credit-cost .cost__warn { color: var(--warn); }
.credit-cost .link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
