/* Extend the established customer-login visual system to legacy billing. */
body:has(.aftel-legacy-billing) {
  background-attachment: fixed !important;
  background-color: #dceeff !important;
  background-image:
    linear-gradient(180deg, rgba(235, 246, 255, .56), rgba(218, 237, 252, .66)),
    url('../../customer-portal/assets/aftel-myaccount-blueprint-bg.png') !important;
  background-position: center 46% !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

body:has(.aftel-legacy-billing) :is(.site-content, .site-main, article, .entry-content) {
  background: transparent;
}

.aftel-legacy-billing {
  background: transparent !important;
  box-sizing: border-box;
  margin: 0 auto;
  max-width: 860px;
  min-width: 0;
  padding: 40px 24px 72px;
  width: 100%;
}

/* Linked accounts need room for bill tables and payment controls. */
.aftel-legacy-billing:has(.aftel-billing-account) {
  max-width: 1180px;
}

.aftel-legacy-billing *,
.aftel-legacy-billing *::before,
.aftel-legacy-billing *::after {
  box-sizing: border-box;
}

body:has(.aftel-legacy-billing) .aftel-billing-surface {
  background: rgba(255, 255, 255, .94) !important;
  border-color: rgba(184, 206, 224, .82) !important;
  box-shadow: 0 24px 64px rgba(18, 50, 82, .18) !important;
  min-width: 0;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.aftel-billing-header {
  margin-bottom: 30px;
}

.aftel-billing-header--signed-in {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.aftel-billing-header__copy {
  min-width: 0;
}

.aftel-billing-logout {
  flex: none;
  min-height: 44px;
  padding: 10px 18px;
  white-space: nowrap;
}

.aftel-billing-header h1,
.aftel-legacy-billing > .aftel-billing-surface > h1 {
  margin-bottom: 10px;
}

.aftel-billing-header p,
.aftel-billing-surface > p {
  color: var(--muted);
  margin-top: 0;
}

.aftel-billing-access-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
}

.aftel-billing-access-card,
.aftel-billing-onboarding {
  background: rgba(247, 251, 255, .9);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-width: 0;
  padding: 26px;
}

.aftel-billing-access-card--setup {
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 34px rgba(18, 50, 82, .08);
}

.aftel-billing-access-card h2,
.aftel-billing-onboarding h2 {
  font-size: clamp(24px, 3vw, 30px);
  margin: 4px 0 10px;
}

.aftel-billing-access-card > p:not(.aftel-portal-label),
.aftel-billing-onboarding > p:not(.aftel-portal-label) {
  color: var(--muted);
}

.aftel-billing-access-card .aftel-portal-button {
  display: inline-flex;
  justify-content: center;
  margin-top: 14px;
}

.aftel-billing-help-link {
  display: block;
  font-weight: 700;
  margin-top: 16px;
}

.aftel-billing-start-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.aftel-billing-start-form .aftel-portal-button {
  justify-self: start;
  margin-top: 4px;
}

.aftel-billing-trap {
  height: 0 !important;
  left: -10000px !important;
  margin: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  width: 0 !important;
}

.aftel-billing-setup-form {
  margin-top: 24px;
}

.aftel-billing-passwords {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.aftel-billing-setup-form p {
  margin-bottom: 16px;
}

.aftel-billing-setup-form small,
.aftel-billing-help {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 7px;
}

.aftel-billing-cancel-form {
  margin-top: 16px;
}

.aftel-billing-text-button {
  background: transparent;
  border: 0;
  color: var(--blue-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.aftel-billing-panel,
.aftel-billing-account {
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding-top: 28px;
}

.aftel-billing-panel h2,
.aftel-billing-account h2 {
  font-size: clamp(24px, 3vw, 30px);
  margin-bottom: 10px;
}

.aftel-billing-panel > p {
  color: var(--muted);
  margin: 0 0 12px;
}

.aftel-billing-account__header {
  margin-bottom: 18px;
}

.aftel-billing-account__header .aftel-portal-label {
  margin-bottom: 5px;
}

.aftel-billing-account h2 small {
  background: var(--soft);
  border-radius: 999px;
  color: var(--blue-dark);
  display: inline-block;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .035em;
  margin-left: 8px;
  padding: 5px 9px;
  vertical-align: middle;
}

.aftel-billing-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
}

.aftel-legacy-billing .aftel-portal-table {
  min-width: 700px;
}

.aftel-legacy-billing .aftel-portal-table th {
  background: var(--soft);
  color: var(--blue-dark);
  font-size: 12px;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.aftel-legacy-billing .aftel-portal-table td a {
  font-weight: 700;
}

.aftel-payway-payment {
  background: #f7fbff;
  border-radius: 10px;
  padding: 16px;
}

.aftel-payway-payment label,
.aftel-payway-update label {
  line-height: 1.55;
}

.aftel-payway-payment input[type="checkbox"],
.aftel-payway-update input[type="checkbox"] {
  accent-color: var(--blue);
  height: 20px;
  margin-right: 7px;
  vertical-align: -4px;
  width: 20px;
}

.aftel-payway-update {
  background: rgba(247, 251, 255, .88);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 20px;
  padding: 0 18px;
}

.aftel-payway-update summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  padding: 16px 0;
}

.aftel-payway-update[open] {
  padding-bottom: 18px;
}

.aftel-payway-choice {
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
  padding: 0;
}

.aftel-payway-choice legend {
  font-weight: 750;
  margin-bottom: 9px;
  width: 100%;
}

.aftel-payway-choice label {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 7px;
  min-height: 48px;
  padding: 10px 14px;
}

.aftel-payway-choice label:has(input:checked) {
  background: var(--soft);
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(22, 107, 188, .12);
}

.aftel-payway-choice input[type="radio"] {
  accent-color: var(--blue);
  height: 19px;
  margin: 0;
  width: 19px;
}

.aftel-payway-choice span {
  color: var(--muted);
  font-size: 13px;
}

.aftel-payway-update [hidden] {
  display: none !important;
}

.aftel-legacy-billing .aftel-notice {
  margin: 0 0 22px;
}

.aftel-legacy-billing .aftel-portal-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

@media (min-width: 721px) and (max-width: 1200px) {
  .aftel-legacy-billing:has(.aftel-billing-account) {
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 720px) {
  body:has(.aftel-legacy-billing) {
    background-attachment: scroll !important;
    background-position: 56% center !important;
  }

  .aftel-portal.aftel-portal--auth.aftel-legacy-billing {
    max-width: calc(100vw - 30px);
    padding: 24px 16px 56px;
    width: calc(100vw - 30px);
  }

  body:has(.aftel-legacy-billing) .aftel-billing-surface {
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: 0 18px 44px rgba(18, 50, 82, .16) !important;
    padding: 24px;
  }

  .aftel-billing-header h1,
  .aftel-billing-header p,
  .aftel-billing-panel h2,
  .aftel-billing-panel p,
  .aftel-billing-panel label {
    overflow-wrap: anywhere;
  }

  .aftel-billing-header--signed-in {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .aftel-billing-account h2 small {
    display: table;
    margin: 8px 0 0;
  }

  .aftel-legacy-billing .aftel-portal-button {
    width: 100%;
  }

  .aftel-legacy-billing .aftel-billing-logout {
    align-self: flex-start;
    width: auto;
  }

  .aftel-billing-access-grid,
  .aftel-billing-passwords {
    grid-template-columns: 1fr;
  }

  .aftel-billing-access-card,
  .aftel-billing-onboarding {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aftel-legacy-billing *,
  .aftel-legacy-billing *::before,
  .aftel-legacy-billing *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
