/* Credits page: monthly spending limit card (#sec-budget) and its edit
   dialog. Rendered by loadBudget() / openBudgetDialog() in app.js. Only
   tokens from app.css, so both themes follow the :root[data-theme] swaps. */

/* A panel inside the Credits card, between the balance insights and the
   packs: Balance, Spent, then the cap on spending. */
.bud-card {
  margin-top: 18px;
  padding: 14px 16px 16px;
  border-radius: var(--radius-lg);
  background: var(--vercel-surface);
  box-shadow: inset 0 0 0 1px var(--vercel-border);
}
.bud-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--vercel-text);
  letter-spacing: -0.01em;
}
.bud-card .bud-intro { margin: 2px 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--vercel-muted); }

.bud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}
.bud-text { min-width: 0; flex: 1 1 260px; }
.bud-figure {
  font-size: 15px;
  font-weight: 500;
  color: var(--vercel-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
.bud-num { font-weight: 600; }
.bud-dot, .bud-reset { color: var(--vercel-muted); font-weight: 400; }
.bud-sub { margin-top: 2px; font-size: 12.5px; color: var(--vercel-muted); font-variant-numeric: tabular-nums; }
.bud-btn { flex: none; height: 32px; padding: 0 14px; font-size: 13px; }

/* Bar: brand green, amber from 80%, red at the limit. */
.bud-meter {
  margin-top: 14px;
  height: 6px;
  border-radius: 999px;
  background: var(--vercel-pressed);
  overflow: hidden;
}
.bud-meter span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--emerald);
  transition: width 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bud-meter.bud-near span { background: var(--amber); }
.bud-meter.bud-over span { background: var(--red); }
.bud-card .bud-note {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--red);
}
.bud-card .bud-soon { font-size: 13px; line-height: 1.55; color: var(--vercel-muted); }
.bud-card.bud-unavailable .bud-intro { display: none; }
.bud-card.bud-unavailable .bud-soon { margin-top: 4px; }

/* Dialog: reuses .confirm-overlay / .confirm-modal. */
.bud-modal { width: min(440px, calc(100vw - 32px)); }
.bud-modal .confirm-body { margin-bottom: 16px; }
.bud-field input { font-variant-numeric: tabular-nums; }
.bud-help {
  margin: 8px 0 14px;
  min-height: 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--vercel-muted);
  font-variant-numeric: tabular-nums;
}
.bud-error { margin-bottom: 14px; line-height: 1.5; }
.bud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bud-btns { display: flex; gap: 10px; margin-left: auto; }
.bud-btns .btn-secondary,
.bud-btns .btn-primary { min-width: 92px; height: 36px; font-size: 13.5px; justify-content: center; }
.bud-remove {
  background: none;
  border: none;
  padding: 6px 0;
  font: inherit;
  font-size: 13px;
  color: var(--red);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
}
.bud-remove:hover { text-decoration-color: currentColor; }
.bud-remove:disabled { opacity: .5; cursor: default; }
.bud-remove:focus-visible { outline: none; box-shadow: var(--vercel-focus); border-radius: var(--radius-sm); }

/* "Open Credits" in the BUDGET_REACHED toast (noteBudgetReached). */
.toast a.bud-toast-link {
  color: var(--vercel-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .bud-btn { width: 100%; }
  .bud-btns { width: 100%; margin-left: 0; }
  .bud-btns .btn-secondary, .bud-btns .btn-primary { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bud-meter span { transition: none; }
}
