*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0C0E14;
  --surface:    #13161f;
  --surface-2:  #1a1e2e;
  --border:     #1e2535;
  --accent:     #0891B2;
  --accent-dim: rgba(8,145,178,0.12);
  --accent-hover: #06b6d4;
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --radius:     12px;
  --radius-sm:  8px;
}

html[data-theme="light"] {
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --surface-2:  #f1f5f9;
  --border:     #e2e8f0;
  --accent:     #0891B2;
  --accent-dim: rgba(8,145,178,0.08);
  --accent-hover: #0e7490;
  --text:       #0f172a;
  --text-muted: #64748b;
  --text-dim:   #475569;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Background canvas (same as main app) ── */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(12,14,20,0.55);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  pointer-events: none;
}

/* ── Layout ── */
.auth-wrap {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ── Card ── */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(19,22,31,0.78);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px 32px;
  box-shadow: 0 0 0 1px rgba(8,145,178,0.06),
              0 24px 64px rgba(0,0,0,0.5),
              0 0 40px rgba(8,145,178,0.06);
  animation: cardIn 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Logo ── */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}
.auth-logo-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(8,145,178,0.5));
}
.auth-logo-text {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* ── Alert ── */
.auth-alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
  border: 1px solid transparent;
  animation: alert-in 0.3s ease;
}
@keyframes alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-alert.success {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.35);
  color: #6ee7b7;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius);
}
.auth-alert.success::before {
  content: '';
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(16,185,129,0.2);
  border: 1.5px solid #10b981;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 13px;
  background-repeat: no-repeat;
  background-position: center;
  animation: check-pop 0.4s 0.1s both cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes check-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.auth-alert.error {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.25);
  color: #fca5a5;
}
.auth-alert.info {
  background: var(--accent-dim);
  border-color: rgba(8,145,178,0.25);
  color: #7dd3fc;
}
.hidden { display: none !important; }

/* ── Tabs ── */
.auth-tabs {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 2px;
}
.auth-tab {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 8px 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s;
}
.auth-tab.active { color: var(--text); }
.auth-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--surface);
  border-radius: 7px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
.auth-tab-indicator.right { transform: translateX(calc(100% + 2px)); }

/* ── Forms ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
.auth-field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}
.auth-field input::placeholder { color: var(--text-muted); }

/* Password with eye toggle */
.pw-wrap {
  position: relative;
}
.pw-wrap input { padding-right: 42px; }
.pw-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pw-eye:hover { color: var(--text-dim); }

/* ── Submit button ── */
.auth-submit {
  margin-top: 6px;
  width: 100%;
  padding: 11px 0;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 0 14px rgba(8,145,178,0.35), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(8,145,178,0.6), 0 4px 14px rgba(0,0,0,0.35);
}
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Spinner inside button */
.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer links ── */
.auth-footer-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding-top: 4px;
}
.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:hover { color: var(--accent-hover); }

/* ── Light theme overrides ── */
html[data-theme="light"] #overlay {
  background: rgba(248, 250, 252, 0.72);
}
html[data-theme="light"] .auth-card {
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 1px rgba(8,145,178,0.06),
              0 24px 64px rgba(0,0,0,0.08),
              0 0 40px rgba(8,145,178,0.04);
}
html[data-theme="light"] .auth-tab-indicator {
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
html[data-theme="light"] .auth-alert.success {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.3);
  color: #047857;
}
html[data-theme="light"] .auth-alert.success::before {
  border-color: #10b981;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23047857' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
html[data-theme="light"] .auth-alert.error {
  background: rgba(239,68,68,0.08);
  color: #dc2626;
}
html[data-theme="light"] .auth-alert.info {
  color: #0e7490;
}
html[data-theme="light"] .auth-submit {
  box-shadow: 0 0 14px rgba(8,145,178,0.15), 0 2px 8px rgba(0,0,0,0.08);
}
html[data-theme="light"] .auth-submit:hover {
  box-shadow: 0 0 22px rgba(8,145,178,0.3), 0 4px 14px rgba(0,0,0,0.1);
}

/* ── 备案号 ── */
.auth-beian {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  z-index: 10;
}
.auth-beian a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.auth-beian a:hover { color: var(--accent); }
