/* ============================================================
   Delete-account dialog (js/accountDeletion.js) and the page
   delete-account.html. Loaded by dashboard.html, tracker.html and
   delete-account.html, each of which also loads css/main.css.

   Tokens only, so both themes come for free. Three choices worth
   knowing:

   · The dialog is --bg-elevated on an opaque scrim, not glass: a
     blurred page behind a decision this final reads as decoration.
   · The destructive button is --text-danger FILLED with --bg-base
     text. The pair is the page's own text-on-surface contrast turned
     inside out (≥ 6:1 in both themes); a white label on the dark
     theme's light red would sit near 2.8:1.
   · Secondary text is --text-secondary, never --text-muted: muted on
     the elevated surface is under AA for body text (see
     css/legal-forms.css, which draws the same line).
   ============================================================ */

html.ad-open { overflow: hidden; }

.ad-overlay {
  position: fixed;
  inset: 0;
  /* Above the hub's own confirm (9500) and the tracker's sheets. */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--bg-base) 82%, transparent);
}

.ad-dialog {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  font-family: var(--font-body);
  text-align: left;
}
@media (max-width: 480px) { .ad-dialog { padding: 20px 16px; } }

.ad-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--text-primary);
}
.ad-intro { margin: 0 0 16px; font-size: 15px; line-height: 1.6; color: var(--text-secondary); overflow-wrap: anywhere; }

.ad-body h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 16px 0 6px;
}
.ad-body p, .ad-list { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin: 0; }
.ad-list { padding-left: 20px; display: grid; gap: 2px; }
.ad-body a, .ad-dialog .ad-links a { color: var(--text-accent); }
.ad-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 6px !important; }
.ad-links a { display: inline-flex; align-items: center; min-height: 24px; font-weight: 600; }
.ad-store { margin-top: 8px !important; }
.ad-store--live { color: var(--text-warning) !important; font-weight: 600; }

.ad-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-medium); display: grid; gap: 14px; }
.ad-field { display: flex; flex-direction: column; gap: 6px; }
.ad-field label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ad-field input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;                 /* 16px: iOS zooms into anything smaller */
  color: var(--text-primary);
  font-family: var(--font-body);
}
.ad-field input:focus-visible { outline: 2px solid var(--text-accent); outline-offset: 2px; }
.ad-hint { font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin: 0; }
.ad-error { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--text-danger); }
.ad-error[hidden] { display: none; }
.ad-status { margin: 0; font-size: 14px; color: var(--text-secondary); min-height: 0; }
.ad-status:empty { display: none; }

.ad-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
@media (max-width: 480px) {
  .ad-actions { flex-direction: column-reverse; }
  .ad-actions .btn { width: 100%; }
}

.btn.ad-btn-danger {
  background: var(--text-danger);
  color: var(--bg-base);
  border: 1px solid var(--text-danger);
  box-shadow: none;
  animation: none;
}
.btn.ad-btn-danger:hover { filter: brightness(1.06); }
.btn.ad-btn-danger:focus-visible { outline: 2px solid var(--text-danger); outline-offset: 3px; }
.btn.ad-btn-danger[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn.ad-btn-danger[aria-busy="true"] { cursor: progress; }

/* ── The entry points ─────────────────────────────────────── */

/* The hub's settings card: a quiet outline, danger-coloured. It opens a
   dialog that explains everything before anything happens. */
.ad-card { border: 1px solid color-mix(in srgb, var(--text-danger) 45%, var(--border-medium)); }
.ad-card-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 6px 0 12px; }
.btn.ad-open-btn {
  background: none;
  color: var(--text-danger);
  border: 1px solid var(--text-danger);
  box-shadow: none;
  animation: none;
}
.btn.ad-open-btn:hover { background: color-mix(in srgb, var(--text-danger) 10%, transparent); }

/* ── delete-account.html ──────────────────────────────────── */
.ad-page-h { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 12px; }
.ad-page-h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 18px 0 6px; }
.ad-page-p { font-size: 15px; line-height: 1.65; color: var(--text-secondary); margin: 0 0 12px; overflow-wrap: anywhere; }
.ad-page-p strong { color: var(--text-primary); }
.ad-page-p a { color: var(--text-accent); }
.ad-page-list { font-size: 15px; margin-bottom: 4px; }
#adAction [data-ad-state] > :last-child { margin-bottom: 0; }
#adDone:focus { outline: none; }
