/* ──────────────────────────────────────────────────────────────────────
   Auth pages — Linear-grounded, `.auth-v2` scope.

   Shell `auth/auth_base.html` (extends base_minimal) owns the split frame;
   child templates fill the form column. Quiet split: a calm dark brand
   panel (lg+) + a clean form column. No grain, no glow gradients, no
   decorative FA glyphs, no stock testimonial — hairlines + restraint.
   The brand panel carries a faint grid texture and an illustrative
   product vignette (sample ops rows + stat tiles) so the space reads as
   the product, not as a void.

   Tokens come from the GLOBAL design-variables.css (loaded by
   base_minimal), so the same palette as the rest of the app.
   ────────────────────────────────────────────────────────────────────── */

.auth-v2 {
  display: flex;
  min-height: 100vh;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  background: var(--theme-bg);
  color: var(--theme-text);
}
.auth-v2 a { text-decoration: none; }
.auth-v2 button { font-family: inherit; cursor: pointer; }

/* ─── Left brand panel ────────────────────────────────────────────────── */
.auth-v2 .auth-brand {
  display: none;
  width: 46%;
  max-width: 620px;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-12, 48px) var(--space-12, 48px);
  background: var(--auth-brand-bg);
  color: var(--auth-brand-text);
  position: relative;
  overflow: hidden;
}
@media (min-width: 1024px) { .auth-v2 .auth-brand { display: flex; } }

/* Texture: faint engineering grid + two soft brand washes. Masked so it
   thins out mid-panel and never competes with the copy. */
.auth-v2 .auth-brand-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(560px 420px at 14% 4%, rgba(99, 91, 255, 0.2), transparent 62%),
    radial-gradient(520px 420px at 88% 96%, rgba(6, 182, 212, 0.12), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: auto, auto, 88px 88px, 88px 88px;
  -webkit-mask-image: linear-gradient(180deg, #000, rgba(0, 0, 0, 0.55) 50%, rgba(0, 0, 0, 0.9));
          mask-image: linear-gradient(180deg, #000, rgba(0, 0, 0, 0.55) 50%, rgba(0, 0, 0, 0.9));
}
.auth-v2 .auth-brand > *:not(.auth-brand-texture) { position: relative; z-index: 1; }

.auth-v2 .auth-brand-top { display: flex; align-items: center; gap: 10px; }
.auth-v2 .auth-wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-family-heading);
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--auth-brand-text);
}
.auth-v2 .auth-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand-primary);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--auth-brand-text); font-family: var(--font-family-heading); font-weight: 700; font-size: 15px;
}
.auth-v2 .auth-brand-mid { max-width: 420px; }
.auth-v2 .auth-brand-headline {
  font-family: var(--font-family-heading);
  font-size: 30px; font-weight: 600; line-height: 1.18; letter-spacing: -0.025em;
  color: var(--auth-brand-text);
}
.auth-v2 .auth-brand-sub {
  margin-top: var(--space-4);
  font-size: 14.5px; line-height: 1.6; color: var(--auth-brand-text-muted);
}
.auth-v2 .auth-brand-features {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5);
  list-style: none; padding: 0; margin: 0;
}
.auth-v2 .auth-brand-features li {
  font-family: var(--font-family-mono);
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--auth-brand-text-subtle);
  display: inline-flex; align-items: center; gap: 6px;
}
.auth-v2 .auth-brand-features li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--auth-brand-dot);
}

/* ─── Product vignette (brand panel) ──────────────────────────────────────
   Illustrative ops slice: one "Today" card with three status rows + three
   stat tiles. Dark-on-dark hairlines; numbers tabular; aria-hidden in the
   template. */
.auth-v2 .auth-vignette {
  margin-top: var(--space-8);
  max-width: 384px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.auth-v2 .auth-vignette-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.auth-v2 .auth-vignette-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.auth-v2 .auth-vignette-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85);
}
.auth-v2 .auth-vignette-count {
  font-family: var(--font-family-mono);
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}
.auth-v2 .auth-vignette-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
}
.auth-v2 .auth-vignette-row + .auth-vignette-row {
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}
.auth-v2 .auth-vignette-dot {
  flex: none;
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.auth-v2 .auth-vignette-dot.is-good { background: #34d399; }
.auth-v2 .auth-vignette-dot.is-warn { background: #fbbf24; }
.auth-v2 .auth-vignette-label {
  flex: 1; min-width: 0;
  font-size: 12.5px; color: rgba(255, 255, 255, 0.78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-v2 .auth-vignette-id {
  font-family: var(--font-family-mono);
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
}
.auth-v2 .auth-vignette-status {
  flex: none;
  font-size: 11.5px; color: rgba(255, 255, 255, 0.5);
}
.auth-v2 .auth-vignette-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.auth-v2 .auth-vignette-stat {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
}
.auth-v2 .auth-vignette-num {
  display: block;
  font-family: var(--font-family-heading);
  font-size: 17px; font-weight: 640; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.auth-v2 .auth-vignette-cap {
  display: block;
  margin-top: 2px;
  font-family: var(--font-family-mono);
  font-size: 10.5px; letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
}

/* ─── Right form column ───────────────────────────────────────────────── */
.auth-v2 .auth-form-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12, 48px) var(--space-5);
  position: relative;
}
.auth-v2 .auth-form-wrap { width: 100%; max-width: 384px; }

.auth-v2 .auth-mobile-mark {
  display: flex; justify-content: center; margin-bottom: var(--space-8);
}
@media (min-width: 1024px) { .auth-v2 .auth-mobile-mark { display: none; } }
.auth-v2 .auth-mobile-mark .auth-wordmark { color: var(--theme-text); }

/* ─── Headings ────────────────────────────────────────────────────────── */
.auth-v2 .auth-h { margin-bottom: var(--space-6); }
.auth-v2 .auth-h-title {
  font-family: var(--font-family-heading);
  font-size: 24px; font-weight: 640; letter-spacing: -0.025em;
  color: var(--theme-text); line-height: 1.15;
}
.auth-v2 .auth-h-sub { margin-top: 7px; font-size: 13.5px; color: var(--theme-text-tertiary); }

/* ─── Fields ──────────────────────────────────────────────────────────── */
.auth-v2 .auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-v2 .auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-v2 .auth-label { font-size: 12.5px; font-weight: 500; color: var(--theme-text-secondary); }
.auth-v2 .auth-input {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit; font-size: 13.5px;
  color: var(--theme-text);
  background: var(--theme-input-bg);
  border: 1px solid var(--theme-input-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.auth-v2 .auth-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}
.auth-v2 .auth-input::placeholder { color: var(--theme-text-tertiary); }
.auth-v2 .auth-input.is-error { border-color: var(--danger); }
.auth-v2 .auth-input.is-error:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent);
}
.auth-v2 .auth-error { font-size: 11.5px; font-weight: 600; color: var(--danger-text); }
/* Helper text under a field (e.g. "use a backup code instead") */
.auth-v2 .auth-hint { margin-top: 7px; font-size: 12.5px; line-height: 1.5; color: var(--theme-text-tertiary); }
.auth-v2 .auth-hint a { color: var(--brand-text); }
/* One-time-code input — centred, spaced, tabular */
.auth-v2 .auth-otp { text-align: center; letter-spacing: 0.32em; font-variant-numeric: tabular-nums; font-size: 16px; }
.auth-v2 .auth-otp::placeholder { letter-spacing: 0.32em; }

.auth-v2 .auth-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.auth-v2 .auth-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--theme-text-secondary); }
.auth-v2 .auth-check input { accent-color: var(--brand-primary); }
.auth-v2 .auth-link {
  font-size: 12.5px; font-weight: 500; color: var(--brand-text);
  transition: opacity var(--transition-fast);
}
.auth-v2 .auth-link:hover { opacity: 0.78; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.auth-v2 .auth-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--theme-text);
  color: var(--theme-text-inverted);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-v2 .auth-btn:hover { background: var(--brand-primary); }
.auth-v2 .auth-btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* Press give — the one allowed :active transform (house rules §5). */
@media (prefers-reduced-motion: no-preference) {
  .auth-v2 .auth-btn:active:not(:disabled) { transform: scale(0.985); }
}
.auth-v2 .auth-btn-sec {
  width: 100%;
  padding: 10px 16px;
  background: var(--theme-card-bg);
  color: var(--theme-text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-v2 .auth-btn-sec:hover { border-color: var(--border-strong); background: var(--theme-hover); color: var(--theme-text); }

/* ─── OAuth divider ───────────────────────────────────────────────────── */
.auth-v2 .auth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  margin: var(--space-5) 0;
  font-size: 11px; color: var(--theme-text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-family-mono);
}
.auth-v2 .auth-divider::before,
.auth-v2 .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-divider); }

/* ─── Disclosure (e.g. "Wrong email address?" on the unconfirmed page) ─── */
.auth-v2 .auth-details {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-divider);
}
.auth-v2 .auth-details > summary {
  cursor: pointer;
  list-style: none;
  text-align: center;
}
.auth-v2 .auth-details > summary::-webkit-details-marker { display: none; }
.auth-v2 .auth-details > summary:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Left-aligned once open: the summary reads as a centered link, but the form
   under it is a normal labelled form and must align with the rest of them. */
.auth-v2 .auth-details[open] > summary { margin-bottom: var(--space-2); }
.auth-v2 .auth-details .auth-form { text-align: left; }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.auth-v2 .auth-footer { margin-top: var(--space-6); text-align: center; }
.auth-v2 .auth-footer-text { font-size: 12.5px; color: var(--theme-text-tertiary); }
.auth-v2 .auth-footer-actions { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-3); }
.auth-v2 .auth-footer-actions .auth-btn-sec { width: auto; padding: 7px 14px; font-size: 12.5px; }

/* ─── Path choice cards (login → the two account types) ───────────────── */
.auth-v2 .auth-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
  text-align: left;
}
@media (max-width: 420px) { .auth-v2 .auth-paths { grid-template-columns: 1fr; } }
.auth-v2 .auth-path {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--theme-card-bg);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.auth-v2 .auth-path:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 36%, var(--border-subtle));
  background: var(--theme-hover);
}
.auth-v2 .auth-path-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--theme-text);
}
.auth-v2 .auth-path-title::after {
  content: "→";
  font-size: 12px;
  color: var(--theme-text-tertiary);
  transition: color var(--transition-fast);
}
.auth-v2 .auth-path:hover .auth-path-title::after { color: var(--brand-text); }
.auth-v2 .auth-path-desc {
  display: block;
  margin-top: 3px;
  font-size: 11.5px; line-height: 1.45;
  color: var(--theme-text-tertiary);
}

/* ─── Legal note ──────────────────────────────────────────────────────── */
.auth-v2 .auth-legal {
  margin-top: var(--space-8);
  font-size: 11.5px; line-height: 1.55;
  color: var(--theme-text-tertiary);
  text-align: center;
}
.auth-v2 .auth-legal a {
  color: var(--theme-text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}
.auth-v2 .auth-legal a:hover { color: var(--brand-text); }

/* ─── Spacing helpers ─────────────────────────────────────────────────── */
.auth-v2 .auth-mt { margin-top: var(--space-5); }

/* ── Flash messages in the form column ──────────────────────────────────
   The shared stack (macros/flash_messages.html) is `fixed top-4 right-4
   max-w-sm ml-auto`; here it is a static, full-width block under the phone
   wordmark and above the heading, so a redirect notice never covers the
   brand or floats away from the form it explains. */
.auth-v2 .auth-flash-stack { position: static; max-width: none; margin: 0 0 var(--space-4); padding: 0; pointer-events: auto; }
.auth-v2 .auth-flash:empty { display: none; }
