/* ============================================================
   SETTINGS PAGES — /app/settings/{account,billing,privacy}.html
   2026-07 reskin to the cabinet design language (iOS-app bar):
   near-black surfaces, sparing gold, Playfair display headings,
   small-caps kickers, thin gold rules, generous whitespace.
   Loads AFTER /style.css and only refines it — all tokens come
   from style.css :root. Namespace: .iv-settings + .set-*
   ============================================================ */

/* --- Page shell (overrides .auth-page centering; the compound
   selector out-cascades style.css's `.app-header + .auth-page`) --- */
.auth-page.iv-settings {
  justify-content: flex-start;
  padding: 48px 24px 96px;
}

.iv-settings > * {
  width: 100%;
  max-width: 680px;
}

/* Modals are full-viewport overlays — exempt from the column width. */
.iv-settings > .set-modal {
  max-width: none;
}

/* Forms live inside cards — strip the standalone auth-card chrome
   that .auth-page form would otherwise re-apply. */
.iv-settings form {
  max-width: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  gap: 18px;
}

/* --- Page head --- */
.set-pagehead {
  margin-bottom: 4px;
}

.set-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold-primary);
}
.set-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--gold-primary);
  box-shadow: 0 0 6px var(--gold-glow-strong);
}

.iv-settings h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-align: left;
}

.set-lede {
  margin: 12px 0 0;
  max-width: 52ch;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* --- Settings sub-navigation --- */
.set-subnav {
  display: flex;
  gap: 4px;
  margin: 28px 0 36px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}
.set-subnav::-webkit-scrollbar { display: none; }

.set-subnav a {
  padding: 10px 14px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--duration-fast);
}
.set-subnav a:hover,
.set-subnav a:focus-visible {
  color: var(--gold-light);
}
.set-subnav a[aria-current="page"] {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
}

/* --- Cards --- */
.set-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--card-radius);
  padding: 30px 32px 32px;
  margin-bottom: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.set-card-head {
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.set-card-kicker {
  margin: 0 0 8px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold-primary);
}

.set-card h2,
.set-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.set-card-sub {
  margin: 8px 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.set-card > p:not(.set-card-kicker):not(.set-card-sub) {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* --- Danger zone --- */
.set-card--danger {
  margin-top: 44px;
  border-color: rgba(255, 69, 58, 0.25);
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(255, 69, 58, 0.06) 0%, transparent 55%),
    var(--bg-secondary);
}
.set-card--danger .set-card-head {
  border-bottom-color: rgba(255, 69, 58, 0.14);
}
.set-card--danger .set-card-kicker {
  color: var(--error);
}

/* --- Current-value row (e.g. current email) --- */
.set-current {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 18px;
  font-size: 0.9375rem;
}
.set-current-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
}
#account-current-email {
  color: var(--text-primary);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* --- Buttons --- */
/* Compact card-level submit (auth-page makes them full-width). */
.iv-settings button[type="submit"] {
  width: auto;
  align-self: flex-start;
  padding: 12px 24px;
  font-size: 0.9375rem;
  border-radius: 10px;
  margin-top: 2px;
}

.set-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 11px 20px;
  background: rgba(255, 69, 58, 0.08);
  border: 1px solid rgba(255, 69, 58, 0.35);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.set-btn-danger:hover,
.set-btn-danger:focus-visible {
  background: rgba(255, 69, 58, 0.16);
  border-color: rgba(255, 69, 58, 0.55);
  color: #fecaca;
}
.set-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.set-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  background: transparent;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--duration-fast), color var(--duration-fast), background var(--duration-fast);
}
.set-btn-ghost:hover,
.set-btn-ghost:focus-visible {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  background: var(--gold-glow);
}

/* --- Status + error lines --- */
.set-status {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
/* NOTE: no `:empty { display:none }` here — these are aria-live regions
   and must stay rendered so their first update is announced. */

/* Success confirmations (JS writes success copy into these). */
#email-status,
#pw-status {
  color: #86efac;
}

/* Compound selector: must out-cascade `.auth-page [role="alert"]`. */
.iv-settings .set-error {
  margin: 0;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* --- Banners --- */
/* Informational (email-change pending) — gold, not red. */
.iv-settings #email-change-pending-banner {
  margin-bottom: 24px;
  padding: 14px 18px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.55;
}
.iv-settings #email-change-pending-banner p { margin: 0; }
#email-change-pending-target { color: var(--gold-light); font-weight: 600; }

/* Warning banners (payment past due / deletion scheduled).
   Compound selector: must out-cascade `.auth-page [role="alert"]`. */
.iv-settings .set-banner--danger {
  margin-bottom: 24px;
  padding: 16px 18px;
  background: rgba(127, 29, 29, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.55;
}
.set-banner--danger p { margin: 0; }
.set-banner--danger p + p { margin-top: 10px; }
.set-banner--danger strong { color: #fee2e2; }
.set-banner-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Billing: plan details --- */
.set-plan-dl {
  display: grid;
  grid-template-columns: minmax(130px, max-content) minmax(0, 1fr);
  gap: 14px 24px;
  margin: 0 0 22px;
}
.set-plan-dl dt {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  align-self: center;
}
.set-plan-dl dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* Status pill — neutral gold for ALL states. (The old green-only
   pill painted "Past due" green; a neutral pill never lies.) */
#sub-status {
  display: inline-flex;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid var(--border-card);
  color: var(--gold-light);
  font-size: 0.8125rem;
  font-weight: 600;
}

.set-manage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 22px;
}
#billing-manage-note {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

#cancel-status { min-height: 1.4em; margin-top: 14px; }
#cancel-status:empty { min-height: 0; }

/* Price inside the no-subscription card */
#iv-plan-price { color: var(--gold-light); font-weight: 600; }

/* --- Modals (JS toggles inline display: none / flex) --- */
.set-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.set-modal .modal-content {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--card-radius);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.set-modal h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
}

.set-modal p {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.set-modal .modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

/* Modal buttons — harmonize the id-styled pair from style.css and
   the privacy pair alike. */
#btn-keep,
#btn-cancel-confirm,
#btn-delete-cancel-modal,
#btn-delete-confirm {
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.set-modal .set-error { margin: 12px 0 0; }

/* Always-visible escape hatch under the cancel/delete flows. */
.set-modal-help {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-tertiary);
}

.set-mail {
  color: var(--gold-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.set-mail:hover,
.set-mail:focus-visible {
  color: var(--gold-light);
}

/* Delete confirmation input spacing */
#delete-confirm-input { margin-top: 6px; }

/* --- Responsive --- */
@media (max-width: 560px) {
  .auth-page.iv-settings {
    padding: 32px 16px 72px;
  }
  .set-card {
    padding: 24px 20px 26px;
  }
  .set-plan-dl {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .set-plan-dl dd { margin-bottom: 12px; }
  .set-modal .modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .iv-settings button[type="submit"] { width: 100%; }
  .set-btn-danger { align-self: stretch; width: 100%; }
}
