/* In-app billing: plan picker, card on file, invoices, and the secure payment sheet. */

/* ---------- Plan picker ---------- */
.billing-panel .plan-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px 18px 6px;
}
.plan-option {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e3e4f1;
  box-shadow: 0 1px 2px #1b1a4a0d, 0 8px 22px #1b1a4a0f;
  transition: transform 240ms var(--ease-out, ease), box-shadow 240ms, border-color 240ms;
}
.plan-option:hover {
  transform: translateY(-2px);
  border-color: #c9bff5;
  box-shadow: 0 2px 4px #1b1a4a12, 0 16px 34px #1b1a4a1a;
}
.plan-option h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
}
.plan-option header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b6f8c;
  line-height: 1.5;
}
.plan-price {
  margin: 2px 0 0;
}
.plan-price strong {
  font-size: 28px;
  letter-spacing: -0.8px;
  color: #14172b;
}
.plan-price span {
  font-size: 13px;
  color: #6b6f8c;
}
.plan-total {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #2d2170;
}
.plan-total span {
  font-weight: 400;
  color: #8a8ea8;
}
.plan-option .button {
  justify-content: center;
  min-height: 42px;
}
.seat-stepper {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid #dcdeee;
  border-radius: 999px;
  overflow: hidden;
}
.seat-stepper button {
  width: 36px;
  height: 34px;
  border: 0;
  background: #f6f5fd;
  color: #4a35c0;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 160ms;
}
.seat-stepper button:hover:not(:disabled) {
  background: #ebe7fd;
}
.seat-stepper button:disabled {
  color: #c4c3d8;
  cursor: not-allowed;
}
.seat-stepper output {
  min-width: 84px;
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.billing-empty {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 16px 18px 4px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(150deg, #f8f7ff, #fff);
  border: 1px dashed #d6d0f5;
}
.billing-empty-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #efeaff;
  color: #5843ce;
}
.billing-empty p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #6b6f8c;
}

/* ---------- Card on file ---------- */
.billing-panel .billing-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 18px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #efeff7;
  background: #fff;
}
.billing-card > div {
  flex: 1;
}
.billing-card .field-help {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.billing-card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(150deg, #1d2148, #11172c);
  color: #fff;
}
.billing-exp {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #8a8ea8;
}

/* ---------- Invoices ---------- */
.billing-panel .billing-invoices {
  margin: 16px 18px 0;
}
.billing-invoices h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #5b5f7a;
}
.billing-invoices ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #efeff7;
  border-radius: 14px;
  overflow: hidden;
}
.billing-invoices li {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #f1f1f8;
  font-size: 13px;
}
.billing-invoices li:first-child {
  border-top: 0;
}
.inv-number {
  color: #6b6f8c;
  font-variant-numeric: tabular-nums;
}
.inv-amount {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.inv-status {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: #f1f1f8;
  color: #5b5f7a;
}
.inv-status.paid {
  background: #1fbf6a1a;
  color: #128a4b;
}
.inv-status.open {
  background: #fff4e5;
  color: #b45309;
}
@media (max-width: 700px) {
  .billing-invoices li {
    grid-template-columns: 1fr auto;
  }
  .inv-number,
  .inv-status {
    display: none;
  }
}

/* ---------- Secure payment sheet ---------- */
.pay-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade-in 220ms var(--ease-out, ease) both;
}
.pay-sheet.closing {
  animation: fade-in 220ms var(--ease-in-out, ease) reverse both;
}
.pay-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: #0f1330b3;
  backdrop-filter: blur(8px) saturate(120%);
}
.pay-sheet-card {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 40px 120px #05061a80;
  animation: dialog-in 380ms var(--ease-spring, ease) both;
}
.pay-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid #efeff7;
  background: linear-gradient(180deg, #faf9ff, #fff);
}
.pay-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #128a4b;
}
.pay-kicker .icon {
  width: 14px;
  height: 14px;
}
.pay-sheet-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.4px;
}
.pay-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f1f1f8;
  color: #3d4160;
  cursor: pointer;
  transition: transform 260ms var(--ease-spring, ease), background-color 200ms;
}
.pay-close:hover {
  transform: rotate(90deg);
  background: #e7e6f5;
}
.pay-sheet-body {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.4fr);
  min-height: 420px;
}
.pay-summary {
  padding: 24px 26px;
  background: linear-gradient(180deg, #f8f7ff, #fff);
  border-right: 1px solid #efeff7;
}
.pay-summary h3 {
  margin: 0 0 14px;
  font-size: 18px;
}
.pay-summary dl {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}
.pay-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.pay-summary dt {
  color: #6b6f8c;
}
.pay-summary dd {
  margin: 0;
  font-weight: 650;
  color: #14172b;
}
.pay-summary-copy {
  font-size: 14px;
  line-height: 1.6;
  color: #4b4f66;
}
.pay-promise,
.pay-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #4b4f66;
}
.pay-promise .icon,
.pay-note .icon {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: #128a4b;
}
.pay-frame {
  position: relative;
  padding: 16px;
  min-width: 0;
}
.pay-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 320px;
  color: #6b6f8c;
  font-size: 14px;
}
.pay-loading span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #dcd6fb;
  border-top-color: #5843ce;
  animation: spin 800ms linear infinite;
}
.pay-done {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 70px 24px;
  text-align: center;
  animation: rise-in 420ms var(--ease-out, ease) both;
}
.pay-done-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(160deg, #34d77f, #16a35a);
  color: #fff;
  box-shadow: 0 12px 30px #1fbf6a55;
  animation: pop-in 420ms var(--ease-spring, ease) both;
}
.pay-done-icon .icon {
  width: 30px;
  height: 30px;
}
.pay-done h3 {
  margin: 8px 0 0;
  font-size: 22px;
}
.pay-done p {
  margin: 0;
  max-width: 360px;
  color: #5b5f7a;
}
@media (max-width: 800px) {
  .pay-sheet {
    padding: 0;
    place-items: end stretch;
  }
  .pay-sheet-card {
    max-height: 94dvh;
    border-radius: 24px 24px 0 0;
  }
  .pay-sheet-body {
    grid-template-columns: 1fr;
  }
  .pay-summary {
    border-right: 0;
    border-bottom: 1px solid #efeff7;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pay-sheet,
  .pay-sheet-card,
  .pay-done,
  .pay-done-icon {
    animation: none;
  }
}

/* ---------- Account blocks: payment methods, billing details, cancel ---------- */
.billing-panel .billing-block {
  margin: 16px 18px 0;
  padding: 16px;
  border: 1px solid #efeff7;
  border-radius: 16px;
  background: #fff;
  animation: rise-in 360ms var(--ease-out, ease) both;
}
.billing-panel .billing-block h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
}
.billing-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.billing-block-head .field-help {
  margin: 4px 0 0;
  max-width: 560px;
}
.billing-panel .billing-block.billing-invoices {
  padding: 16px;
}
.billing-panel .billing-block.billing-invoices h3 {
  font-size: 15px;
  letter-spacing: -0.2px;
  text-transform: none;
  color: inherit;
  margin-bottom: 10px;
}

/* Payment method rows */
.pm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.pm-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #ececf6;
  border-radius: 14px;
  background: #fcfcff;
  transition: border-color 200ms, box-shadow 200ms, transform 200ms var(--ease-out, ease);
}
.pm-row:hover {
  border-color: #dcd6fb;
  box-shadow: 0 6px 18px #1b1a4a0d;
}
.pm-row.primary {
  border-color: #cfe9da;
  background: linear-gradient(150deg, #f4fbf7, #fff);
}
.pm-row.confirming {
  border-color: #f3c7cc;
  background: #fff7f8;
}
.pm-row.pending {
  grid-template-columns: auto 1fr;
  border-style: dashed;
  border-color: #d6d0f5;
  background: linear-gradient(150deg, #f8f7ff, #fff);
}
.pm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(150deg, #1d2148, #11172c);
  box-shadow: inset 0 1px 0 #ffffff1f;
}
.pm-icon.bank {
  background: linear-gradient(150deg, #2c7a55, #145a3a);
}
.pm-icon .icon {
  width: 18px;
  height: 18px;
}
.pm-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.pm-main strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pm-main .field-help {
  margin: 0;
}
.pm-soon {
  color: #b45309;
}
.pm-role {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.pm-role.primary {
  background: #1fbf6a1f;
  color: #128a4b;
}
.pm-role.backup {
  background: #efeaff;
  color: #4a35c0;
}
.pm-role.waiting {
  background: #fff4e5;
  color: #b45309;
}
.pm-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pm-remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a8ea8;
  cursor: pointer;
  transition: background-color 160ms, color 160ms, transform 200ms var(--ease-spring, ease);
}
.pm-remove:hover:not(:disabled) {
  background: #fde8ea;
  color: #c4162c;
  transform: scale(1.06);
}
.pm-remove .icon {
  width: 16px;
  height: 16px;
}
.pm-empty {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: #f8f8fc;
  color: #6b6f8c;
  font-size: 13px;
  text-align: center;
}
.pm-verify {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.pm-cents,
.pm-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid #dcdeee;
  border-radius: 10px;
  background: #fff;
}
.pm-cents input,
.pm-code input {
  width: 34px;
  padding: 8px 0;
  border: 0;
  outline: none;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: transparent;
}
.pm-code input {
  width: 90px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.pm-cents:focus-within,
.pm-code:focus-within {
  border-color: #8b7bea;
  box-shadow: 0 0 0 3px #8b7bea33;
}
.pm-cents span {
  color: #8a8ea8;
}

/* Billing details */
.details-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.details-form label {
  display: grid;
  align-content: start;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #3d4160;
}
.details-form .span-2 {
  grid-column: span 3;
}
.details-form input,
.details-form select {
  width: 100%;
  min-height: 40px;
  font-weight: 400;
}
.details-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.optional {
  font-weight: 400;
  color: #8a8ea8;
}
.details-view {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}
.details-view dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #8a8ea8;
}
.details-view dd {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
}
.tax-ids {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f1f1f8;
}
.tax-ids h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.tax-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
}
.tax-list li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: #f6f5fd;
  border: 1px solid #e6e2fb;
  font-size: 13px;
}
.tax-type {
  font-weight: 650;
  color: #4a35c0;
}
.tax-list .pm-remove {
  width: 26px;
  height: 26px;
}
.tax-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tax-form select,
.tax-form input {
  min-height: 36px;
}
.tax-value {
  flex: 1;
  min-width: 180px;
}
.tax-value input {
  width: 100%;
}

/* Subscription ending / cancel */
.billing-ending {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 18px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(150deg, #fff8ec, #fff);
  border: 1px solid #f6dfb5;
}
.billing-ending > .icon {
  flex: none;
  width: 22px;
  height: 22px;
  color: #b45309;
}
.billing-ending > div {
  flex: 1;
}
.billing-ending p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #6b6f8c;
}
.billing-panel .billing-block.billing-cancel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fcfcfe;
}
.billing-cancel .field-help {
  margin: 4px 0 0;
}

/* ---------- Sheet content: add a payment method, cancel ---------- */
.pm-chooser,
.cancel-form {
  display: grid;
  gap: 18px;
  padding: 10px 10px 4px;
}
.pm-chooser fieldset,
.cancel-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.pm-chooser legend,
.cancel-form legend {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 650;
}
.pm-kinds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.pm-kind,
.pm-roles label,
.reason {
  position: relative;
}
/* Native radios stay focusable and keyboard-operable, hidden over their own card. */
.pm-kind input,
.pm-roles input,
.reason input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.pm-kind > span {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1.5px solid #e3e4f1;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 200ms, box-shadow 200ms, transform 220ms var(--ease-spring, ease), background-color 200ms;
}
.pm-kind > span .icon {
  width: 26px;
  height: 26px;
  color: #5843ce;
  margin-bottom: 4px;
}
.pm-kind small {
  color: #6b6f8c;
  font-size: 12.5px;
}
.pm-kind:hover > span {
  transform: translateY(-1px);
  border-color: #c9bff5;
}
.pm-kind input:checked + span {
  border-color: #5843ce;
  background: #f8f6ff;
  box-shadow: 0 0 0 3px #5843ce22, 0 10px 24px #2d217014;
}
.pm-kind input:focus-visible + span,
.pm-roles input:focus-visible + span,
.reason input:focus-visible + span {
  outline: 2px solid #5843ce;
  outline-offset: 2px;
}
.pm-roles .segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: #efedf8;
}
.pm-roles .segmented span {
  display: block;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: #6b6f8c;
  cursor: pointer;
  transition: background-color 200ms, color 200ms, box-shadow 200ms;
}
.pm-roles .segmented input:checked + span {
  background: #fff;
  color: #2d2170;
  box-shadow: 0 1px 3px #24204e1f;
}
.pm-roles .field-help {
  margin: 8px 0 0;
}
.pm-chooser > .button {
  justify-self: start;
  min-height: 44px;
  padding-inline: 22px;
}
.cancel-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.cancel-facts li {
  display: flex;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #3d4160;
}
.cancel-facts .icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: #128a4b;
}
.reason-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.reason > span {
  display: block;
  padding: 11px 14px;
  border: 1.5px solid #e3e4f1;
  border-radius: 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 180ms, background-color 180ms;
}
.reason:hover > span {
  border-color: #c9bff5;
}
.reason input:checked + span {
  border-color: #5843ce;
  background: #f8f6ff;
  color: #2d2170;
  font-weight: 600;
}
.cancel-comment {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}
.cancel-comment textarea {
  width: 100%;
  font: inherit;
  font-weight: 400;
  resize: vertical;
}
.cancel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .billing-block-head {
    flex-direction: column;
  }
  .pm-row {
    grid-template-columns: auto 1fr;
  }
  .pm-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .pm-verify {
    grid-column: 1 / -1;
  }
  .details-form,
  .details-view {
    grid-template-columns: 1fr;
  }
  .details-form .span-2 {
    grid-column: auto;
  }
  .billing-panel .billing-block.billing-cancel,
  .billing-ending {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (prefers-reduced-motion: reduce) {
  .billing-panel .billing-block {
    animation: none;
  }
  .pm-row,
  .pm-kind > span,
  .pm-remove {
    transition: none;
  }
}
