/* Subscription management page, matching homepage #brief-confirmation & #area-step. */
.account-page {
  --landing-rule: #2b2e38;
  --signup-accent: #4659e5;
  --landing-link: #c5ccff;
  --landing-highlight: #b79cff;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.account-page main { flex: 1; }

.account-page .logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.account-page .account-nav {
  padding-block: 12px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

.account-page .account-nav:hover,
.account-page .account-nav:focus-visible {
  color: var(--forest);
}

.account-page #digest-fields { row-gap: 0; }

/* Left column: exact match with #brief-confirmation on landing page */
.account-page .account-content {
  min-width: 0;
  max-width: 35rem;
  padding-block: 16px;
  gap: 0;
}

.account-page .confirmation-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-page .confirmation-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--signup-accent);
  color: white;
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--signup-accent) 65%, transparent);
}

.account-page .confirmation-icon svg { width: 22px; height: 22px; }

.account-page .confirmation-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #38c58b 34%, var(--landing-rule));
  background: color-mix(in srgb, #38c58b 11%, var(--panel-night));
  color: #7ee2b8;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.account-page .confirmation-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38c58b;
  box-shadow: 0 0 0 3px #38c58b33;
}

.account-page .confirmation-badge.is-muted {
  border-color: color-mix(in srgb, var(--signup-accent) 28%, var(--landing-rule));
  background: color-mix(in srgb, var(--signup-accent) 10%, var(--panel-night));
  color: var(--forest);
}

.account-page .confirmation-badge.is-muted i {
  background: var(--landing-highlight);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--landing-highlight) 24%, transparent);
}

.account-page #account-heading {
  margin: 18px 0 12px;
  font-size: clamp(1.95rem, 3.8vw, 2.85rem);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.1;
  text-wrap: balance;
}

.account-page .confirmation-lead {
  margin: 0;
  color: var(--muted);
  font-size: .975rem;
  line-height: 1.6;
}

.account-page #recover-sent .confirmation-lead {
  font-size: 1rem;
  color: var(--forest);
}

.account-page #recover-email {
  color: var(--forest);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-page #recover-sent .confirmation-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .925rem;
  line-height: 1.65;
}

.account-page .confirmation-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.5;
}

.account-page .confirmation-links .text-action {
  appearance: none;
  margin: 0;
  padding: 4px 0;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent);
  text-underline-offset: .24em;
  cursor: pointer;
  transition: color .16s ease, text-decoration-color .16s ease;
}

.account-page .confirmation-links .text-action:is(:hover, :focus-visible) {
  color: var(--forest);
  text-decoration-color: currentColor;
}

/* Status feedback line */
.account-page #notice {
  margin: 14px 0 0;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-page #notice:empty { display: none; }
.account-page #notice.is-success { color: #7ee2b8; font-weight: 500; }
.account-page #notice.is-error { color: #ffaaa0; font-weight: 500; }

/* Summary <dl> card, identical to homepage #brief-confirmation dl */
.account-page .account-summary {
  margin: 24px 0 20px;
  padding: 4px 18px;
  border: 1px solid var(--landing-rule);
  border-radius: 16px;
  background: var(--panel-night);
  box-shadow: 0 16px 36px -22px #00000080;
  font-size: .9375rem;
}

.account-page .account-summary > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 13px 0;
}

.account-page .account-summary > div + div {
  border-top: 1px solid var(--landing-rule);
}

.account-page .account-summary dt {
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.account-page .account-summary dd {
  margin: 0;
  color: var(--forest);
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* Buttons & actions, identical to homepage #brief-confirmation .confirmation-actions */
.account-page .primary:not(:hover):not(:active) { background: var(--signup-accent); }

.account-page .danger {
  background: #d94854;
  color: #fff;
  border-color: transparent;
}
.account-page .danger:hover { background: #c53b47; color: #fff; }
.account-page .danger:active { background: #b1323d; color: #fff; }

.account-page .outline {
  border-radius: 10px;
  font-weight: 550;
}

.account-page .confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
}

.account-page .confirmation-actions :is(.pill, .outline),
.account-page :is(#account, #recover) :is(.pill, .outline),
.account-page .retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  margin-block: 0;
  margin-inline: 0;
}

.account-page .confirmation-actions .pill svg { width: 15px; height: 15px; flex: none; }

.account-page .retry-btn { margin-top: 20px; }

.account-page .pill:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.account-page #account-bar:has(#edit-area[hidden]) {
  display: none;
}

.account-page #stop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-block: 18px 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.5;
}

.account-page #account #stop-actions .text-action {
  appearance: none;
  margin-block: 0;
  margin-inline: 0;
  padding: 4px 0;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent);
  text-underline-offset: .24em;
  transition: color .16s ease, text-decoration-color .16s ease;
}

.account-page #account #stop-actions .text-action:hover,
.account-page #account #stop-actions .text-action:focus-visible {
  color: var(--forest);
  text-decoration-color: currentColor;
}

.account-page .stop-sep {
  color: color-mix(in srgb, var(--muted) 55%, transparent);
  user-select: none;
}

/* Location editor & unsubscribe confirmation: hairline divider like homepage #area-step (no nested card box) */
.account-page :is(#editor, #confirm) {
  position: relative;
  z-index: 2;
  margin-block: 24px 0;
  padding-top: 18px;
  border-top: 1px solid var(--landing-rule);
}

.account-page #editor-heading,
.account-page #stop-title {
  margin: 0 0 12px;
  font-size: 1.2rem;
  font-weight: 550;
  letter-spacing: normal;
  line-height: 1.3;
}

.account-page #manage-picker > label,
.account-page #recover > label {
  display: block;
  margin: 12px 0 8px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--forest);
}

.account-page #editor #manage-picker > label { margin-top: 0; }

.account-page .confirm-location {
  margin: 0 0 6px;
  color: var(--forest);
  font-size: .95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-page .confirm-note {
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.55;
}

.account-page .editor-actions { margin-top: 20px; }

.account-page #replace-note {
  margin: 10px 0 0;
  font-size: .875rem;
}
.account-page #replace-note:empty { display: none; }
.account-page #toggle-map-picker { margin-block-start: 10px; }
.account-page #map-feedback { margin: 8px 0 0; color: var(--muted); }

/* Keep the preview inline whenever the map cannot show it. */
#mobile-location-brief.is-on-map { display: none; }
#mobile-location-brief:not([hidden], .is-on-map) {
  display: block;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--landing-rule);
  border-radius: 12px;
  background: var(--panel-night);
}
#mobile-location-brief header {
  padding: 14px 16px;
  background: linear-gradient(100deg, #112420f5, #10211dc7), url('/newsletter/radar-night-brief.webp') center 55% / cover;
}
#mobile-brief-location { margin: 0 0 4px; color: #bdd5cc; font-size: .8125rem; overflow-wrap: anywhere; }
#mobile-brief-title { margin: 0; color: white; font-size: 1.375rem; font-weight: 650; letter-spacing: -.025em; line-height: 1.2; }
#mobile-location-brief .mobile-brief-body { padding: 12px 16px; font-size: .875rem; overflow-wrap: anywhere; }
#mobile-brief-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
#mobile-brief-meta time, #mobile-brief-message { color: var(--muted); }
#mobile-brief-message, #mobile-brief-items { margin: 0; }
#mobile-brief-items { padding: 0; list-style: none; }
#mobile-brief-items li { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--landing-rule); }

/* Recover management link form (matches homepage #signup-form) */
.account-page #recover {
  margin-block: 20px 0;
}

.account-page .recover-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.account-page #receiver {
  margin: 0;
  min-height: 52px;
  padding: 12px 16px 12px 44px;
  border-radius: 10px;
  border-color: #606878;
  background: var(--panel-night);
}

.account-page #receiver:focus {
  border-color: transparent;
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

.account-page #recover .email-field .field-icon { left: 16px; }

.account-page #recover .submit {
  width: auto;
  margin: 0;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 10px;
  font-size: .9375rem;
  font-weight: 600;
}

.account-page #recover .signup-note {
  margin: 10px 0 0;
  font-size: .875rem;
}

/* Animated glint on email input, matching homepage */
@property --email-glint-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.account-page .email-glint {
  position: relative;
  min-width: 0;
  border-radius: 10px;
}
.account-page .email-glint > input { width: 100%; display: block; }
@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  @supports (mask-composite: exclude) or (-webkit-mask-composite: xor) {
    .account-page .email-glint:has(> input:is(:placeholder-shown, :focus):not(:disabled, [readonly], [aria-invalid="true"], :user-invalid))::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      padding: 2px;
      pointer-events: none;
      background: conic-gradient(from var(--email-glint-angle), transparent 0deg 248deg,
        #7588ff 288deg, #e5edff 320deg, #899aff 335deg, transparent 360deg);
      -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      animation: account-edge-sweep 4s linear infinite;
    }
  }
}
@keyframes account-edge-sweep {
  to { --email-glint-angle: 360deg; }
}

/* Enhanced location picker inside #manage-picker (identical to homepage #signup-place-picker) */
.account-page .signup-stack:has(.place-panel.is-open) { position: relative; z-index: 3; }
#manage-picker .place-search-anchor {
  position: relative;
  display: flow-root;
}
#manage-picker .place-search-field input {
  margin: 0;
  min-height: 48px;
}
#manage-picker .place-search-field:has(.place-locate) input { padding-right: 80px; }
#manage-picker input:not(:placeholder-shown) + .place-search-icons { display: none; }
#manage-picker .place-search-field:not(.is-loading) input:not(:placeholder-shown) { padding-right: 48px; }
#manage-picker .place-locate {
  position: absolute;
  top: 50%;
  right: 34px;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
}
#manage-picker .place-search-field:has(input:not(:placeholder-shown)):not(.is-loading) .place-locate { right: 2px; }
#manage-picker .place-locate:is(:hover, :focus-visible) { color: var(--brand-primary); }
#manage-picker .place-locate:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: -4px; }
#manage-picker .place-locate[aria-disabled="true"] { cursor: wait; }
#manage-picker .place-locate svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
}
#manage-picker .place-search-field.is-loading .place-search-icons { display: none; }
#manage-picker .place-search-field.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  translate: 0 -50%;
  width: 16px;
  height: 16px;
  border: 2px solid var(--landing-rule);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  pointer-events: none;
}
#manage-picker .place-loading-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  #manage-picker .place-search-field.is-loading::after { animation: account-loading-spin .75s linear infinite; }
}
@keyframes account-loading-spin { to { transform: rotate(1turn); } }
#manage-picker .place-results-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 12px; border: 1px solid #363c49; border-top: 0;
  border-radius: 0 0 10px 10px; background: #171b23;
}
#manage-picker .place-results-footer .place-panel-hint { padding: 0; border: 0; background: transparent; }
#manage-picker .place-results-footer small { margin-left: auto; font-weight: 400; }
@media (hover: none) {
  #manage-picker .place-results-footer:has(small[hidden]) { display: none; }
  #manage-picker .place-panel:has(small:not([hidden])) .place-results { border-radius: 10px 10px 0 0; }
}
#manage-picker .place-panel {
  position: relative;
  z-index: 3;
  margin-top: 4px;
  display: none;
  transition: none;
}
#manage-picker .place-panel.is-open { display: block; }
#manage-picker .place-results {
  max-height: min(18rem, 38dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#manage-picker .place-panel.is-open .place-results button { animation: none; }
#manage-picker > [role="status"] { margin-block: 8px 0; font-size: .875rem; color: var(--muted); }
#manage-picker > [role="status"]:empty { margin-block: 0; }

/* Subscription location preview and opt-in map picker. */
.account-page .newsletter-map {
  width: 100%;
  min-width: 0;
  margin-block: 12px 0;
}

.account-page .brief-scene {
  position: relative;
  width: 100%;
  height: clamp(260px, 40vw, 440px);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--landing-rule);
  border-radius: 20px;
  background: var(--panel-night);
  box-shadow: 0 24px 56px -22px #00000088;
}

.account-page .map-stage-status:not([hidden]) {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
}

.account-page .selected-area-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s cubic-bezier(.22, 1, .36, 1);
}

.account-page .brief-scene.is-map-visible .selected-area-frame {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 721px) {
  .account-page #digest-fields {
    grid-template-columns: minmax(0, 34rem) minmax(0, 36rem);
    justify-content: center;
    column-gap: clamp(28px, 4.5vw, 64px);
    align-items: center;
  }
  .account-page #digest-fields:has(#manage-map-panel[hidden]) {
    grid-template-columns: minmax(0, 34rem);
  }
  .account-page .signup-stack {
    padding-inline-end: 0;
  }
  .account-page .newsletter-map {
    margin: 0;
  }
}

@media (min-width: 901px) {
  .account-page { --header-height: 80px; }
  .account-page .shell {
    max-width: 1840px;
    padding-inline: clamp(36px, 5vw, 88px);
  }
  .account-page .top { box-sizing: border-box; }
  .account-page .top .nav { min-height: calc(var(--header-height) - 1px); }
  .account-page #subscribe {
    padding-block: 0;
  }
  .account-page #digest-fields {
    grid-template-rows: minmax(clamp(480px, 76svh, 680px), auto);
  }
  .account-page .account-content {
    padding-block: 32px;
  }
}

@media (max-width: 720px) {
  .account-page .account-nav { display: inline-block; }
  .account-page #subscribe { padding-block: 8px 28px; }
  .account-page #account-heading {
    margin: 14px 0 8px;
    font-size: clamp(1.65rem, 7vw, 2.1rem);
  }
  .account-page .confirmation-lead { font-size: .9375rem; }
  .account-page .account-summary {
    margin: 18px 0 16px;
    padding: 2px 14px;
    border-radius: 14px;
  }
  .account-page .account-summary > div {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 10px;
    padding: 11px 0;
  }
  .account-page .recover-row {
    grid-template-columns: 1fr;
  }
  .account-page #recover .submit {
    width: 100%;
  }
  .account-page #account-bar {
    margin: 16px 0 0;
  }
  .account-page #stop-actions {
    margin-block: 16px 0;
  }
  .account-page .confirmation-actions :is(.pill, .outline) {
    width: 100%;
    padding: 0 12px;
  }
  .account-page .newsletter-map { margin: 20px 0 4px; }
  .account-page #toggle-map-picker { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .account-page :is(#account, #recover, #recover-sent, #editor, #confirm, #notice:not(:empty)):not([hidden]) {
    animation: brief-account-in .28s cubic-bezier(.22, 1, .36, 1) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-page .selected-area-frame { transition: none; }
}

@keyframes brief-account-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
