/* billing-flow.css
 *
 * Visual reskin classes ported from design/billing-flow.html. Only the
 * classes actually referenced by the four billing templates are kept here
 * (sect-card, sect-head, sect-title, sect-sub, brand-mark, banner, plan-pill,
 * renewal-note, selected-plan-banner, invoice-table, inv-status, seg-tabs,
 * seg-tab, pane, back-link, pill-default, plus a .pay-stripe .lock-meta
 * extension for the existing cs-components.css rule).
 *
 * Loaded only on:
 *   - templates/account_billing.html
 *   - templates/account_payment_methods.html
 *   - templates/payment.html
 *   - templates/pricing.html
 *   - templates/subscribe.html
 *
 * cs-components.css already owns .pay-grid, .pay-card, .cc-preview,
 * .summary-row, .plan-grid, .plan-card, .plan-features, .billing-toggle,
 * .save-tag, .btn-grad-wide, .acct-row, .acct-row-l, .acct-row-name,
 * .acct-row-sub, .acct-row-actions, .page-title, .page-sub,
 * .page-eyebrow, .page-header, .pay-stripe, .cs-empty-state,
 * .cs-modal-*, .cs-toast-fixed — we don't re-define those.
 */

/* ===== Section card (pane-level container — replaces cs-card + cs-card-section) ===== */
.sect-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
}
/* Zero-padding variant: table bleeds to card edges (invoices pane). */
.sect-card.sect-card-flush { padding: 0; }
/* Suppress invoice-table-wrap's own border when nested inside sect-card-flush. */
.sect-card-flush .invoice-table-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

/* ===== Back link ===== */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--fg-3); font-size: var(--text-sm); text-decoration: none;
  margin-bottom: var(--sp-4);
  transition: color var(--dur-fast);
}
.back-link:hover { color: var(--action); }
.back-link i { width: 14px; height: 14px; }

/* ===== Section header (used inside invoice-table-wrap) ===== */
.sect-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--sp-5); gap: var(--sp-3); flex-wrap: wrap;
}
.sect-title {
  font: var(--weight-semi) 18px/1.2 var(--font-display);
  color: var(--fg-1); margin: 0;
}
.sect-sub {
  font-size: var(--text-sm); color: var(--fg-3);
  margin: 4px 0 0; line-height: 1.5; max-width: 580px;
}

/* ===== Card brand mark (visa / mastercard / amex / discover / generic) ===== */
.brand-mark {
  width: 44px; height: 30px; border-radius: 4px; flex: none;
  display: grid; place-items: center; color: #fff;
  font: 700 10px/1 var(--font-display); letter-spacing: .06em;
  box-shadow: var(--shadow-1);
}
.brand-mark.visa       { background: linear-gradient(135deg, #1a1f71, #2c3590); }
.brand-mark.mastercard { background: linear-gradient(135deg, #eb001b, #f79e1b); }
.brand-mark.amex       { background: linear-gradient(135deg, #2e77bb, #006fcf); }
.brand-mark.discover   { background: linear-gradient(135deg, #ff6000, #faa61a); color: #1a1f71; }
.brand-mark.generic    { background: linear-gradient(135deg, #475569, #1e293b); }

/* ===== Banner (info/warn/danger/success) ===== */
.banner {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  font-size: var(--text-sm);
  display: flex; align-items: flex-start; gap: var(--sp-3);
  margin-bottom: var(--sp-4); border: 1px solid transparent;
}
.banner i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.banner-info    { background: var(--status-info-bg);    color: var(--status-info-fg); }
.banner-warn    { background: var(--status-warn-bg);    color: var(--status-warn-fg); }
.banner-danger  { background: var(--status-danger-bg);  color: var(--status-danger-fg); }
.banner-success { background: var(--status-success-bg); color: var(--status-success-fg); }

/* ===== Lock-meta extension for cs-components.css's .pay-stripe =====
   .pay-stripe is already defined in cs-components.css; we just add the
   right-aligned mono "3DS / SCA enabled" sub-label from the design. */
.pay-stripe .lock-meta {
  color: var(--fg-3); font-size: 12px;
  margin-left: auto; font-family: var(--font-mono);
}

/* ===== Stripe security strip (alias used by payment.html) =====
   Same visual as .pay-stripe but using the class name from the design. */
.stripe-strip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4);
  background: var(--action-soft);
  border: 1px solid color-mix(in srgb, var(--action) 26%, transparent);
  border-radius: var(--r-md); margin-bottom: var(--sp-5);
  font-size: var(--text-sm); color: var(--fg-1);
}
.stripe-strip i { color: var(--action); width: 16px; height: 16px; }
.stripe-strip .lock-meta { color: var(--fg-3); font-size: 12px; margin-left: auto; font-family: var(--font-mono); }

/* ===== Card preview foot labels =====
   .cc-foot is in cs-components.css; we extend it with the label row. */
.cc-foot .cc-foot-l { opacity: .55; font-size: 9px; margin-bottom: 2px; }

/* ===== Field help text (below address/card fields) ===== */
.field-help { font-size: 12px; color: var(--fg-3); margin-top: 6px; line-height: 1.4; }

/* ===== Save-card opt-in (payment page) ===== */
.save-card-opt {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface-2); border: 1px solid var(--border-1);
  border-radius: var(--r-md); cursor: pointer; user-select: none;
}
.save-card-opt input { margin-top: 3px; flex: none; accent-color: var(--action); }
.save-card-opt-text { font-size: var(--text-sm); color: var(--fg-2); line-height: 1.5; }
.save-card-opt-text b { color: var(--fg-1); font-weight: var(--weight-semi); display: block; margin-bottom: 2px; }

/* ===== Payment success overlay (payment page) ===== */
.pay-success {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; position: absolute; inset: 0;
  background: var(--bg-surface); border-radius: var(--r-xl);
  z-index: 5; text-align: center; padding: var(--sp-7);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base);
}
.pay-success.is-open { opacity: 1; pointer-events: auto; }
.pay-success-icon {
  width: 64px; height: 64px; border-radius: 999px;
  background: color-mix(in srgb, var(--risk-low) 20%, transparent);
  color: var(--risk-low); display: grid; place-items: center;
  margin-bottom: var(--sp-4);
}

/* ===== Plan pill (order-summary plan icon + label) ===== */
.plan-pill {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3); background: var(--bg-surface-2);
  border: 1px solid var(--border-1); border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.plan-pill-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--capo-cyan), var(--capo-violet));
  display: grid; place-items: center; color: #fff; flex: none;
}
.plan-pill-icon i { width: 18px; height: 18px; }

/* ===== Renewal note ===== */
.renewal-note {
  margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface-2); border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  display: flex; gap: var(--sp-3); align-items: start;
}
.renewal-note i { width: 16px; height: 16px; color: var(--action); flex: none; margin-top: 2px; }
.renewal-note p { font-size: var(--text-xs); color: var(--fg-2); line-height: 1.55; margin: 0; }

/* ===== Selected-plan banner (payment page) ===== */
.selected-plan-banner {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface-2); border: 1px solid var(--border-1);
  border-radius: var(--r-md); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.selected-plan-banner-l {
  display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 240px;
}
.selected-plan-banner-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--capo-cyan), var(--capo-violet));
  color: #fff; display: grid; place-items: center; flex: none;
}
.selected-plan-banner-name {
  font: var(--weight-semi) 16px/1.2 var(--font-display); color: var(--fg-1);
}
.selected-plan-banner-meta { color: var(--fg-3); font-size: 12px; margin-top: 2px; }
.selected-plan-banner-amount {
  font: var(--weight-bold) 22px/1 var(--font-display);
  color: var(--fg-1); font-variant-numeric: tabular-nums;
}
.selected-plan-banner-amount small {
  font-size: 12px; color: var(--fg-3);
  font-weight: var(--weight-medium); margin-left: 4px;
}

/* ===== Invoice table (Invoices tab) ===== */
.invoice-table-wrap {
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-xl); overflow: hidden;
}
.invoice-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--text-sm);
}
.invoice-table thead th {
  text-align: left; font-weight: var(--weight-semi);
  font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-3); padding: var(--sp-3) var(--sp-5);
  background: var(--bg-surface-2); border-bottom: 1px solid var(--border-1);
}
.invoice-table tbody td {
  padding: var(--sp-4) var(--sp-5);
  color: var(--fg-1); border-bottom: 1px solid var(--border-1);
  vertical-align: middle;
}
.invoice-table tbody tr:last-child td { border-bottom: 0; }
.invoice-table tbody tr { transition: background var(--dur-fast); }
.invoice-table tbody tr:hover { background: var(--bg-surface-2); }
.invoice-num {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--fg-2); font-weight: var(--weight-medium);
}
.invoice-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semi);
}
.inv-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: var(--weight-semi);
  letter-spacing: .04em; text-transform: uppercase;
}
.inv-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.inv-status.paid    { background: var(--status-success-bg); color: var(--status-success-fg); }
.inv-status.open    { background: var(--status-warn-bg);    color: var(--status-warn-fg); }
.inv-status.void    { background: var(--bg-surface-3);      color: var(--fg-3); }
.inv-status.failed  { background: var(--status-danger-bg);  color: var(--status-danger-fg); }
.inv-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ===== Tabs (saved cards / billing details / invoices) ===== */
.seg-tabs {
  display: inline-flex; padding: 4px;
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: 999px; margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.seg-tab {
  padding: 8px 18px; border-radius: 999px;
  background: transparent; color: var(--fg-2);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  border: 0; cursor: pointer; font-family: inherit;
  transition: all var(--dur-fast);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg-tab.is-active { background: var(--action); color: #fff; }
.seg-tab:hover:not(.is-active) { color: var(--fg-1); }
.seg-tab i { width: 14px; height: 14px; }

.pane { display: none; }
.pane.is-active { display: block; animation: bf-fadeUp .25s var(--ease-standard); }

@keyframes bf-fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ===== Pill badges inside .acct-row-name ===== */
.pill-default, .pill-warn {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  font-weight: var(--weight-semi); letter-spacing: .04em;
  text-transform: uppercase;
}
.pill-default {
  background: color-mix(in srgb, var(--risk-low) 14%, transparent);
  color: var(--risk-low);
}
[data-theme="light"] .pill-default {
  background: color-mix(in srgb, var(--risk-low) 18%, transparent);
  color: var(--risk-low-deep);
}
.pill-warn {
  background: var(--status-warn-bg);
  color: var(--status-warn-fg);
}

/* ===== Field help text (below inputs in billing details) ===== */
.field-help {
  font-size: 12px; color: var(--fg-3);
  margin-top: 6px; line-height: 1.4;
}

/* ===== Form actions row (Save / Cancel at bottom of billing-details form) ===== */
.form-actions {
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  margin-top: var(--sp-5); padding-top: var(--sp-5);
  border-top: 1px solid var(--border-1); flex-wrap: wrap;
}

/* ===== Disclosure / tax-id toggle ===== */
.disclosure { margin-top: var(--sp-4); }
.disclosure summary {
  cursor: pointer; color: var(--fg-2); font-size: 14px;
  padding: 8px 0; font-weight: var(--weight-medium);
  list-style: none; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before {
  content: "\25B8 ";
  display: inline-block; margin-right: 6px;
  transition: transform 0.18s ease;
}
.disclosure[open] summary::before { transform: rotate(90deg); }
.disclosure-body { padding: var(--sp-3) 0; }

/* ===== Field row (2-up grid inside .disclosure-body) ===== */
.field-row {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3);
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* ===== Empty state (cards pane / invoices pane) ===== */
.empty-state {
  text-align: center; padding: var(--sp-7) var(--sp-4);
  border: 1.5px dashed var(--border-2); border-radius: var(--r-lg);
  background: var(--bg-surface-2);
}
.empty-state-icon {
  width: 56px; height: 56px; margin: 0 auto var(--sp-3); border-radius: 999px;
  background: var(--bg-surface); display: grid; place-items: center;
  color: var(--fg-3);
}
.empty-state-icon i { width: 24px; height: 24px; }
.empty-state h3 {
  font: var(--weight-semi) 16px/1.3 var(--font-display); color: var(--fg-1);
  margin: 0 0 var(--sp-2);
}
.empty-state p { font-size: var(--text-sm); color: var(--fg-3); margin: 0; }
