/* ─────────────────────────────────────────────────────────────
   Dang! Payoff — W3 persistent account button + passwordless auth
   modal + minimal account panel. Token-styled (no new design round).
   Used on the landing nav, the onboarding desktop chrome, and the
   onboarding mobile/tablet top-right slot.
   ───────────────────────────────────────────────────────────── */

/* ── The control itself ─────────────────────────────────────── */
.po-acct-btn {
  font-family: var(--payoff-font-sans);
  cursor: pointer;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Signed-out: a token-styled "Sign in" text button. */
.po-acct-signin {
  padding: 8px 15px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--payoff-text);
  border: 1.5px solid var(--payoff-border);
  background: var(--payoff-card);
  transition: border-color 140ms ease, background 140ms ease;
  white-space: nowrap;
}
.po-acct-signin:hover { border-color: var(--payoff-sage); background: var(--payoff-sage-bg); }

/* Signed-in: a circular avatar (Google photo or initials). */
.po-acct-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--payoff-sage-bg);
  color: var(--payoff-sage-deep);
  font-family: var(--payoff-font-display);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--payoff-border);
  transition: box-shadow 140ms ease;
}
.po-acct-avatar:hover { box-shadow: 0 0 0 3px var(--payoff-sage-bg); }
.po-acct-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Mobile/tablet onboarding top-right slot (the NEW host slot, brief §5).
   Absolute within `.po-stage` (which is position:relative), safe-area aware,
   never a reckless fixed overlay. */
.po-acct-floating {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  z-index: 40;
}
@media (min-width: 641px) and (max-width: 1024px) {
  /* On tablet the stage has 32px/40px padding; sit just inside it. */
  .po-acct-floating { top: 20px; right: 24px; }
}

/* ── Modal / panel overlay ──────────────────────────────────── */
.po-acct-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-auth);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--payoff-scrim);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.po-acct-sheet {
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: var(--payoff-bg);
  border: 0.5px solid var(--payoff-border);
  border-radius: 22px;
  box-shadow: 0 30px 80px -42px rgba(23, 25, 27, 0.45);
  padding: 22px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  position: relative;
}
.po-acct-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--payoff-text-2);
  padding: 6px 8px;
}

.po-acct-head { text-align: center; margin: 6px 0 20px; }
.po-acct-tile {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--payoff-sage-bg);
  color: var(--payoff-sage-deep);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.po-acct-title {
  font-family: var(--payoff-font-display);
  font-size: 24px; font-weight: 600; letter-spacing: -0.5px;
  line-height: 1.2; color: var(--payoff-text); margin: 0 0 8px;
}
.po-acct-sub {
  font-size: 14.5px; color: var(--payoff-text-2); line-height: 1.5;
  margin: 0 auto; max-width: 300px;
}

/* Provider buttons (Apple/Google) — DISABLED "coming soon" (email-only W3). */
.po-acct-provider {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  font-family: var(--payoff-font-sans);
  background: var(--payoff-card);
  border: 0.5px solid var(--payoff-border);
  color: var(--payoff-text);
  margin-bottom: 10px;
  cursor: default;
  opacity: 0.55;
  pointer-events: none; /* truly inert — no dead-tap that silently fails */
}
.po-acct-provider__soon {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--payoff-text-3);
  background: var(--payoff-border-2);
  border-radius: 5px; padding: 2px 6px; margin-left: 2px;
}

/* ── The ACCOUNT-CREATION GROUP (C8-R1, amended C8-R1A) ───────────
   Holds the signup disclosure FIRST and then the complete set of
   account-creation controls the view offers, and nothing else — in the
   email view that is Apple · Google · the "or with email" divider · the
   email field · the primary button, so the sentence sits above the
   Google action as well as the email one. Deliberately NO box of its
   own — no padding, border, background or margin — so the group is
   invisible and the rendered spacing is exactly the children's own
   margins. It exists to make the ordering structural, not incidental. */
.po-acct-actions {
  display: block;
}

/* ── Signup disclosure (founder ruling C8/B-2, amended C8-R1A) ────
   "By continuing, you agree to the Terms of Service and acknowledge the
   Privacy Notice." Rendered as the FIRST child of `.po-acct-actions`,
   ahead of every account-creation control in that group. Typography
   deliberately matches the onboarding welcome screen's legal line
   (12.5px / --payoff-text-3 / 2px underline offset) so the two legal
   treatments read as one system. Tokens only — no new hex. */
.po-acct-legal {
  margin: 0 0 14px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--payoff-text-3);
}
.po-acct-legal__link {
  color: var(--payoff-text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.po-acct-legal__link:focus-visible {
  outline: 2px solid var(--payoff-coral);
  outline-offset: 2px;
  border-radius: 3px;
}

.po-acct-divider {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
}
.po-acct-divider__rule { flex: 1; height: 0.5px; background: var(--payoff-border); }
.po-acct-divider__text { font-size: 12px; color: var(--payoff-text-3); }

.po-acct-field { display: block; margin-bottom: 4px; }
.po-acct-field__label {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--payoff-text-3); margin-bottom: 6px;
}
.po-acct-field__box {
  background: var(--payoff-card);
  border: 0.5px solid var(--payoff-border);
  border-radius: 12px;
  padding: 13px 14px;
  display: flex; align-items: center;
}
.po-acct-field__box--error { border-color: var(--payoff-coral); }
.po-acct-field__box input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font-size: 17px; font-weight: 500; color: var(--payoff-text);
  font-family: var(--payoff-font-sans);
}
.po-acct-field__box input.po-acct-mono { font-family: var(--payoff-font-num); letter-spacing: 2px; }

.po-acct-error { font-size: 13px; color: var(--payoff-coral); line-height: 1.4; margin-top: 8px; }
.po-acct-hint { font-size: 12.5px; color: var(--payoff-text-3); text-align: center; line-height: 1.5; margin-top: 8px; }

.po-acct-primary {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 0;
  background: var(--payoff-coral);
  color: #fff;
  font-size: 16px; font-weight: 600;
  font-family: var(--payoff-font-sans);
  cursor: pointer;
  margin-top: 14px;
  transition: background 140ms ease;
}
.po-acct-primary:hover:not(:disabled) { background: var(--payoff-coral-press); }
.po-acct-primary:disabled { opacity: 0.45; cursor: default; }

.po-acct-text {
  width: 100%;
  background: transparent; border: 0; cursor: pointer;
  padding: 12px; margin-top: 6px;
  font-size: 15px; font-weight: 600;
  font-family: var(--payoff-font-sans);
  color: var(--payoff-text-2);
}
.po-acct-text--coral { color: var(--payoff-coral); }
.po-acct-text:disabled { opacity: 0.5; cursor: default; }

.po-acct-footnote {
  font-size: 11.5px; color: var(--payoff-text-3);
  text-align: center; line-height: 1.5; margin-top: 14px;
}

/* ── Account panel (signed-in) rows ─────────────────────────── */
.po-acct-row {
  padding: 14px 0;
  border-bottom: 0.5px solid var(--payoff-border);
}
.po-acct-row__label {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  color: var(--payoff-text-3); margin-bottom: 5px;
}
/* ── Anon account gate (ITEM 4 — intentional gate for unauthenticated users)
   Shown in app.html#account when no session exists. Leads with a
   "Create your free account" hero and presents the passwordless sign-in CTA.
   Uses existing design tokens (var(--payoff-*)) and the po-cta / po-display /
   po-eyebrow-lg classes already on the page.
   ─────────────────────────────────────────────────────────────────────────── */
.ma-gate {
  max-width: 420px;
  margin: 0 auto;
  padding: 32px 0 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.ma-gate__hero { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ma-gate__eyebrow { margin: 0 0 6px; }
.ma-gate__title {
  font-size: clamp(26px, 5vw, 32px);
  line-height: 1.08; margin: 0 0 4px;
}
.ma-gate__sub {
  font-size: 15px; line-height: 1.6;
  color: var(--payoff-text-2); margin: 0;
}
/* Sage "browsing locally" pill */
.ma-gate__local {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--payoff-sage-deep);
  background: var(--payoff-sage-bg);
  border: 0.5px solid var(--payoff-sage-line);
  border-radius: 20px; padding: 7px 15px;
}
.ma-gate__local-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--payoff-sage); flex-shrink: 0;
}
/* Feature list card */
.ma-gate__card {
  width: 100%;
  background: var(--payoff-card);
  border: 0.5px solid var(--payoff-border);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 13px;
  text-align: left;
}
.ma-gate__card-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--payoff-text-3); margin: 0;
}
.ma-gate__feat {
  display: flex; align-items: flex-start; gap: 11px;
  font-size: 14px; color: var(--payoff-text); line-height: 1.4;
}
.ma-gate__check {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
  border-radius: 6px; background: var(--payoff-sage); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.ma-gate__feat-text { flex: 1; }
/* Primary CTA: full-width coral button (inherits po-cta styles) */
.ma-gate__cta {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
}
/* Small reassurance note */
.ma-gate__note {
  font-size: 12.5px; color: var(--payoff-text-3);
  line-height: 1.5; margin: 0;
}
/* Secondary draft-download row (Stage C). LAYOUT HOOK ONLY — the button also
   carries `po-cta po-cta--ghost`, and that is where its colour, font, border and
   radius come from. Restating any of those here would fork the design system into
   a second source of truth for one control, so this rule sets neither.
   Why width is needed at all: `.ma-gate` is a centred flex column
   (align-items: center), so its children shrink to fit — which is why
   `.ma-gate__hero`, `.ma-gate__card` and `.ma-gate__cta` each declare width too.
   Without it the ghost button measured 202.64px under a 420px primary CTA.
   Vertical spacing is deliberately NOT set: the parent's `gap: 20px` already
   spaces this row from the note above and its caption below, uniformly with the
   rest of the gate. min-height is a tap-target FLOOR, not the rendered height
   (measured 50px from po-cta's own padding); it holds the target if text scales. */
.ma-gate__draft {
  width: 100%;
  min-height: 48px;
}
.po-acct-row__value { font-size: 16px; color: var(--payoff-text); font-weight: 500; word-break: break-all; }

/* ═══════════════════════════════════════════════════════════════════════════
   §02 BILLING — GO-STAGE-D-BILLING-001.

   Ported from the LOCKED design package `_design/Dang-Payoff-Payments-Package/
   payments.css`. `.kv`, `.gcard` and `.frozen .fz` are reproduced VERBATIM from
   that file (lines 112-115, 127-130); the `.ma-bill-*` wrappers adapt them to the
   Account page's section chrome without changing the design's own rules.
   `.po-pill` / `.po-pill--amber` / `.po-pill--ghost` already ship in
   payoff-tokens.css and are reused rather than redefined.
   ═══════════════════════════════════════════════════════════════════════════ */

/* verbatim — payments.css:127-129 */
.ma-bill-card {
  background: var(--payoff-card);
  border: 1px solid var(--payoff-border);
  border-radius: 16px;
  padding: 18px;
}
.ma-bill-card--flat { background: #FFFDFA; margin-top: 14px; }

.ma-bill-card__t { margin: 12px 0 0; font-size: 16.5px; font-weight: 700; letter-spacing: -0.2px; }
.ma-bill-card__b { margin: 7px 0 0; font-size: 14px; color: var(--payoff-text-2); line-height: 1.55; }

.ma-bill-rows { margin-top: 16px; border-top: 1px solid var(--payoff-border-2); padding-top: 4px; }
.ma-bill-rows--statements { margin-top: 18px; }
.ma-bill-eyebrow { margin-bottom: 12px; color: var(--payoff-text-2); }

/* verbatim — payments.css:112-115 */
.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--payoff-border-2);
  font-size: 14.5px;
}
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--payoff-text-2); }
.kv__v { font-weight: 600; text-align: right; }

.ma-bill-cta {
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: var(--payoff-coral);
  color: #fff;
  font-family: inherit;
}
.ma-bill-cta:hover { background: var(--payoff-coral-press); }
.ma-bill-cta.is-inert { opacity: 0.55; cursor: default; }

/* The inline rejection (spec §3 I4) — a SENTENCE the user can read, not a toast. */
.ma-bill-reject {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #4A3411;
  background: var(--payoff-amber-bg);
  border: 1px solid #E7CE9B;
  border-radius: 12px;
  padding: 11px 13px;
}
.ma-bill-reject[hidden] { display: none; }
/* ⛔ R-1 — the SAME rejection slot, rendered inside the rail's plan card. The class is
   reused rather than re-styled so the sentence a user reads looks identical wherever
   they clicked; `.ma-plan` is a flex column with its own `gap`, so the top margin the
   §02 card needs would double the separation here. */
.ma-plan__reject { margin-top: 0; }

.ma-bill-note { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--payoff-text-2); }
.ma-bill-processor { margin: 16px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--payoff-text-2); }

/* LOADING skeleton — claims nothing. */
.ma-bill-sk { border-radius: 7px; background: var(--payoff-border-2); }
.ma-bill-sk--pill { width: 104px; height: 24px; border-radius: 999px; }
.ma-bill-sk--line { height: 13px; margin-top: 14px; }
.ma-bill-sk--short { width: 58%; }

/* ⛔ D-5 — THE SKELETON'S ESCAPE HATCH, REVEALED AFTER A BOUNDED WAIT.

   MEASURED (`_uat/stage_d_wsl/d5_DIAGNOSE.txt`, real Chromium): a 503 or a network
   abort spends ~7.2 s inside the transport's exponential-backoff retry chain (requests
   at ~175 · 1195 · 3203 · 7211 ms) before it settles to UNAVAILABLE, and `Try again`
   exists ONLY in UNAVAILABLE — so for those seconds the user had a spinner and no way
   to ask again. A 500 is not retried and settles in 193 ms, which is why the asymmetry
   looked like a 503-only bug.

   ⛔ WHY THE DELAY LIVES HERE AND NOT IN A `setTimeout`. `renderAccount` returns a
   cleanup function and its callers DISCARD it, so a timer scheduled on the mount path
   outlives the route — Deno's leak detector proved it, failing `_advBdelProbe.test.ts`
   ADV-3b/3c with "2 timers were started in this test, but never completed". A CSS
   reveal holds no resource, needs no teardown, and cannot leak.

   ⛔ `visibility`, NOT `opacity`. Hidden means hidden: out of the accessibility tree and
   out of hit-testing, so there is never a control the user can perceive or click that
   does nothing (the D-3 standard — absence, not disablement). The moment it appears it
   is a real, live button running our own re-read.

   ⛔ 4000ms IS PINNED to `BILLING_SLOW_READ_MS` in `account/page.js` by
   `billingPrincipalFence.test.ts`. Changing one without the other is a failing test. */
.ma-bill-cta--deferred {
  visibility: hidden;
  animation: maBillCtaDeferredReveal 1ms linear 4000ms forwards;
}
@keyframes maBillCtaDeferredReveal { to { visibility: visible; } }

/* ═══════════════════════════════════════════════════════════════════════════
   ⛔ WS-U — THE §6.2 CHECKOUT PANEL (quote → disclosure → accept).

   Ported from the LOCKED design's own two surfaces rather than newly styled: the
   plan rows reproduce `_design/Dang-Payoff-Handoff/v2/ob-paywall.jsx`'s plan
   buttons (16px radius, 0.5px border, card background, coral on selection) and the
   disclosure rows reuse `.kv` and `.ma-bill-rows` unchanged, so the figures the user
   accepts against are set in exactly the type the billing card already uses.

   ⛔ NOTHING HERE IS `visibility:hidden`, `opacity` OR `disabled`. Every control the
   panel renders is a real, live control — the §4.6 standard: absent, or live.
   ═══════════════════════════════════════════════════════════════════════════ */
.ma-bill-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--payoff-border-2);
}
.ma-bill-panel__t {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.ma-bill-plans { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* design ob-paywall.jsx plan card — the non-dominant metrics, since every row here
   carries the same weight until the SERVER has quoted one. */
.ma-bill-plan {
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--payoff-text);
  padding: 13px 16px;
  border-radius: 16px;
  border: 0.5px solid var(--payoff-border);
  background: var(--payoff-card);
  cursor: pointer;
  min-height: 48px;
}
.ma-bill-plan:hover { border-color: var(--payoff-coral); background: var(--payoff-coral-ghost); }
.ma-bill-plan[aria-busy="true"] { cursor: progress; }

.ma-bill-panel__accept { width: 100%; }

/* The §6.2 re-disclosure banner. Amber, like every other inline refusal on this
   surface — it is not an error, but it IS something the user must read before acting. */
.ma-bill-redisclose {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--payoff-amber-bg);
  border: 1px solid #E7CE9B;
  color: #4A3411;
}
.ma-bill-redisclose__t { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; }
.ma-bill-redisclose__b { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; }

/* "Maybe later" — a quiet text control, the design's own dismiss weight. */
.ma-bill-dismiss {
  margin-top: 12px;
  border: 0;
  background: transparent;
  padding: 10px 4px;
  min-height: 44px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--payoff-text-2);
  cursor: pointer;
}
.ma-bill-dismiss:hover { color: var(--payoff-text); }

/* ⛔ THE FREEZE TREATMENT — verbatim from payments.css:130.
   0.5 opacity + desaturation on the JOURNEY PANEL ONLY (`.fz`); chrome and controls
   stay at FULL CONTRAST (design HANDOFF.md:109-110, spec §2 E7 "Visual"). */
.frozen .fz { opacity: 0.5; filter: saturate(0.55); }
