/* Authentication owns its responsive and theme rules. Keep unlayered while the
   application reset is unlayered, so native control resets cannot erase states. */
.auth-screen-v2 {
  --auth-bg: #06152f;
  --auth-panel: #091e3c;
  --auth-control: #102c50;
  --auth-control-active: #174664;
  --auth-text: #f4f8ff;
  --auth-muted: #afc1d9;
  --auth-line: #426586;
  --auth-accent: #29dbc9;
  --auth-accent-hover: #64eee0;
  --auth-accent-ink: #042b36;
  --auth-disabled: #25476b;
  --auth-link: #65eee0;
  --auth-error: #ffabb7;
  --auth-error-bg: #351f39;
  --auth-visual: radial-gradient(circle at 75% 20%, #0b4355, transparent 55%), linear-gradient(145deg, #071933, #09284e);
  min-height: calc(100dvh - var(--header-height));
  background: var(--auth-bg);
  color: var(--auth-text);
}
:root[data-theme='light'] .auth-screen-v2 {
  --auth-bg: #f3f9ff;
  --auth-panel: #ffffff;
  --auth-control: #edf5fc;
  --auth-control-active: #d5f5ef;
  --auth-text: #102a46;
  --auth-muted: #49647f;
  --auth-line: #809bb5;
  --auth-accent: #0b837b;
  --auth-accent-hover: #066961;
  --auth-accent-ink: #ffffff;
  --auth-disabled: #d8e7f4;
  --auth-link: #08766e;
  --auth-error: #a92342;
  --auth-error-bg: #fff0f3;
  --btc-card-positive: #16733b;
  --btc-card-negative: #b32643;
  --auth-visual: radial-gradient(circle at 75% 20%, #cbf5ec, transparent 55%), linear-gradient(145deg, #f0f7ff, #e2efff);
}
.auth-screen-v2 .auth-shell-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100dvh - var(--header-height));
}
.auth-screen-v2 .auth-visual-panel {
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 56px clamp(24px, 4vw, 64px);
  background: var(--auth-visual);
}
.auth-screen-v2 .auth-market-visual {
  width: min(610px, 100%);
  --btc-card-min-height: 400px;
  --btc-card-padding: 28px 26px 20px;
  --btc-card-border: var(--auth-line);
  --btc-card-bg: var(--auth-panel);
  --btc-card-text: var(--auth-text);
  --btc-card-muted: var(--auth-muted);
  --btc-card-shadow: 0 16px 40px #0002;
}
.auth-screen-v2 .auth-form-panel {
  display: grid;
  align-items: center;
  justify-items: center;
  min-width: 0;
  padding: 56px clamp(24px, 5vw, 80px);
  background: var(--auth-bg);
}
.auth-screen-v2 .auth-form-v2 {
  display: grid;
  align-content: start;
  gap: 24px;
  width: min(560px, 100%);
  min-width: 0;
}
.auth-screen-v2 .auth-form-v2 h1 {
  margin: 0 0 4px;
  color: var(--auth-text);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.3;
}
.auth-screen-v2 .auth-tab-track {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 56px;
  padding: 5px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background: var(--auth-control);
}
.auth-screen-v2 .auth-tab-track button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--auth-muted);
  font-size: 15px;
  line-height: 1.4;
}
.auth-screen-v2 .auth-tab-track button.active {
  border-color: var(--auth-accent);
  background: var(--auth-control-active);
  color: var(--auth-text);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--auth-accent);
}
.auth-screen-v2 .auth-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--auth-text);
  font-size: 14px;
  line-height: 1.5;
}
.auth-screen-v2 .auth-field input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-control);
  color: var(--auth-text);
  font-size: 16px;
}
.auth-screen-v2 .auth-field input::placeholder { color: var(--auth-muted); opacity: 1; }
.auth-screen-v2 .auth-password-box,
.auth-screen-v2 .auth-phone-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-control);
}
.auth-screen-v2 .auth-phone-box { grid-template-columns: 116px minmax(0, 1fr); }
.auth-screen-v2 .auth-password-box input,
.auth-screen-v2 .auth-phone-box input { height: 50px; border: 0; background: transparent; }
.auth-screen-v2 .auth-phone-box .auth-dial-code-input { border-right: 1px solid var(--auth-line); border-radius: 8px 0 0 8px; }
.auth-screen-v2 .auth-password-box > button { display: grid; place-items: center; min-width: 44px; border-radius: 8px; color: var(--auth-muted); }
.auth-screen-v2 .auth-code-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(116px, auto); gap: 12px; }
.auth-screen-v2 .auth-code-box button {
  min-height: 52px;
  padding: 8px 14px;
  border: 1px solid var(--auth-accent);
  border-radius: 8px;
  background: var(--auth-control-active);
  color: var(--auth-link);
  font-size: 14px;
}
.auth-screen-v2 .auth-invite-toggle,
.auth-screen-v2 .auth-muted-link { display: inline-flex; align-items: center; gap: 8px; justify-self: start; min-height: 44px; padding: 0; color: var(--auth-link); }
.auth-screen-v2 .auth-invite-toggle svg.open { transform: rotate(180deg); }
.auth-screen-v2 .auth-agree-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 22px;
  cursor: pointer;
}
.auth-screen-v2 .auth-agree-row input {
  appearance: auto;
  align-self: start;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--auth-accent);
  cursor: pointer;
}
.auth-screen-v2 .auth-agree-row a,
.auth-screen-v2 .auth-switch-text a {
  color: var(--auth-link);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.auth-screen-v2 .auth-submit-v2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid var(--auth-accent);
  border-radius: 10px;
  background: var(--auth-accent);
  color: var(--auth-accent-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}
.auth-screen-v2 .auth-submit-v2:disabled,
.auth-screen-v2 .auth-code-box button:disabled {
  border-color: var(--auth-line);
  background: var(--auth-disabled);
  color: var(--auth-muted);
  cursor: not-allowed;
}
.auth-screen-v2 .auth-switch-text { margin: 0; color: var(--auth-muted); font-size: 14px; line-height: 1.6; }
.auth-screen-v2 .auth-inline-message {
  padding: 12px 14px;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: var(--auth-error-bg);
  color: var(--auth-error);
  font-size: 14px;
  line-height: 1.5;
}
.auth-screen-v2 .auth-inline-message.success,
.auth-screen-v2 .auth-inline-message.info { background: var(--auth-control-active); color: var(--auth-link); }
.auth-screen-v2 .auth-inline-message :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-inline-start: 12px;
  padding: 0 8px;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.auth-screen-v2 .auth-mobile-head,
.auth-screen-v2 .auth-mobile-subtitle { display: none; }
.auth-screen-v2 button,
.auth-screen-v2 a { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.auth-screen-v2 :is(button, a, input):focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 3px; }
@media (hover: hover) {
  .auth-screen-v2 .auth-submit-v2:not(:disabled):hover { background: var(--auth-accent-hover); border-color: var(--auth-accent-hover); box-shadow: 0 4px 18px color-mix(in srgb, var(--auth-accent) 24%, transparent); }
  .auth-screen-v2 .auth-tab-track button:not(.active):hover,
  .auth-screen-v2 .auth-password-box > button:hover { background: var(--auth-control-active); color: var(--auth-text); }
  .auth-screen-v2 .auth-code-box button:not(:disabled):hover { background: var(--auth-accent); color: var(--auth-accent-ink); }
  .auth-screen-v2 a:hover { color: var(--auth-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
}
.auth-screen-v2 .auth-submit-v2:not(:disabled):active { background: var(--auth-accent-hover); box-shadow: inset 0 2px 4px #0002; }
@media (max-width: 960px) {
  .auth-screen-v2 { min-height: 100dvh; }
  .auth-screen-v2 .auth-shell-v2 { grid-template-columns: 1fr; min-height: auto; }
  .auth-screen-v2 .auth-visual-panel { display: none; }
  .auth-screen-v2 .auth-mobile-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(72px, auto);
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: max(8px, env(safe-area-inset-top)) 16px 8px;
    border-bottom: 1px solid var(--auth-line);
    background: var(--auth-bg);
  }
  .auth-screen-v2 .auth-mobile-head > button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; color: var(--auth-text); }
  .auth-screen-v2 .auth-mobile-brand { justify-self: center; width: 140px; max-width: 100%; }
  .auth-screen-v2 .auth-mobile-switch { display: flex; align-items: center; justify-content: flex-end; min-height: 44px; color: var(--auth-link); font-size: 14px; }
  .auth-screen-v2 .auth-form-panel { padding: 32px 20px max(40px, env(safe-area-inset-bottom)); }
  .auth-screen-v2 .auth-form-v2 { gap: 22px; }
  .auth-screen-v2 .auth-form-v2 h1 { font-size: 30px; }
  .auth-screen-v2 .auth-mobile-subtitle { display: block; margin: -12px 0 0; color: var(--auth-muted); line-height: 1.6; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-screen-v2 button, .auth-screen-v2 a { transition: none; }
}
.auth-form-v2 .auth-sub-account-note { color: var(--text-muted); font-size: 13px; line-height: 1.65; margin: 0 0 18px; }
.auth-screen-v2 .auth-tab-track.has-sub-account { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auth-screen-v2 .auth-tab-track.has-sub-account button { min-width: 0; padding-inline: 6px; }
