:root {
  --plan-purple: #5b21b6;
  --plan-purple-dark: #35105f;
  --plan-purple-soft: #f4efff;
  --plan-orange: #f97316;
  --plan-ink: #15111d;
  --plan-muted: #6f6878;
  --plan-line: #e8e2ee;
}

body {
  background: #f6f5f8;
  color: var(--plan-ink);
  font-family: Manrope, system-ui, sans-serif;
}

.plans-main { padding: 54px 32px 80px; }
.plans-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}
.plans-kicker,
.plan-dialog-kicker {
  display: block;
  color: #7c3aed;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
}
.plans-hero h1 {
  max-width: 760px;
  margin: 9px 0 10px;
  font-size: clamp(31px, 3.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -.04em;
}
.plans-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--plan-muted);
  font-size: 16px;
  line-height: 1.65;
}

.billing-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}
.billing-switch button {
  min-height: 46px;
  border: 1px solid #ded5e7;
  border-radius: 11px;
  background: #fff;
  padding: 10px 16px;
  color: #655b70;
  font: 750 13px Manrope;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(49, 24, 72, .04);
}
.billing-switch button:hover {
  border-color: #bda9d1;
  background: #faf7fd;
}
.billing-switch button.is-active {
  border-color: var(--plan-purple-dark);
  background: var(--plan-purple-dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(53, 16, 95, .17);
}
.billing-switch span {
  display: inline;
  margin-left: 5px;
  color: #f97316;
  font-size: 9px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.plans-loading {
  grid-column: 1 / -1;
  padding: 50px;
  color: var(--plan-muted);
  text-align: center;
}
.plan-card {
  position: relative;
  display: flex;
  min-height: 570px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--plan-line);
  border-radius: 24px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 14px 34px rgba(44, 28, 56, .06);
}
.plan-card.is-featured {
  border-color: #b994f5;
  background: linear-gradient(180deg, #f7f2ff 0, #fff 32%);
  box-shadow: 0 18px 48px rgba(91, 33, 182, .14);
}
.plan-card.is-ultra {
  border-color: #f2c29a !important;
  background: linear-gradient(180deg, #fff8f1 0%, #fff 34%) !important;
  color: #211a28;
  box-shadow: 0 20px 48px rgba(76, 29, 149, .1);
}
.plan-ribbon {
  position: absolute;
  top: 20px;
  right: 20px;
  border-radius: 999px;
  background: #ede4ff;
  padding: 7px 10px;
  color: #5b21b6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}
.is-ultra .plan-ribbon {
  background: #fff0df;
  color: #a8430a;
}
.plan-name {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: -.03em;
}
.is-ultra .plan-name { color: #211a28; }
.plan-description {
  min-height: 56px;
  margin: 0;
  color: var(--plan-muted);
  font-size: 15px;
  line-height: 1.58;
}
.is-ultra .plan-description { color: var(--plan-muted); }

.plan-price {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin: 25px 0 9px;
}
.plan-price strong {
  font-size: 43px;
  line-height: 1;
  letter-spacing: -.05em;
}
.plan-card[data-plan="free"] .plan-price strong { color: #211a28; }
.plan-card[data-plan="premium"] .plan-price strong { color: #6d28d9; }
.plan-card[data-plan="ultra"] .plan-price strong { color: #fb923c; }
.plan-price span {
  padding-bottom: 4px;
  color: var(--plan-muted);
  font-size: 13px;
  font-weight: 700;
}
.is-ultra .plan-price span { color: var(--plan-muted); }
.plan-annual-note {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 30px;
  border: 1px solid #e6dfee;
  border-radius: 999px;
  background: #f8f5fa;
  padding: 6px 10px;
  color: #675d71;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
.is-featured .plan-annual-note {
  border-color: #dfd0f6;
  background: #f5efff;
  color: #5b21b6;
}
.is-ultra .plan-annual-note {
  border-color: #f3d2b5;
  background: #fff7ef;
  color: #974315;
}
.plan-divider {
  height: 1px;
  margin: 21px 0;
  background: var(--plan-line);
}
.is-ultra .plan-divider { background: var(--plan-line); }

.plan-features {
  display: grid;
  gap: 14px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.plan-features li {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 9px;
  color: #413949;
  font-size: 14px;
  line-height: 1.5;
}
.plan-features li::before {
  content: "✓";
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #f1ecf7;
  color: #1f1727;
  font-size: 10px;
  font-weight: 900;
}
.is-ultra .plan-features li { color: #413949; }
.is-ultra .plan-features li::before {
  background: #fff0df;
  color: #c2410c;
}

.plan-action {
  width: 100%;
  min-height: 50px;
  margin-top: auto;
  border-radius: 12px;
  font: 800 14px Manrope;
  cursor: pointer;
}
.plan-action.primary {
  border: 1px solid var(--plan-purple);
  background: var(--plan-purple);
  color: #fff;
}
.plan-action.dark {
  border: 1px solid #fff;
  background: #fff;
  color: var(--plan-purple-dark);
}
.plan-card.is-ultra .plan-action.dark {
  border-color: #f97316;
  background: #f97316;
  color: #fff;
}
.plan-card.is-ultra .plan-action.dark:hover {
  border-color: #ea580c;
  background: #ea580c;
}
.plan-action.secondary {
  border: 1px solid #d8d0df;
  background: #fff;
  color: #2e2637;
}
.plan-action[disabled] {
  cursor: default;
  opacity: .62;
}
.plan-usage {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  border-radius: 11px;
  background: #f7f5f9;
  padding: 12px 13px;
  color: #746b7e;
}
.is-ultra .plan-usage {
  background: #fff7ef;
  color: #7c4d32;
}
.plan-usage span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plan-usage strong { font-size: 13px; }

.payment-trust {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  border: 1px solid var(--plan-line);
  border-radius: 18px;
  background: #fff;
  padding: 20px 22px;
}
.payment-trust-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: #f1eef4;
}
.payment-trust-icon svg {
  width: 20px;
  fill: none;
  stroke: #17131d;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.payment-trust strong { font-size: 14px; }
.payment-trust p {
  margin: 4px 0 0;
  color: var(--plan-muted);
  font-size: 12px;
  line-height: 1.5;
}
.payment-methods {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.payment-methods span {
  border: 1px solid #e2dce7;
  border-radius: 999px;
  padding: 7px 10px;
  color: #564d60;
  font-size: 10px;
  font-weight: 800;
}

.plan-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 12, 25, .58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overscroll-behavior: contain;
}
.plan-dialog-backdrop[hidden] { display: none; }
.plan-dialog {
  position: relative;
  width: min(var(--modal-width-standard, 760px), 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: var(--modal-radius-standard, 24px);
  background: #fff;
  padding: 30px 36px 28px;
  box-shadow: 0 32px 90px rgba(18, 12, 25, .30);
  scrollbar-width: thin;
  scrollbar-color: #d8cdea transparent;
}
.plan-dialog-header {
  padding: 0 64px 18px 0;
  border-bottom: 1px solid #eee9f2;
}
.plan-dialog h2 {
  margin: 7px 0 6px;
  font-size: 29px;
  line-height: 1.16;
  letter-spacing: -.035em;
}
.plan-dialog-header > p {
  max-width: 620px;
  margin: 0;
  color: var(--plan-muted);
  font-size: 15px;
  line-height: 1.55;
}
.plan-dialog-close {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 26px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--plan-line);
  border-radius: 50%;
  background: #f7f5f8;
  color: #342a3e;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.plan-dialog-close:hover { border-color: #cbbadd; background: var(--plan-purple-soft); }
.plan-dialog-summary {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 1px;
  margin: 12px 0 15px;
  overflow: hidden;
  border: 1px solid #e5dafa;
  border-radius: 16px;
  background: #e5dafa;
}
.plan-change[hidden] { display: none !important; }
.plan-change {
  display: grid;
  gap: 14px;
}
.plan-change-route {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  gap: 12px;
}
.plan-change-route > div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  align-content: center;
  border: 1px solid #e6dcef;
  border-radius: 14px;
  background: #fbf9fd;
  padding: 12px 15px;
}
.plan-change-route > div:last-child {
  border-color: #d9c2fb;
  background: linear-gradient(135deg,#f2eaff,#fff);
}
.plan-change-route small {
  color: #81758d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.plan-change-route strong { color: #2b173f; font-size: 18px; }
.plan-change-route > span { color: #7c3aed; font-size: 22px; font-weight: 800; }
.plan-change-facts {
  display: grid;
  gap: 8px;
  border: 1px solid #ebe5ef;
  border-radius: 15px;
  background: #fbfafc;
  padding: 13px 15px;
}
.plan-change-facts p {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr);
  gap: 2px 8px;
  margin: 0;
  color: #6e6477;
  font-size: 13px;
  line-height: 1.5;
}
.plan-change-facts p > span {
  grid-row: 1 / span 2;
  color: #5b21b6;
  font-weight: 900;
}
.plan-change-facts strong { color: #302638; }
.plan-change-consent { margin-top: 0 !important; }
.plan-change-success {
  border: 1px solid #b7e3d4;
  border-radius: 14px;
  background: #f0fbf7;
  padding: 14px 16px;
  color: #126b55;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
}
.plan-dialog-summary > span {
  display: grid;
  align-content: center;
  min-height: 60px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #f5f0ff, #fff);
}
.plan-dialog-summary small {
  color: #81758d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.plan-dialog-summary strong {
  margin-top: 4px;
  color: #35105f;
  font-size: 17px;
  line-height: 1.3;
}
.plan-dialog-summary em {
  margin-top: 2px;
  color: #7c3aed;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.plan-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.plan-dialog-actions[hidden],
.subscription-billing[hidden] { display: none !important; }
.plan-dialog-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 48px;
  margin: 0 !important;
  border-radius: 12px !important;
  text-align: center;
  text-decoration: none;
}
.subscription-billing {
  margin: 0;
}
.billing-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.billing-section-head > div {
  display: grid;
  gap: 3px;
}
.billing-section-head strong {
  color: #21172b;
  font-size: 14px;
}
.billing-section-head span {
  color: #81788a;
  font-size: 11px;
  line-height: 1.45;
}
.billing-secure-label {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #e3daf1;
  border-radius: 999px;
  background: #faf7ff;
  color: #5b2aa0 !important;
  font-size: 10px !important;
  font-weight: 800;
}
.billing-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
}
.billing-fields > label,
.billing-address-fields > label {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 7px !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  color: #4d4457;
  font-size: 13px !important;
  line-height: 1.3;
  font-weight: 800;
}
.billing-fields label.wide { grid-column: 1 / -1; }
.billing-fields > label > input,
.billing-fields > label > textarea,
.billing-address-fields > label > input,
.billing-address-fields > label > textarea {
  position: static !important;
  display: block !important;
  float: none !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  transform: none !important;
  border: 1px solid #ded7e5 !important;
  border-radius: 12px !important;
  background: #fff;
  padding: 12px 14px !important;
  color: #181120;
  font: inherit;
  font-size: 15px !important;
  font-weight: 600;
  resize: vertical;
}
.billing-fields > label > input,
.billing-address-fields > label > input { min-height: 48px !important; }
.billing-fields > label > textarea,
.billing-address-fields > label > textarea { min-height: 70px !important; }
.billing-fields input:focus,
.billing-fields textarea:focus,
.billing-address-fields input:focus,
.billing-address-fields textarea:focus {
  border-color: #7c3aed;
  outline: 3px solid rgba(124, 58, 237, .12);
}
.billing-address-group {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 1px 0 0;
  padding: 9px 12px 11px;
  border: 1px solid #ebe5ef;
  border-radius: 14px;
  background: #fbfafc;
}
.billing-address-group legend {
  padding: 0 5px;
  color: #4d4457;
  font-size: 12px;
  font-weight: 800;
}
.billing-address-fields {
  display: grid;
  grid-template-columns: 1fr .7fr;
  gap: 8px 10px;
}
.billing-address-fields label.wide { grid-column: 1 / -1; }
.billing-consent {
  display: grid !important;
  grid-template-columns: 20px minmax(0,1fr);
  align-items: flex-start;
  gap: 11px !important;
  width: 100% !important;
  margin: 11px 0 0 !important;
  color: #5d5566;
  font-size: 13px !important;
  line-height: 1.55;
}
.billing-consent a {
  color: #6424ba;
  font-weight: 850;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.billing-consent a:hover { color: #f97316; }
.billing-consent input {
  width: 18px !important;
  height: 18px !important;
  min-height: 0 !important;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  accent-color: #6f2dbd;
}
.billing-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}
.plan-card:focus-within {
  outline: 3px solid rgba(124, 58, 237, .18);
  outline-offset: 3px;
}

@media (max-width: 980px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .plan-card.is-ultra {
    grid-column: 1 / -1;
    min-height: auto;
  }
  .plans-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .payment-trust { grid-template-columns: auto 1fr; }
  .payment-methods {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .plans-main { padding: 34px 16px 100px; }
  .plans-hero { gap: 22px; }
  .plans-hero h1 { font-size: 32px; }
  .plans-hero p { font-size: 15px; }
  .billing-switch { width: 100%; }
  .billing-switch button {
    flex: 1;
    padding-inline: 10px;
  }
  .plan-dialog-backdrop {
    place-items: end center;
    padding: 0;
  }
  .plan-dialog {
    width: 100%;
    max-height: 92dvh;
    padding: 28px 20px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }
  .plan-dialog-header { padding: 0 50px 20px 0; }
  .plan-dialog-close { top: 18px; right: 18px; }
  .plan-dialog-summary { grid-template-columns: 1fr; }
  .plan-change-route { grid-template-columns: 1fr; }
  .plan-change-route > span { transform: rotate(90deg); text-align: center; }
  .plan-dialog-summary > span { min-height: 66px; }
  .billing-fields { grid-template-columns: 1fr; }
  .billing-fields label.wide { grid-column: auto; }
  .billing-address-fields { grid-template-columns: 1fr; }
  .billing-address-fields label.wide { grid-column: auto; }
  .billing-address-group { grid-column: auto; padding: 11px 12px 13px; }
  .billing-section-head { display: block; }
  .billing-secure-label { display: inline-flex; margin-top: 8px; }
  .billing-switch span {
    display: block;
    margin: 2px 0 0;
  }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-card,
  .plan-card.is-ultra {
    grid-column: auto;
    min-height: auto;
    border-radius: 20px;
    padding: 24px;
  }
  .plan-description { min-height: 0; }
  .plan-price strong { font-size: 39px; }
  .plan-annual-note {
    border-radius: 12px;
    font-size: 11px;
  }
  .payment-trust {
    grid-template-columns: 1fr;
    padding: 18px;
  }
  .payment-trust-icon { display: none; }
  .plan-dialog h2 { font-size: 25px; }
  .plan-dialog-actions {
    position: sticky;
    bottom: calc(-22px - env(safe-area-inset-bottom));
    z-index: 3;
    flex-direction: column-reverse;
    margin: 16px -20px calc(-22px - env(safe-area-inset-bottom));
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid #e8e2ee;
    background: rgba(255,255,255,.97);
    box-shadow: 0 -12px 28px rgba(34,20,48,.08);
    backdrop-filter: blur(12px);
  }
  .plan-dialog-actions .btn { width: 100%; }
}
