/* Public authentication: adoption of shared tokens, scoped away from app pages.
   Loaded after the legacy login and shared dark styles; auth.js owns all modes. */
html body.auth-page {
  --auth-accent: var(--sia-sidebar-accent);
  --auth-border: color-mix(in srgb, var(--sia-sidebar-active-line) 35%, var(--sia-line));
  --auth-action: color-mix(in srgb, var(--sia-teal-dark) 90%, var(--sia-heading));
  --auth-action-ink: #fff;
  --auth-danger-ink: color-mix(in srgb, var(--sia-danger) 75%, var(--sia-heading));
  min-height: 100vh;
  min-height: 100svh;
  padding: 32px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--sia-bg) !important;
  color: var(--sia-text) !important;
}
html[data-theme="dark"] .auth-page {
  --auth-action: var(--sia-teal);
  --auth-action-ink: var(--sia-bg);
  --auth-danger-ink: var(--sia-danger);
}
html[data-theme] .auth-page .auth-shell {
  width: min(1160px, 100%);
  min-height: 736px;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  border: 1px solid var(--auth-border) !important;
  border-radius: var(--sia-radius-shell);
  background: var(--sia-surface) !important;
  box-shadow: var(--sia-shadow) !important;
}
html[data-theme] .auth-page .auth-visual {
  min-width: 0;
  padding: 48px;
  isolation: isolate;
  border-right: 1px solid var(--auth-border);
  background: var(--sia-sidebar-bg) !important;
}
.auth-page .auth-visual::before,
.auth-page .auth-visual::after { display: none; }
.auth-page .auth-ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  color: var(--auth-accent);
  opacity: .5;
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent), linear-gradient(transparent, #000 20%, #000 80%, transparent);
  mask-composite: intersect;
}
.auth-page .auth-ambient svg { width: 100%; height: 100%; }
.auth-page .auth-ambient path { fill: none; stroke: url(#authWave); stroke-width: 1; }
.auth-page .auth-ambient circle { fill: currentColor; opacity: .4; }
.auth-page .logo-orb {
  width: 112px;
  height: 112px;
  border: 1px solid var(--auth-border);
  border-radius: 28px;
  background: var(--sia-surface);
  box-shadow: var(--sia-sidebar-glow);
}
.auth-page .logo-orb img { width: 88px; height: 88px; filter: none; }
.auth-page .brand-title {
  margin-top: 24px;
  color: var(--sia-heading);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}
.auth-page .brand-title span { color: var(--auth-accent); }
html[data-theme] .auth-page .auth-visual .brand-subtitle {
  max-width: 370px;
  margin-top: 16px;
  color: var(--sia-muted) !important;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}
.auth-page .benefits { max-width: 370px; margin-top: 48px; gap: 20px; }
html[data-theme] .auth-page .auth-visual .benefit {
  gap: 16px;
  color: var(--sia-text) !important;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}
html[data-theme] .auth-page .auth-visual .benefit-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--sia-teal-soft) 45%, var(--sia-surface)) !important;
  color: var(--auth-accent) !important;
  box-shadow: none !important;
}
html[data-theme] .auth-page .auth-panel {
  min-width: 0;
  padding: 112px 48px 40px;
  background: var(--sia-surface) !important;
  box-shadow: none !important;
}
.auth-page .auth-card { width: min(440px, 100%); }
.auth-page .auth-locale-switch {
  top: 24px;
  left: 32px;
  padding: 3px;
  gap: 2px;
  background: var(--sia-surface-soft);
  border-color: var(--auth-border);
  border-radius: 16px;
}
.auth-page .auth-locale-switch button { min-width: 44px; min-height: 44px; color: var(--sia-muted); font-size: 13px; }
.auth-page .auth-locale-switch button[aria-pressed="true"] { background: var(--sia-teal-soft); color: var(--auth-accent); }
.auth-page .auth-panel .auth-theme-toggle {
  top: 24px;
  right: 32px;
  min-height: 52px;
  border-radius: 16px;
  border-color: var(--auth-border);
  background: var(--sia-surface-soft);
  color: var(--sia-text);
  font-size: 13px;
}
.auth-page .tabs {
  padding: 4px;
  gap: 4px;
  margin-bottom: 32px;
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  background: var(--sia-surface-soft);
}
html[data-theme] .auth-page .auth-card .tab {
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--sia-muted) !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
html[data-theme] .auth-page .auth-card .tab.active {
  background: var(--sia-teal-soft);
  color: var(--auth-accent) !important;
  border-color: var(--auth-border) !important;
}
.auth-page.auth-recovery-mode .tabs { display: none; }
.auth-page .auth-card h1 { margin-bottom: 12px; font-size: 32px; font-weight: 800; line-height: 1.2; letter-spacing: 0; }
.auth-page .auth-card .sub { margin-bottom: 32px; color: var(--sia-muted); font-size: 16px; line-height: 1.5; font-weight: 400; }
.auth-page .field { margin-bottom: 20px; }
html[data-theme] .auth-page .auth-card .field label { margin-bottom: 8px; font-size: 14px; color: var(--sia-text) !important; font-weight: 600; }
html[data-theme] .auth-page .auth-card .input-wrap {
  min-height: 52px;
  padding: 0 12px;
  gap: 12px;
  border: 1px solid var(--sia-line-strong) !important;
  background: var(--sia-bg) !important;
  border-radius: 16px;
  box-shadow: none !important;
}
html[data-theme] .auth-page .auth-card .input-wrap:focus-within {
  border-color: var(--sia-teal) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sia-teal) 20%, transparent) !important;
}
html[data-theme] .auth-page .auth-card .input-wrap svg { width: 20px; height: 20px; color: var(--sia-muted) !important; }
html[data-theme] .auth-page .auth-card .input-wrap input {
  min-width: 0;
  min-height: 50px;
  background: transparent !important;
  color: var(--sia-heading) !important;
  font-size: 16px;
  font-weight: 400;
  border-radius: 8px;
}
html[data-theme] .auth-page .auth-card .input-wrap input::placeholder { color: var(--sia-muted) !important; opacity: 1; }
html[data-theme] .auth-page .auth-card .toggle-pass {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 4px;
  border-radius: 10px;
  color: var(--auth-accent) !important;
  font-size: 13px;
  font-weight: 700;
}
.auth-page .row-meta { margin: -8px 0 16px; }
html[data-theme] .auth-page .auth-card .link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border-radius: 8px;
  color: var(--auth-accent) !important;
  font-size: 14px;
  font-weight: 600;
}
.auth-page .auth-card .btn { min-height: 52px; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.5; font-weight: 750; box-shadow: none; }
html[data-theme] .auth-page .auth-card .btn-primary {
  background: var(--auth-action) !important;
  border-color: var(--auth-action) !important;
  color: var(--auth-action-ink) !important;
}
html[data-theme] .auth-page .auth-card .btn-secondary {
  margin-top: 16px;
  background: var(--sia-surface-soft) !important;
  border-color: var(--sia-line-strong) !important;
  color: var(--sia-heading) !important;
}
.auth-page .auth-card .btn:hover { transform: none; }
html[data-theme] .auth-page .auth-card .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--auth-action) 88%, var(--sia-heading)) !important; }
.auth-page :is(.btn-secondary, .toggle-pass, .auth-theme-toggle, [data-locale], .tab):hover:not(:disabled) { background: var(--sia-teal-soft) !important; }
.auth-page .auth-card .link:hover { text-decoration: underline; text-underline-offset: 4px; }
.auth-page :is(button, a):focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 3px; }
.auth-page .auth-card .btn:disabled,
.auth-page .auth-card .tab:disabled { opacity: .65; cursor: wait; }
.auth-page .auth-card .signup-row { margin-top: 20px; color: var(--sia-muted); font-size: 14px; line-height: 1.5; font-weight: 400; }
html[data-theme] .auth-page .auth-card .msg:not(:empty) {
  margin-top: 16px;
  padding: 14px;
  border-color: var(--auth-border);
  background: var(--sia-surface-soft);
  color: var(--sia-text) !important;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
  overflow-wrap: anywhere;
}
html[data-theme] .auth-page .auth-card .msg.error { background: var(--sia-danger-soft) !important; border-color: color-mix(in srgb, var(--sia-danger) 45%, var(--sia-line)) !important; color: var(--auth-danger-ink) !important; }
html[data-theme] .auth-page .auth-card .msg.error::before { background: color-mix(in srgb, var(--sia-danger) 15%, var(--sia-surface)) !important; color: var(--auth-danger-ink) !important; }
html[data-theme] .auth-page .auth-card .msg.ok { background: var(--sia-teal-soft) !important; border-color: var(--auth-border) !important; color: var(--auth-accent) !important; }
html[data-theme] .auth-page .auth-card .msg.ok::before { background: var(--sia-surface) !important; color: var(--auth-accent) !important; }
.auth-page .auth-card .loading { color: var(--sia-muted); font-size: 14px; font-weight: 500; }
@media (max-width: 1100px) and (min-width: 761px) {
  html body.auth-page { padding: 24px; }
  html[data-theme] .auth-page .auth-visual { padding: 32px; }
  html[data-theme] .auth-page .auth-panel { padding-inline: 32px; }
  .auth-page .brand-title { font-size: 36px; }
}
@media (max-width: 760px) {
  html body.auth-page { padding: 20px; place-items: start center; }
  html[data-theme] .auth-page .auth-shell { display: block; min-height: 0; max-width: 540px; border-radius: 24px; }
  html[data-theme] .auth-page .auth-visual { display: flex; flex-direction: row; justify-content: flex-start; gap: 16px; padding: 24px; min-height: 0; border-right: 0; border-bottom: 1px solid var(--auth-border); }
  .auth-page .logo-orb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 16px; }
  .auth-page .logo-orb img { width: 44px; height: 44px; }
  .auth-page .brand-title { margin: 0; text-align: left; font-size: 26px; line-height: 1.2; }
  .auth-page .brand-title span { display: block; }
  .auth-page .brand-subtitle, .auth-page .benefits { display: none; }
  html[data-theme] .auth-page .auth-panel { padding: 96px 24px 24px; }
  .auth-page .auth-panel .auth-theme-toggle { top: 20px; right: 24px; width: 52px; padding: 0; }
  .auth-page .auth-panel .auth-theme-toggle span { display: none; }
  .auth-page .auth-locale-switch { top: 20px; left: 24px; }
  .auth-page .tabs { margin-bottom: 24px; }
  .auth-page .auth-card h1 { font-size: 28px; }
  .auth-page .auth-card .sub { margin-bottom: 24px; }
}
@media (max-width: 380px) {
  html body.auth-page { padding: 12px; }
  html[data-theme] .auth-page .auth-visual { padding: 20px; }
  html[data-theme] .auth-page .auth-panel { padding-inline: 16px; }
  .auth-page .auth-locale-switch { left: 16px; }
  .auth-page .auth-panel .auth-theme-toggle { right: 16px; }
  .auth-page .auth-card h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-page *, .auth-page *::before, .auth-page *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
