.billing-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.billing-header {
  margin-bottom: 0.5rem;
}

.billing-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Danger banner ─── */

.billing-danger-banner {
  background: var(--red-dim);
  border: 1px solid rgba(224,92,58,0.35);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  padding: 0.75rem 1rem;
  line-height: 1.5;
}

/* ─── Sections ─── */

.billing-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.billing-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.billing-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Current plan row ─── */

.billing-plan-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.billing-plan-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Badges ─── */

.billing-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}

.billing-badge--green  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(61,186,116,0.3); }
.billing-badge--yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(212,160,23,0.3); }
.billing-badge--red    { background: var(--red-dim); color: var(--accent); border: 1px solid rgba(224,92,58,0.3); }
.billing-badge--gray   { background: var(--bg3); color: var(--muted); border: 1px solid var(--border2); }

/* ─── Usage grid ─── */

.billing-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.billing-usage-item {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.billing-usage-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.billing-usage-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.billing-usage-value--warn {
  color: var(--accent);
}

/* ─── Plan cards ─── */

.billing-plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.billing-plan-card {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.billing-plan-card--current {
  border-color: rgba(61,186,116,0.4);
  background: linear-gradient(135deg, var(--bg3), #1a2e20);
}

.billing-plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.billing-plan-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.billing-plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.billing-plan-features li {
  font-size: 12px;
  color: var(--muted);
  padding-left: 1rem;
  position: relative;
}

.billing-plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
  font-size: 10px;
  top: 1px;
}

.billing-plan-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.billing-plan-btn {
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: normal;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.billing-plan-btn--outline {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
}

.billing-plan-btn--outline:hover {
  background: var(--bg3);
  border-color: var(--muted);
  color: var(--text);
}

/* ─── Portal section ─── */

.billing-section--portal {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.billing-section--portal > div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.billing-portal-btn {
  font-size: 12px;
  padding: 8px 18px;
  white-space: nowrap;
  flex-shrink: 0;
}
