/* ==========================================================================
   Account pages: sign in, sign up, forgot / reset password, delete account.
   Built on gx.css (loaded first): only --gx-* tokens, light + dark together.
   Layout: calm split screen. A dark brand panel with a short, honest product
   message, and the form on the page background. Under 960px the panel folds
   into a compact header above the form (content first on mobile).
   ========================================================================== */

:root {
  --au-panel: #0b1a3f;            /* brand navy, same in both themes */
  --au-panel-fg: #f1f5ff;         /* 15.9:1 on the panel */
  --au-panel-muted: #b9c7e6;      /* 9.6:1 */
  --au-panel-line: rgb(255 255 255 / .12);
  --au-field-bg: var(--gx-surface);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --au-panel: #0a1430; --au-field-bg: var(--gx-surface-2); }
}
:root[data-theme="dark"] { --au-panel: #0a1430; --au-field-bg: var(--gx-surface-2); }

html, body { min-height: 100%; }
body { background: var(--gx-bg); }
[hidden] { display: none !important; }

.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }

/* ── Brand panel ─────────────────────────────────────────────────────────── */
.brand-panel {
  position: relative; isolation: isolate; overflow: hidden; color: var(--au-panel-fg);
  background: var(--au-panel); padding: 20px 16px; display: flex; flex-direction: column; gap: 16px;
}
.brand-panel::before { /* one quiet light source, no decoration loops */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 0% 0%, rgb(37 99 235 / .45), transparent 70%),
    radial-gradient(50% 40% at 100% 100%, rgb(20 184 166 / .22), transparent 70%);
}
.brand-panel a { color: var(--au-panel-fg); }
.brand-panel .logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; align-self: flex-start; min-height: 44px; }
.brand-panel .logo img.icon { width: 36px; height: 36px; border-radius: 10px; }
.brand-panel .logo img.word { width: auto; height: 22px; }
.brand-panel .pitch { display: none; }
.brand-panel .foot { display: none; }

@media (min-width: 960px) {
  .auth { grid-template-columns: minmax(380px, 5fr) minmax(0, 7fr); }
  .brand-panel { min-height: 100vh; min-height: 100dvh; padding: 40px clamp(32px, 4vw, 64px); gap: 0; }
  .brand-panel .logo img.icon { width: 40px; height: 40px; }
  .brand-panel .logo img.word { height: 26px; }
  .brand-panel .pitch { display: block; margin-block: auto; max-width: 440px; }
  .brand-panel .foot { display: block; }
}
.pitch .eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: var(--gx-text-sm); font-weight: 650; color: var(--au-panel-muted); }
.pitch .eyebrow .gx-dot-online { box-shadow: 0 0 0 3px rgb(16 185 129 / .25); }
.pitch .pitch-title { font-size: clamp(1.75rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 750; line-height: var(--gx-leading-tight); letter-spacing: -.02em; text-wrap: balance; color: #fff; margin: 0 0 14px; }
.pitch > p { color: var(--au-panel-muted); margin: 0 0 28px; font-size: var(--gx-text-lg); max-width: 40ch; }
.pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.pitch li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; color: var(--au-panel-fg); font-size: var(--gx-text-md); line-height: 1.5; }
.pitch li svg { width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: rgb(255 255 255 / .08); border: 1px solid var(--au-panel-line); color: #93c5fd; }
.brand-panel .foot { color: var(--au-panel-muted); font-size: var(--gx-text-sm); padding-top: 24px; border-top: 1px solid var(--au-panel-line); }
.brand-panel .foot a { color: var(--au-panel-fg); font-weight: 600; }

/* ── Form side ───────────────────────────────────────────────────────────── */
.form-side { display: flex; justify-content: center; align-items: flex-start; padding: 32px 16px 56px; }
@media (min-width: 960px) { .form-side { align-items: center; padding: 56px 40px; } }
.card { width: 100%; max-width: 420px; }
.card.wide { max-width: 600px; }
.card .mobile-logo { display: none; }
.card h1 { font-size: var(--gx-text-3xl); margin: 0 0 8px; }
.card .sub { margin: 0 0 24px; color: var(--gx-muted); }
.card > :is(form, section) > h1 { font-size: var(--gx-text-3xl); }

/* One orchestrated load moment: the form card rises in once. */
@media (prefers-reduced-motion: no-preference) {
  .form-side > .card { animation: gx-rise var(--gx-dur-4) var(--gx-ease-out) both; }
  .brand-panel .pitch > * { animation: gx-fade var(--gx-dur-4) var(--gx-ease-out) both; }
  .brand-panel .pitch > :nth-child(2) { animation-delay: 40ms; }
  .brand-panel .pitch > :nth-child(3) { animation-delay: 80ms; }
  .brand-panel .pitch > :nth-child(4) { animation-delay: 120ms; }
}

/* Fields */
.field { margin-bottom: 18px; }
.field > label, .field .label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: var(--gx-text-sm); font-weight: 650; color: var(--gx-fg-2); margin-bottom: 6px; }
.field .label-row label { color: inherit; }
.field .label-row a, .field > label a { font-size: var(--gx-text-sm); font-weight: 600; }
.card input:not([type="checkbox"]) {
  width: 100%; min-height: 48px; padding: 0 14px; background: var(--au-field-bg); color: var(--gx-fg);
  border: 1px solid var(--gx-border-strong); border-radius: var(--gx-r-sm); font-size: var(--gx-text-md); /* 16px: no iOS zoom */
  transition: border-color var(--gx-dur-1) var(--gx-ease-out), box-shadow var(--gx-dur-2) var(--gx-ease-out);
}
.card input:not([type="checkbox"]):not([aria-invalid="true"]):hover { border-color: var(--gx-subtle); }
.card input:not([type="checkbox"]):focus { outline: none; border-color: var(--gx-primary); box-shadow: var(--gx-ring); border-radius: var(--gx-r-sm); }
.card input::placeholder { color: var(--gx-subtle); }
.card input[aria-invalid="true"] { border-color: var(--gx-danger); }
.card input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(220 38 38 / .25); }
.input-wrap { position: relative; }
.input-wrap input { padding-inline-end: 52px !important; }
.reveal {
  position: absolute; inset-inline-end: 2px; top: 2px; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--gx-muted); border-radius: var(--gx-r-xs);
  transition: color var(--gx-dur-1), background-color var(--gx-dur-1);
}
.reveal:hover { color: var(--gx-fg); background: var(--gx-surface-2); }
.reveal svg { width: 20px; height: 20px; }
.reveal .i-hide { display: none; }
.reveal[aria-pressed="true"] .i-show { display: none; }
.reveal[aria-pressed="true"] .i-hide { display: block; }
.hint { font-size: var(--gx-text-sm); color: var(--gx-muted); margin-top: 6px; }

/* Inline field error: next to the field, icon + text (never colour alone). */
.field-err { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0; font-size: var(--gx-text-sm); font-weight: 600; color: var(--gx-danger-text); }
.field-err svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .field-err { animation: au-err-in var(--gx-dur-2) var(--gx-ease-out) both; }
  .field.shake input { animation: au-nudge var(--gx-dur-3) var(--gx-ease-out); }
}
@keyframes au-err-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes au-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }

/* Password strength: bars + a word, so colour is never the only cue. */
.strength-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.strength { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength span { height: 4px; border-radius: var(--gx-r-full); background: var(--gx-border); transition: background-color var(--gx-dur-2) var(--gx-ease-out); }
.strength[data-s="1"] span:nth-child(-n+1) { background: var(--gx-danger); }
.strength[data-s="2"] span:nth-child(-n+2) { background: var(--gx-warning); }
.strength[data-s="3"] span:nth-child(-n+3) { background: var(--gx-online); }
.strength[data-s="4"] span { background: var(--gx-success); }
.strength-word { min-width: 4.5em; text-align: end; font-size: var(--gx-text-xs); font-weight: 700; color: var(--gx-muted); }

/* Submit button: full width, stays legible while busy (label + spinner). */
.card .btn {
  width: 100%; min-height: 48px; margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: var(--gx-r-sm); font-weight: 700; font-size: var(--gx-text-md);
  color: var(--gx-on-primary); background: var(--gx-primary); box-shadow: 0 1px 0 rgb(255 255 255 / .15) inset, var(--gx-shadow-sm);
  transition: background-color var(--gx-dur-1) var(--gx-ease-out), box-shadow var(--gx-dur-2) var(--gx-ease-out), transform var(--gx-dur-1) var(--gx-ease-out);
}
.card .btn:hover:not(:disabled) { background: var(--gx-primary-hover); box-shadow: var(--gx-shadow-md); }
.card .btn:active:not(:disabled) { transform: scale(.98); }
.card .btn:disabled { opacity: .7; }
.card .btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.card .btn[aria-busy="true"]::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .35); border-top-color: #fff;
  animation: gx-spin .7s linear infinite;
}
.card .btn.danger { background: var(--gx-danger); }
.card .btn.danger:hover:not(:disabled) { background: #b91c1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card .btn.danger { background: #dc2626; } }
:root[data-theme="dark"] .card .btn.danger { background: #dc2626; }
.card .btn.secondary { background: var(--gx-surface); color: var(--gx-fg); border: 1px solid var(--gx-border-strong); box-shadow: none; }
.card .btn.secondary:hover:not(:disabled) { background: var(--gx-surface-2); }

/* Alert = error summary on failure, confirmation on success. */
.alert { display: none; margin-bottom: 20px; padding: 14px 16px; border-radius: var(--gx-r-sm); font-size: var(--gx-text-sm); line-height: 1.5; border: 1px solid transparent; }
.alert.show { display: flex; gap: 10px; align-items: flex-start; }
.alert.show > div { flex: 1; min-width: 0; }
.alert:focus { outline: none; }
.alert:focus-visible { outline: 2px solid var(--gx-primary); outline-offset: 2px; }
.alert > svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert.err { background: var(--gx-danger-soft); color: var(--gx-danger-text); border-color: rgb(220 38 38 / .3); }
.alert.ok { background: var(--gx-success-soft); color: var(--gx-success); border-color: rgb(5 150 105 / .3); }
.alert .alert-title { display: block; margin: 0 0 4px; font-size: var(--gx-text-md); font-weight: 700; letter-spacing: 0; color: inherit; }
.alert ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.alert ul a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert p { margin: 0; color: var(--gx-fg-2); }
@media (prefers-reduced-motion: no-preference) {
  .alert.show { animation: gx-pop var(--gx-dur-3) var(--gx-ease-out) both; }
}

/* Success state of the forgot-password form: fields fold away, one clear next step. */
form.is-done .field, form.is-done > .btn[type="submit"] { display: none; }
.done-actions { display: none; }
form.is-done .done-actions { display: grid; gap: 12px; }

.alt { margin: 24px 0 0; text-align: center; color: var(--gx-muted); font-size: var(--gx-text-sm); }
.alt a, .legal a { font-weight: 650; }
.legal { margin: 16px 0 0; text-align: center; color: var(--gx-muted); font-size: var(--gx-text-sm); }

/* ── Delete account page ─────────────────────────────────────────────────── */
.app-id { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--gx-border); border-radius: var(--gx-r-md); background: var(--gx-surface); margin: 4px 0 20px; }
.app-id img { width: 44px; height: 44px; border-radius: 12px; }
.app-id b { display: block; font-size: var(--gx-text-md); }
.app-id span { font-size: var(--gx-text-sm); color: var(--gx-muted); }
.ways { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; counter-reset: way; }
.ways li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; border: 1px solid var(--gx-border); background: var(--gx-surface); border-radius: var(--gx-r-md); padding: 14px 16px; font-size: var(--gx-text-sm); line-height: 1.55; color: var(--gx-fg-2); }
.ways li::before { counter-increment: way; content: counter(way); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gx-primary-soft); color: var(--gx-primary-text); font-weight: 700; font-size: var(--gx-text-sm); }
.ways li > b:first-child, .ways .way-title { display: block; font-weight: 700; margin-bottom: 2px; font-size: var(--gx-text-md); color: var(--gx-fg); }
.ways strong { color: var(--gx-fg); }
.request-box { border: 1px solid var(--gx-border); background: var(--gx-surface); border-radius: var(--gx-r-md); padding: 20px; margin-bottom: 8px; }
.request-box h2 { font-size: var(--gx-text-lg); margin: 0 0 4px; }
.request-box > p { margin: 0 0 16px; color: var(--gx-muted); font-size: var(--gx-text-sm); }
h2.sec { font-size: var(--gx-text-lg); margin: 28px 0 8px; }
.facts { font-size: var(--gx-text-sm); line-height: 1.6; padding-inline-start: 20px; margin: 0; color: var(--gx-fg-2); }
.facts li { margin: 6px 0; }
.facts b { color: var(--gx-fg); }
.box { border-radius: var(--gx-r-md); padding: 14px 16px; font-size: var(--gx-text-sm); line-height: 1.55; margin: 12px 0; border: 1px solid; }
.box b { display: flex; align-items: center; gap: 8px; font-size: var(--gx-text-md); }
.box b svg { width: 18px; height: 18px; }
.box.erase { background: var(--gx-danger-soft); border-color: rgb(220 38 38 / .3); color: var(--gx-fg); }
.box.erase b { color: var(--gx-danger-text); }
.box.keep { background: var(--gx-primary-soft); border-color: rgb(37 99 235 / .25); color: var(--gx-fg); }
.box.keep b { color: var(--gx-primary-text); }
.box ul { margin: 6px 0 0; padding-inline-start: 20px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--gx-text-sm); margin: 18px 0; line-height: 1.5; padding: 12px 14px; border: 1px solid var(--gx-border-strong); border-radius: var(--gx-r-sm); background: var(--gx-surface); cursor: pointer; }
.check input { margin-top: 1px; width: 20px; height: 20px; accent-color: var(--gx-danger); flex-shrink: 0; }
.done-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--gx-success-soft); color: var(--gx-success); margin-bottom: 16px; }
.done-mark svg { width: 28px; height: 28px; }
@media (prefers-reduced-motion: no-preference) { .done-mark { animation: gx-pop var(--gx-dur-3) var(--gx-ease-spring) both; } }
