/* BOKS billing page — layout only; tokens/primitives come from style.css. */

.billing-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.billing-top {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 11, 0.94);
  backdrop-filter: blur(10px);
}

.billing-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  font-size: 13px;
}

.billing-nav > a:not(.btn) {
  color: var(--muted);
  transition: color 0.15s ease;
}

.billing-nav > a:not(.btn):hover {
  color: var(--text);
}

.billing-main {
  padding: clamp(42px, 7vw, 82px) 0 90px;
}

.container-wide {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
}

.billing-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: clamp(34px, 5vw, 54px);
}

.billing-head h1 {
  margin: 10px 0 16px;
  font-size: clamp(2.4rem, 5.2vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 500;
}

.billing-lead {
  max-width: 54ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.billing-account {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}

.billing-account .mono {
  font-size: 13px;
  letter-spacing: 0.06em;
}

.billing-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 220px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---------- Current plan ---------- */
.current-plan {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: center;
  padding: clamp(22px, 3vw, 32px);
  margin-bottom: clamp(46px, 6vw, 72px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    linear-gradient(110deg, rgba(217, 255, 77, 0.045), transparent 48%),
    var(--bg-elev);
}

.current-plan-name {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 10px;
}

.current-plan-name h2 {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
  font-weight: 500;
}

.current-plan-main p {
  max-width: 46ch;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.current-plan-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.current-plan-stats > div {
  padding: 14px 15px;
  background: var(--bg-elev-2);
}

.current-plan-stats dt {
  margin-bottom: 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.current-plan-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------- Plans ---------- */
.billing-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.billing-section-head h2 {
  margin-top: 8px;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  letter-spacing: -0.045em;
  font-weight: 500;
}

.billing-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.currency-toggle,
.term-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--bg-elev);
}

.currency-btn {
  min-width: 54px;
  padding: 8px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.currency-btn:hover {
  color: var(--text);
}

.currency-btn.is-active {
  background: var(--accent);
  color: #0a0a0b;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.plan-card:hover {
  border-color: var(--line-strong);
}

.plan-card.is-featured {
  border-color: rgba(217, 255, 77, 0.45);
  background:
    linear-gradient(180deg, rgba(217, 255, 77, 0.05), transparent 34%),
    var(--bg-elev);
}

.plan-card.is-current {
  border-color: rgba(217, 255, 77, 0.8);
  box-shadow: 0 0 0 1px rgba(217, 255, 77, 0.25) inset;
}

.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.plan-card-head h3 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.plan-card-head .badge {
  font-size: 8px;
}

.plan-quota {
  margin: 18px 0 3px;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 2.5vw, 1.95rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.plan-price {
  display: block;
  min-height: 34px;
  margin-bottom: 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
}

.plan-price strong {
  color: var(--text);
  font-weight: 500;
}

.plan-price .per {
  color: var(--dim);
}

.plan-price-usd {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.plan-features {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0 0 22px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-features li {
  display: flex;
  gap: 7px;
}

.plan-features li::before {
  content: "·";
  color: var(--accent);
}

.plan-card .btn {
  margin-top: auto;
}

.plan-card .plan-note {
  margin-top: 10px;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}

.plan-card .btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

/* ---------- Promo code ---------- */
.promo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.promo-row .label {
  margin: 0;
  white-space: nowrap;
}

.promo-row .input {
  width: 190px;
  text-transform: uppercase;
}

.promo-row .hint {
  margin: 0;
}

.checkout-promo {
  margin: 6px 0 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

@media (max-width: 760px) {
  .promo-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .promo-row .input {
    width: 100%;
  }
}

/* ---------- Checkout ---------- */
.checkout {
  margin-top: clamp(46px, 6vw, 76px);
  padding: clamp(22px, 3.5vw, 34px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-elev);
}

.checkout-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.checkout-head h2 {
  margin-top: 7px;
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  letter-spacing: -0.04em;
  font-weight: 500;
}

.checkout-head .icon-btn {
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 14px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(26px, 4vw, 44px);
  align-items: start;
}

.checkout-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.checkout-qr {
  display: block;
  width: min(240px, 100%);
  height: auto;
  border-radius: 4px;
  background: #fff;
  padding: 10px;
}

.checkout-qr-caption {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-plan-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.checkout-amount-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 24px;
}

.checkout-amount {
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.checkout-currency {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.checkout-usd {
  margin: -16px 0 24px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}

.checkout-field {
  margin-bottom: 15px;
}

.checkout-field .micro-label {
  display: block;
  margin-bottom: 7px;
}

.checkout-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkout-value-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.checkout-value-row .icon-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 56px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-uri {
  max-height: 58px;
  overflow: auto;
}

.checkout-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.checkout-note {
  margin-top: 18px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.65;
}

/* ---------- History ---------- */
.billing-history {
  margin-top: clamp(46px, 6vw, 76px);
}

.invoice-list {
  border-top: 1px solid var(--line);
}

.invoice-empty {
  padding: 24px 0;
  color: var(--dim);
  font-size: 12.5px;
}

.invoice-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1.3fr) minmax(0, 1fr) 120px 90px;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.invoice-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.invoice-plan {
  color: var(--text);
}

.invoice-amount {
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.invoice-status {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.invoice-status.is-paid {
  color: var(--ok);
}

.invoice-status.is-pending {
  color: var(--accent);
}

.invoice-view {
  justify-self: end;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.invoice-view:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.billing-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: clamp(46px, 6vw, 76px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.billing-note {
  padding: 18px 19px;
  background: var(--bg-elev);
}

.billing-note .micro-label {
  font-size: 9px;
}

.billing-note p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

@media (max-width: 1040px) {
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .current-plan {
    grid-template-columns: 1fr;
  }
  .billing-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container-wide {
    width: calc(100% - 32px);
  }
  .billing-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
  }
  .billing-nav {
    gap: 14px;
  }
  .billing-nav > a:not(.btn) {
    display: inline;
    font-size: 12px;
  }
  .billing-section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .plan-card {
    min-height: 0;
  }
  .checkout-grid {
    grid-template-columns: 1fr;
  }
  .checkout-qr-wrap {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
  .checkout-qr {
    width: 100%;
  }
  .invoice-row {
    grid-template-columns: 1fr auto;
    gap: 6px 14px;
    padding: 15px 0;
  }
  .invoice-date {
    grid-column: 1;
    grid-row: 1;
  }
  .invoice-plan {
    grid-column: 1;
    grid-row: 2;
    font-size: 13px;
  }
  .invoice-amount {
    grid-column: 1;
    grid-row: 3;
  }
  .invoice-status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .invoice-view {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: center;
  }
  .current-plan-stats {
    grid-template-columns: 1fr;
  }
}
