.portal-usage {
  display: flex;
  flex-direction: column;
}

/* Sticky page header: a full-bleed bar (sidebar tint + bottom border). The
   scroll container is .portal-shell__view (overflow-y:auto), whose top already
   sits just below the global .portal-header — so this pins at top:0 of the view,
   flush under the global bar. */
.portal-usage__header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-sidebar-bg);
  border-bottom: 1px solid var(--color-border);
}
.portal-usage__header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

/* Body is full-bleed (just padding) — the billing surface runs edge-to-edge to
   match marketing, same as the free view. */
.portal-usage__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}

.portal-usage__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-text-1);
}

.portal-usage__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-4);
}

/* Two-column row: current plan + spend cap */
.portal-usage__row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 60rem) {
  .portal-usage__row {
    grid-template-columns: 1fr;
  }
}

/* Section headers */
.portal-usage__section-head {
  margin-bottom: 0.875rem;
}

.portal-usage__section-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-1);
}

.portal-usage__section-sub {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--color-text-4);
}

/* Current plan card */
.portal-usage__plan-current {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.portal-usage__plan-current-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.portal-usage__plan-eyebrow {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-5);
}

.portal-usage__plan-name {
  margin: 0.125rem 0 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-1);
}

/* Wallet contract card */
.portal-usage__wallet {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.portal-usage__wallet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.portal-usage__wallet-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Wallet hero metric — mirrors the SaaS plan-card price block */
.portal-usage__wallet-hero {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.portal-usage__wallet-hero-value {
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text-1);
  font-variant-numeric: tabular-nums;
}

.portal-usage__wallet-hero-unit {
  font-size: 0.875rem;
  color: var(--color-text-4);
}

/* Cap progress (free) */
.portal-usage__cap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-usage__cap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--color-text-2);
}

.portal-usage__cap-pct {
  font-weight: 600;
  color: var(--color-text-1);
  font-variant-numeric: tabular-nums;
}

/* Breakdown rows (pro / enterprise) */
.portal-usage__breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.portal-usage__breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--color-border-light);
}

.portal-usage__breakdown-row:last-child {
  border-bottom: none;
}

.portal-usage__breakdown-label {
  color: var(--color-text-3);
}

.portal-usage__breakdown-value {
  font-weight: 600;
  color: var(--color-text-1);
  font-variant-numeric: tabular-nums;
}

.portal-usage__breakdown-row--total {
  margin-top: 0.25rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.portal-usage__breakdown-row--total .portal-usage__breakdown-label {
  color: var(--color-text-1);
  font-weight: 600;
}

.portal-usage__plan-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: auto;
}

/* Available plan cards */
.portal-usage__plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
}

@media (max-width: 60rem) {
  .portal-usage__plans-grid {
    grid-template-columns: 1fr;
  }
}

.portal-usage__plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.portal-usage__plan-card--current {
  outline: 1.5px solid color-mix(in srgb, var(--color-green) 45%, transparent);
  outline-offset: -1px;
}

.portal-usage__plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.portal-usage__plan-card-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-1);
}

.portal-usage__plan-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.portal-usage__plan-card-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-1);
}

.portal-usage__plan-card-cadence {
  font-size: 0.75rem;
  color: var(--color-text-4);
}

.portal-usage__plan-card-blurb {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-3);
}

.portal-usage__plan-card-features {
  list-style: none;
  margin: 0.25rem 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  flex: 1;
}

.portal-usage__plan-card-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-2);
}

.portal-usage__plan-card-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.0625rem;
  border-radius: 50%;
  background: var(--color-green-light);
  color: var(--color-green-dark);
  font-size: 0.625rem;
  font-weight: 700;
}

/* Spend-cap card */
.portal-usage__cap-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.portal-usage__cap-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.portal-usage__cap-slider {
  margin: 0.25rem 0;
}

.portal-usage__cap-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.75rem;
  color: var(--color-text-4);
}

/* Billing history */
.portal-usage__hist-date {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-2);
}

.portal-usage__hist-amount {
  font-weight: 600;
  color: var(--color-text-1);
  font-variant-numeric: tabular-nums;
}

.portal-usage__hist-credit {
  font-weight: 600;
  color: var(--color-green-dark);
  font-variant-numeric: tabular-nums;
}

.portal-usage__hist-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Upgrade modal */
.portal-usage__modal-body {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text-2);
}

.portal-usage__modal-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-usage__modal-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-2);
}

.portal-usage__modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
}
