.menu-credit-chip small { white-space: nowrap; }

html.purchase-dialog-open,
html.purchase-dialog-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.billing-sheet {
  width: min(920px, calc(100vw - 24px));
  max-width: 920px;
  max-height: min(88vh, 860px);
  padding: 0;
  overflow: auto;
}

.billing-sheet-compact {
  width: min(620px, calc(100vw - 24px));
  max-width: 620px;
}

.purchase-sheet {
  padding-bottom: 26px;
  overscroll-behavior: contain;
}

.billing-sheet .sheet-head {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 24px 26px 18px;
  background: color-mix(in srgb, var(--paper, #fffdf8) 94%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.purchase-intro {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--muted, #6f7067);
  font-size: .88rem;
  line-height: 1.5;
}

.billing-sheet > .banner,
.billing-section,
.billing-activity {
  margin-inline: 26px;
}

.billing-section { margin-top: 26px; }
.purchase-current-plan { margin-bottom: 20px; padding: 16px 18px; border-radius: 14px; background: #edf2db; color: #315033; }
.purchase-current-plan p { margin: 0; font-size: .88rem; line-height: 1.5; }
.purchase-current-plan p + p { margin-top: 4px; }
.next-credit-purchase-status { margin: 0 0 16px; padding: 13px 15px; border: 1px solid #d5ddc0; border-radius: 14px; background: #edf2db; color: #315033; font-size: .82rem; font-weight: 700; line-height: 1.45; }
.billing-section-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 12px; }
.billing-section-head h3 { margin: 0 0 4px; }
.billing-section-head p { margin: 0; color: var(--muted, #6f7067); font-size: .88rem; }

.package-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.package-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: 146px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper, #fffdf8) 96%, #eef5e8);
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.package-card:hover:not(.unavailable) { border-color: color-mix(in srgb, #c94d20 48%, transparent); }
.package-card:focus-visible { outline: 3px solid color-mix(in srgb, #0064d8 34%, transparent); outline-offset: 3px; }
.package-card.selected { border-color: #c94d20; background: color-mix(in srgb, var(--paper, #fffdf8) 91%, #fff1e9); box-shadow: 0 0 0 1px #c94d20, 0 14px 34px #c94d2014; }
.package-card.current-plan:not(.selected) { border-color: #a9bf8c; background: color-mix(in srgb, var(--paper, #fffdf8) 88%, #edf2db); }
.package-card.unavailable { cursor: default; }
.package-card.sold-out { opacity: .68; }
.package-card-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; width: 100%; }
.package-badges { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 4px 8px; justify-content: flex-end; }
.package-badge { color: #c94d20; font-size: .62rem; font-weight: 800; letter-spacing: .06em; line-height: 1.25; text-align: right; text-transform: uppercase; }
.package-badge.current { color: #2f7f4f; }
.package-badge.sold-out { color: #ad2f2f; }
.package-name { font-size: 1rem; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.package-detail { color: var(--muted, #6f7067); font-size: .8rem; font-weight: 700; line-height: 1.4; }
.package-detail.seats-left { color: #2f7f4f; }
.package-price { margin-top: auto; font-family: "Space Grotesk", sans-serif; font-size: 1.75rem; line-height: 1; letter-spacing: -.04em; }
.package-price-row { display: flex; gap: 9px; align-items: flex-end; margin-top: auto; }
.package-price-row .package-price { margin-top: 0; }
.package-compare-price { padding-bottom: 2px; color: var(--muted, #6f7067); font-size: .92rem; line-height: 1; text-decoration: line-through; }

.package-checkout { display: flex; gap: 24px; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 20px; border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent); }
.package-checkout-summary { display: grid; gap: 3px; min-width: 0; }
.package-checkout-summary span { color: var(--muted, #6f7067); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.package-checkout-summary strong { overflow: hidden; font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
.package-checkout > button { flex: 0 0 auto; min-width: 210px; }

.referral-panel { padding: 18px; border-radius: 20px; background: #fff1e9; }
.referral-link-row { display: flex; gap: 8px; }
.referral-link-row input { min-width: 0; flex: 1; }
.referral-panel > small { display: block; margin-top: 9px; color: #755f55; }
.billing-activity { margin-block: 24px 30px; }
.billing-sheet-compact .billing-section { margin-bottom: 28px; }

@media (max-width: 470px) {
  .billing-sheet .sheet-head { padding-inline: 18px; }
  .billing-sheet > .banner, .billing-section, .billing-activity { margin-inline: 18px; }
  .package-catalog { grid-template-columns: 1fr; }
  .package-card { gap: 10px; min-height: 0; padding-block: 14px; }
  .package-checkout { align-items: stretch; flex-direction: column; gap: 12px; margin-top: 18px; padding-top: 16px; }
  .package-checkout > button { width: 100%; }
  .referral-link-row { align-items: stretch; flex-direction: column; }
}
