/* Auth & boot screen — emerald shield design. Scoped to .auth-v2 / .boot-v2 / .auth-violet. */
.auth-v2,
.boot-v2 {
  --av-bg: #07150f;
  --av-field: #14251c;
  --av-field-border: #30483a;
  --av-border: rgba(52, 211, 153, 0.16);
  --av-text: #f0f8f3;
  --av-label: #dcebe2;
  --av-muted: #95ada0;
  --av-faint: #95ada0;
  --av-accent: #047857;
  --av-accent-hover: #065f46;
  --av-link: #34d399;
  --av-glow: 0 5px 16px rgba(4, 120, 87, 0.18);
  --av-danger: #fb7185;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--av-text);
}
html[data-theme="light"] .auth-v2,
html[data-theme="light"] .boot-v2 {
  --av-bg: #f4faf6;
  --av-field: #ffffff;
  --av-field-border: #d7e8dd;
  --av-border: rgba(4, 120, 87, 0.14);
  --av-text: #122c20;
  --av-label: #253e30;
  --av-muted: #536f5e;
  --av-faint: #587564;
  --av-link: #065f46;
  --av-glow: 0 5px 16px rgba(6, 95, 70, 0.12);
}

/* Original-markup auth status pages (reset password / verify email / auto-login). */
.auth-violet {
  --color-accent-50: 236, 253, 245;
  --color-accent-100: 209, 250, 229;
  --color-accent-200: 167, 243, 208;
  --color-accent-300: 110, 231, 183;
  --color-accent-400: 52, 211, 153;
  --color-accent-500: 4, 120, 87;
  --color-accent-600: 6, 95, 70;
  --color-accent-700: 4, 120, 87;
  --color-accent-800: 6, 95, 70;
  --color-accent-900: 6, 78, 59;
  --color-accent-950: 2, 44, 34;
  min-height: 100dvh;
  background: radial-gradient(520px 380px at 50% 0%, rgba(4, 120, 87, 0.22), transparent 70%), #07150f;
}
/* Green-tinted dark neutrals — dark theme only (light theme remaps dark-* itself). */
html:not(.light):not([data-theme="light"]) .auth-violet {
  --color-dark-300: 174, 200, 189;
  --color-dark-400: 134, 164, 154;
  --color-dark-500: 96, 122, 112;
  --color-dark-600: 63, 88, 77;
  --color-dark-700: 38, 59, 50;
  --color-dark-800: 24, 43, 36;
  --color-dark-850: 18, 35, 29;
  --color-dark-900: 13, 28, 22;
  --color-dark-950: 7, 21, 15;
}
html.light .auth-violet,
html[data-theme="light"] .auth-violet {
  background: radial-gradient(520px 380px at 50% 0%, rgba(4, 120, 87, 0.16), transparent 70%), #f4faf6;
}

/* ---------- Boot screen ---------- */
.boot-v2 {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(560px 420px at 50% 44%, rgba(4, 120, 87, 0.24), transparent 70%),
    var(--av-bg);
}
.boot-v2 { z-index: 1000; }
.boot-v2.is-done { animation: boot-out .5s ease forwards; pointer-events: none; }
.boot-v2.is-done .boot-v2__inner { animation: boot-zoom .5s ease forwards; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }
@keyframes boot-zoom { to { transform: scale(1.06); } }
.boot-v2__inner { display: grid; justify-items: center; gap: 22px; }
/* Splash: the edge draws, the glass fills, a check confirms protection, then waves pulse while loading. */
.boot-v2__emblem { position: relative; display: grid; place-items: center; width: 132px; height: 150px; }
.boot-v2__shield {
  position: relative;
  width: 112px;
  overflow: visible;
  filter: drop-shadow(0 0 14px rgba(52, 211, 153, 0.55));
  animation: boot-pop .9s cubic-bezier(.34, 1.56, .64, 1) backwards, boot-glow 3s ease-in-out 1.3s infinite;
}
.boot-v2__edge { stroke-dasharray: 1; animation: av-draw .8s cubic-bezier(.65, 0, .35, 1) .05s backwards; }
.boot-v2__body { animation: av-fade .6s ease-out .45s backwards; }
.boot-v2__check { stroke-dasharray: 1; animation: av-draw .45s cubic-bezier(.65, 0, .35, 1) .8s backwards; }
.boot-v2__glint { transform: translateX(-160px); animation: av-sweep 2.8s ease-in-out 1.1s infinite; }
.boot-v2__wave {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(110, 231, 183, 0.6);
  opacity: 0;
  animation: boot-wave 2.4s ease-out 1.1s infinite;
}
.boot-v2__wave:nth-child(2) { animation-delay: 1.9s; }
.boot-v2__wave:nth-child(3) { animation-delay: 2.7s; }
.boot-v2__name { margin: 0; font: 700 20px/1.2 "Outfit", "Manrope", sans-serif; animation: boot-rise .6s ease-out .5s backwards; }
.boot-v2__bar { width: 168px; height: 3px; border-radius: 3px; background: rgba(52, 211, 153, 0.16); overflow: hidden; animation: av-fade .5s ease-out .8s backwards; }
.boot-v2__bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #065f46, #34d399);
  animation: av-slide 1.2s ease-in-out infinite;
}
.boot-v2__hint { margin: 0; font-size: 12px; color: var(--av-muted); animation: av-fade .5s ease-out .9s backwards; }
@keyframes boot-pop { from { opacity: 0; transform: scale(.82); } }
@keyframes boot-glow { 50% { filter: drop-shadow(0 0 24px rgba(52, 211, 153, 0.85)); } }
@keyframes boot-wave { 0% { opacity: .7; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes boot-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes av-spin { to { transform: rotate(360deg); } }
@keyframes av-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ---------- Auth layout ---------- */
.auth-v2 {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(900px 700px at 0% 0%, rgba(6, 95, 70, 0.28), transparent 60%),
    radial-gradient(700px 600px at 30% 70%, rgba(6, 95, 70, 0.18), transparent 70%),
    var(--av-bg);
  overflow-x: hidden;
}
.auth-v2 [hidden] { display: none !important; }
.auth-v2 a { color: inherit; }

.av-brand {
  position: absolute;
  top: 36px;
  left: 56px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.av-mark { width: 38px; height: 38px; filter: drop-shadow(0 0 10px rgba(4, 120, 87, 0.55)); }
.av-brand-name { font: 700 28px/1 "Outfit", "Manrope", sans-serif; letter-spacing: -0.3px; }

.av-visual {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  padding: 90px 24px 40px;
  min-height: 100dvh;
}
.av-scene { width: min(100%, 640px); height: auto; overflow: visible; }
.av-shield { animation: av-float 7s ease-in-out infinite; transform-origin: 300px 310px; }
@keyframes av-float { 50% { transform: translateY(-10px); } }
@keyframes av-blink { 50% { opacity: 0.45; } }

/* Shield motion (kept under prefers-reduced-motion — see the reduced-motion blocks). */
.av-spark { display: none; }
/* Intro: the edge and orbit draw themselves, the glass fills in behind them. */
.av-edge { stroke-dasharray: 1; animation: av-draw 1.5s cubic-bezier(.65, 0, .35, 1) .1s backwards; }
.av-orbit { stroke-dasharray: 1; animation: av-draw 1.3s cubic-bezier(.65, 0, .35, 1) .7s backwards; }
.av-body, .av-details { animation: av-fade 1s ease-out .6s backwards; }
@keyframes av-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes av-fade { from { opacity: 0; } }
/* Ambient: comet on the orbit (SMIL), breathing core, glass glint, protection pulse. */
.av-comet { animation: av-fade .6s ease-out 1.6s backwards; }
.av-core { animation: av-breathe 6s ease-in-out infinite; }
@keyframes av-breathe { 50% { opacity: .55; } }
.av-sweep { transform: translateX(-160px); animation: av-sweep 7s ease-in-out 2s infinite; }
@keyframes av-sweep { 0% { transform: translateX(-160px); } 22%, 100% { transform: translateX(720px); } }
.av-pulse { opacity: 0; transform-origin: 300px 310px; animation: av-pulse 5s ease-out 1.8s infinite; }
.av-pulse--late { animation-delay: 2.5s; }
@keyframes av-pulse { 0% { opacity: .55; transform: scale(1); } 60%, 100% { opacity: 0; transform: scale(1.22); } }

.av-panel {
  display: flex;
  align-items: center;
  padding: 100px 64px 24px 24px;
}
.av-form-wrap { width: 100%; max-width: 440px; }
.av-kicker {
  display: block;
  color: var(--av-link);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.av-title {
  margin: 14px 0 10px;
  font: 700 clamp(32px, 3vw, 40px)/1.12 "Outfit", "Manrope", sans-serif;
  letter-spacing: -1px;
  color: var(--av-text);
}
.av-sub { margin: 0 0 26px; color: var(--av-muted); font-size: 16px; line-height: 1.5; }

.av-foot {
  grid-column: 2;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 0 64px 28px 24px;
  color: var(--av-faint);
  font-size: 14px;
}
.av-foot > * + * { margin-left: 14px; padding-left: 14px; border-left: 1px solid rgba(4, 120, 87, 0.55); }
.auth-v2 .av-foot a { color: var(--av-muted); text-decoration: none; }
.auth-v2 .av-foot a:hover { color: var(--av-link); }

/* ---------- Form controls ---------- */
.auth-v2 form { display: grid; gap: 16px; }
.auth-v2 label.field {
  display: grid;
  gap: 8px;
  color: var(--av-label);
  font-size: 13px;
  font-weight: 600;
}
.auth-v2 input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--av-field-border);
  background: var(--av-field);
  color: var(--av-text);
  font: 500 16px/1.3 "Manrope", sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-v2 input::placeholder { color: var(--av-faint); }
.auth-v2 input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: var(--av-accent);
  box-shadow: 0 0 0 4px rgba(4, 120, 87, 0.2);
}
.av-password { position: relative; display: block; }
.auth-v2 .av-password input { padding-right: 62px; }
.av-eye {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--av-label);
  cursor: pointer;
}
.av-eye:hover { background: rgba(4, 120, 87, 0.12); }
.av-eye .icon { width: 24px; height: 24px; }

.av-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.av-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--av-label);
  font-size: 16px;
  cursor: pointer;
  user-select: none;
}
.av-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.av-check-box {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1.5px solid var(--av-field-border);
  background: var(--av-field);
  transition: background 0.15s, border-color 0.15s;
}
.av-check input:checked + .av-check-box {
  border-color: var(--av-accent);
  background: var(--av-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.av-check input:focus-visible + .av-check-box { outline: 2px solid var(--av-link); outline-offset: 3px; }
.auth-v2 .av-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--av-link);
  font: 600 16px/1.3 "Manrope", sans-serif;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.auth-v2 .av-link:hover { color: #6ee7b7; }
.av-switch { margin: 22px 0 0; text-align: center; color: var(--av-label); font-size: 16px; }
.av-switch .av-link { margin-left: 6px; }

/* Buttons */
.auth-v2 .av-btn,
.auth-v2 .btn,
.auth-v2 .btn-primary,
.auth-v2 .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid var(--av-field-border);
  background: var(--av-field);
  color: var(--av-text);
  font: 700 16px/1.2 "Manrope", sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.auth-v2 .av-btn--block,
.auth-v2 .btn.full,
.auth-v2 .w-full { width: 100%; }
.auth-v2 .av-btn--lg { min-height: 54px; font-size: 15px; margin-top: 4px; }
.auth-v2 .av-btn--primary,
.auth-v2 .btn.primary,
.auth-v2 .btn-primary {
  border: 0;
  background: var(--av-accent);
  color: #fff;
  box-shadow: var(--av-glow);
}
.auth-v2 .av-btn--primary:hover,
.auth-v2 .btn.primary:hover,
.auth-v2 .btn-primary:hover { background: var(--av-accent-hover); transform: translateY(-1px); }
.auth-v2 .av-btn--outline:hover,
.auth-v2 .btn:hover,
.auth-v2 .btn-secondary:hover { border-color: var(--av-accent); transform: translateY(-1px); }
.auth-v2 .btn.link { min-height: 0; border: 0; background: none; color: var(--av-link); padding: 8px 0; box-shadow: none; }
.auth-v2 button:disabled { opacity: 0.55; cursor: progress; transform: none !important; }
.auth-v2 .icon { width: 22px; height: 22px; flex-shrink: 0; }
.auth-v2 button:focus-visible,
.auth-v2 a:focus-visible { outline: 2px solid var(--av-link); outline-offset: 3px; }

.av-stack { display: grid; gap: 12px; }
.av-widget:empty { display: none; }
.av-widget { display: flex; justify-content: center; }
.av-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 18px;
  color: var(--av-faint);
  font-size: 14px;
}
.av-divider::before,
.av-divider::after { content: ""; flex: 1; height: 1px; background: var(--av-border); }
.av-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.av-providers button {
  min-height: 50px;
  border-radius: 13px;
  border: 1px solid var(--av-field-border);
  background: var(--av-field);
  color: var(--av-text);
  font: 600 15px/1.2 "Manrope", sans-serif;
  cursor: pointer;
}
.av-providers button:hover { border-color: var(--av-accent); }

/* Consent (also used in the dialog outside .auth-v2, hence fallbacks) */
.av-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.55;
  color: var(--av-muted, var(--muted));
}
.av-consent input { margin-top: 3px; flex-shrink: 0; width: auto; accent-color: #047857; }
.av-consent a { color: var(--av-link, #34d399); text-decoration: underline; }

/* Alerts & statuses */
.av-alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 13px;
  font-size: 15px;
  line-height: 1.5;
  border: 1px solid;
}
.av-alert--error { color: #fecdd3; border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.09); }
.av-alert--success { color: #bbf7d0; border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); }
html[data-theme="light"] .av-alert--error { color: #be123c; }
html[data-theme="light"] .av-alert--success { color: #15803d; }
.av-pending {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(4, 120, 87, 0.08);
  text-align: center;
}
.av-pending strong { display: block; font-size: 16px; }
.av-pending p { margin: 8px 0 14px; color: var(--av-muted); font-size: 14px; line-height: 1.55; }
.av-pending .av-poll { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13px; }
.av-pending .av-poll::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  animation: av-blink 1.4s ease-in-out infinite;
}
.av-result { text-align: center; }
.av-result-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: rgba(4, 120, 87, 0.14);
  color: var(--av-link);
}
.av-result-icon .icon { width: 30px; height: 30px; }
.av-result h3 { margin: 0 0 8px; font: 700 22px/1.25 "Outfit", "Manrope", sans-serif; }
.av-result p { margin: 0 0 18px; color: var(--av-muted); font-size: 15px; line-height: 1.6; }
.av-result .btn + .btn { margin-top: 10px; }

.av-demo { margin-top: 20px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--av-border); }
.av-demo summary { cursor: pointer; color: var(--av-faint); font-size: 13px; }
.av-demo p { margin: 10px 0; color: var(--av-faint); font-size: 13px; }
.av-demo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-v2 .av-demo-actions .btn-secondary { min-height: 44px; font-size: 13px; }

/* Legacy classes used by other auth screens rendered inside the frame */
.auth-v2 .muted { color: var(--av-muted); }
.auth-v2 .danger { color: var(--av-danger); }
.auth-v2 .card { border: 0; background: none; padding: 0; }
.auth-v2 .spinner {
  display: block;
  width: 30px;
  height: 30px;
  margin: 20px auto;
  border-radius: 50%;
  border: 3px solid rgba(52, 211, 153, 0.2);
  border-top-color: #34d399;
  animation: av-spin 0.8s linear infinite;
}
.auth-v2 .error-card {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.09);
  color: #fecdd3;
  font-size: 14px;
  text-align: left;
}
.auth-v2 .demo-banner {
  display: block;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(4, 120, 87, 0.08);
  font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .av-panel { padding-right: 40px; }
  .av-foot { padding-right: 40px; }
}
@media (max-width: 899px) {
  .auth-v2 { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; }
  .av-brand { position: static; grid-row: 1; justify-self: center; margin-top: max(24px, var(--safe-top)); }
  .av-brand-name { font-size: 24px; }
  .av-mark { width: 32px; height: 32px; }
  .av-visual { grid-row: 2; min-height: 0; padding: 4px 16px 0; }
  .av-scene { width: min(46vw, 170px); }
  .av-panel { grid-row: 3; padding: 0 16px 8px; justify-content: center; align-items: flex-start; }
  .av-form-wrap { max-width: 480px; margin: 0 auto; }
  .av-kicker { font-size: 12px; text-align: center; }
  .av-title { margin-top: 10px; text-align: center; font-size: 30px; }
  .av-sub { text-align: center; margin-bottom: 22px; font-size: 14px; }
  .av-foot { grid-column: 1; grid-row: 4; justify-content: center; flex-wrap: wrap; gap: 8px 16px; padding: 24px 16px max(20px, var(--safe-bottom)); font-size: 12px; }
  .av-foot > * + * { margin-left: 0; padding-left: 0; border-left: 0; }
  .auth-v2 label.field,
  .av-check,
  .av-switch,
  .auth-v2 .av-link { font-size: 14px; }
  .auth-v2 input:not([type="checkbox"]):not([type="radio"]) { min-height: 52px; font-size: 16px; }
  .auth-v2 .av-btn--lg { min-height: 52px; font-size: 15px; }
}
@media (max-width: 360px) {
  .av-demo-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-v2 *:not(.av-scene, .av-scene *), .auth-v2 *::before, .auth-v2 *::after {
    animation: none !important;
    transition: none !important;
  }
}
