[data-theme="light"] {
  --bg-page:        #f4f3ef;
  --bg-surface:     #ffffff;
  --bg-sidebar:     #1e1e1e;
  --bg-input:       #f9f8f6;
  --bg-hover:       #f0efe9;
  --text-primary:   #1a1a1a;
  --text-secondary: #5a5a5a;
  --text-muted:     #9a9a9a;
  --text-sidebar:   #d4d4d0;
  --text-sidebar-muted: #707070;
  --border:         #e2e1db;
  --border-input:   #d8d7d1;
  --accent:         #c17d3a;
  --accent-hover:   #a86b2e;
  --accent-text:    #ffffff;
  --error-bg:       #fdecea;
  --error-text:     #c0392b;
  --success-bg:     #e8f5e9;
  --success-text:   #2e7d32;
  --shadow-md:      0 4px 24px rgba(0,0,0,0.10);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

[data-theme="dark"] {
  --bg-page:        #131313;
  --bg-surface:     #1e1e1e;
  --bg-sidebar:     #111111;
  --bg-input:       #252525;
  --bg-hover:       #2a2a2a;
  --text-primary:   #e8e8e4;
  --text-secondary: #a0a09c;
  --text-muted:     #606060;
  --text-sidebar:   #b0b0ac;
  --text-sidebar-muted: #505050;
  --border:         #2e2e2e;
  --border-input:   #383838;
  --accent:         #e8934a;
  --accent-hover:   #d4813a;
  --accent-text:    #111111;
  --error-bg:       #3d1b1b;
  --error-text:     #f08080;
  --success-bg:     #1a2e1a;
  --success-text:   #70c070;
  --shadow-md:      0 4px 24px rgba(0,0,0,0.4);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

[data-theme="forest"] {
  --bg-page:        #0f1a12;
  --bg-surface:     #162019;
  --bg-sidebar:     #0c1510;
  --bg-input:       #1c2a1f;
  --bg-hover:       #1e2e22;
  --text-primary:   #d4e8d0;
  --text-secondary: #7a9e7e;
  --text-muted:     #405545;
  --text-sidebar:   #8ab88e;
  --text-sidebar-muted: #3a5040;
  --border:         #1e3020;
  --border-input:   #253528;
  --accent:         #6bc87a;
  --accent-hover:   #59b368;
  --accent-text:    #0a1a0c;
  --error-bg:       #3a1212;
  --error-text:     #f08080;
  --success-bg:     #1a3020;
  --success-text:   #80d080;
  --shadow-md:      0 4px 24px rgba(0,0,0,0.4);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

[data-theme="sand"] {
  --bg-page:        #f5efe4;
  --bg-surface:     #fdf8f1;
  --bg-sidebar:     #2c2318;
  --bg-input:       #f8f2e8;
  --bg-hover:       #ede6d8;
  --text-primary:   #2c2010;
  --text-secondary: #7a6848;
  --text-muted:     #b0987a;
  --text-sidebar:   #c8b898;
  --text-sidebar-muted: #60503a;
  --border:         #dfd4c0;
  --border-input:   #d4c8b0;
  --accent:         #b85c2a;
  --accent-hover:   #9e4e22;
  --accent-text:    #fff8f0;
  --error-bg:       #fde8e0;
  --error-text:     #b03020;
  --success-bg:     #e8f0d8;
  --success-text:   #406020;
  --shadow-md:      0 4px 24px rgba(80,50,20,0.12);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

[data-theme="slate"] {
  --bg-page:        #eceff4;
  --bg-surface:     #ffffff;
  --bg-sidebar:     #2e3a50;
  --bg-input:       #f0f3f8;
  --bg-hover:       #e4e8f0;
  --text-primary:   #1e2a3a;
  --text-secondary: #5a6a80;
  --text-muted:     #90a0b0;
  --text-sidebar:   #b0c0d0;
  --text-sidebar-muted: #607080;
  --border:         #d8dde8;
  --border-input:   #cdd4e0;
  --accent:         #4050c8;
  --accent-hover:   #3040b0;
  --accent-text:    #ffffff;
  --error-bg:       #fde8e8;
  --error-text:     #a02020;
  --success-bg:     #e8f4ea;
  --success-text:   #286830;
  --shadow-md:      0 4px 24px rgba(30,50,80,0.12);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

[data-theme="rose"] {
  --bg-page:        #f9f0f2;
  --bg-surface:     #fff8f9;
  --bg-sidebar:     #3a1e28;
  --bg-input:       #f8f0f2;
  --bg-hover:       #f0e4e8;
  --text-primary:   #2a1018;
  --text-secondary: #805060;
  --text-muted:     #c090a0;
  --text-sidebar:   #c8a0b0;
  --text-sidebar-muted: #705060;
  --border:         #e8d4da;
  --border-input:   #dfc8d0;
  --accent:         #c0405a;
  --accent-hover:   #a83450;
  --accent-text:    #fff0f2;
  --error-bg:       #fde8e8;
  --error-text:     #b02030;
  --success-bg:     #e4eee8;
  --success-text:   #306830;
  --shadow-md:      0 4px 24px rgba(80,20,40,0.12);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
}

/* --- RESET --- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input  { font-family: 'DM Sans', sans-serif; font-size: 0.9rem; }
h1, h2, h3 { font-family: 'Syne', sans-serif; font-weight: 600; line-height: 1.3; }

.hidden { display: none !important; }

/* --- THEME PICKER --- */

.theme-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.theme-picker { width: 100%; max-width: 740px; }

.theme-picker-header { text-align: center; margin-bottom: 28px; }
.theme-picker-header h2 { font-size: 1.8rem; margin-bottom: 6px; }
.theme-picker-header p  { color: var(--text-secondary); font-size: 0.9rem; }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.theme-card {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer;
}

.theme-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.theme-preview {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 72px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.theme-preview-light  { background: #f4f3ef; }
.theme-preview-dark   { background: #131313; }
.theme-preview-forest { background: #0f1a12; }
.theme-preview-sand   { background: #f5efe4; }
.theme-preview-slate  { background: #eceff4; }
.theme-preview-rose   { background: #f9f0f2; }

.theme-preview-light  .tp-sidebar { background: #1e1e1e; }
.theme-preview-dark   .tp-sidebar { background: #111; }
.theme-preview-forest .tp-sidebar { background: #0c1510; }
.theme-preview-sand   .tp-sidebar { background: #2c2318; }
.theme-preview-slate  .tp-sidebar { background: #2e3a50; }
.theme-preview-rose   .tp-sidebar { background: #3a1e28; }

.theme-preview-light  .tp-bar { background: #fff; border-bottom: 1px solid #e2e1db; }
.theme-preview-dark   .tp-bar { background: #1e1e1e; border-bottom: 1px solid #2e2e2e; }
.theme-preview-forest .tp-bar { background: #162019; border-bottom: 1px solid #1e3020; }
.theme-preview-sand   .tp-bar { background: #fdf8f1; border-bottom: 1px solid #dfd4c0; }
.theme-preview-slate  .tp-bar { background: #fff; border-bottom: 1px solid #d8dde8; }
.theme-preview-rose   .tp-bar { background: #fff8f9; border-bottom: 1px solid #e8d4da; }

.theme-preview-light  .tp-card { background: #fff; border: 1px solid #e2e1db; }
.theme-preview-dark   .tp-card { background: #1e1e1e; border: 1px solid #2e2e2e; }
.theme-preview-forest .tp-card { background: #162019; border: 1px solid #1e3020; }
.theme-preview-sand   .tp-card { background: #fdf8f1; border: 1px solid #dfd4c0; }
.theme-preview-slate  .tp-card { background: #fff; border: 1px solid #d8dde8; }
.theme-preview-rose   .tp-card { background: #fff8f9; border: 1px solid #e8d4da; }

.tp-sidebar { width: 28%; flex-shrink: 0; }
.tp-main    { flex: 1; display: flex; flex-direction: column; }
.tp-bar     { height: 16px; }
.tp-cards   { flex: 1; display: flex; gap: 3px; padding: 4px; }
.tp-card    { flex: 1; border-radius: 3px; }

.theme-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.theme-card small { color: var(--text-secondary); font-size: 0.75rem; display: block; }

.theme-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.theme-dot-light  { background: #c17d3a; }
.theme-dot-dark   { background: #e8934a; }
.theme-dot-forest { background: #6bc87a; }
.theme-dot-sand   { background: #b85c2a; }
.theme-dot-slate  { background: #4050c8; }
.theme-dot-rose   { background: #c0405a; }

/* --- AUTH SHELL --- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-left {
  background: var(--bg-sidebar);
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-sidebar);
}

.auth-tagline { padding-bottom: 40px; }
.auth-tagline h1 {
  font-size: 2.6rem;
  color: var(--text-sidebar);
  line-height: 1.2;
  margin-bottom: 14px;
}
.auth-tagline p {
  color: var(--text-sidebar-muted);
  font-size: 0.95rem;
  max-width: 300px;
  line-height: 1.7;
}

.auth-left-footer {
  font-size: 0.75rem;
  color: var(--text-sidebar-muted);
}

/* --- AUTH RIGHT PANEL --- */

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--bg-page);
}

.auth-screen {
  display: none;
  width: 100%;
  max-width: 400px;
  animation: fadeUp 0.2s ease;
}

.auth-screen.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-head { margin-bottom: 24px; }
.screen-head h2 { font-size: 1.5rem; margin-bottom: 4px; }
.screen-head p  { color: var(--text-secondary); font-size: 0.9rem; }

/* --- GOOGLE BUTTON --- */

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.google-btn:hover { background: var(--bg-hover); border-color: var(--border); }

/* --- DIVIDER --- */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- FORM ELEMENTS --- */

.form-group { margin-bottom: 14px; }

.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text-muted); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; width: 100%; }

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.15s;
}

.toggle-pw:hover { color: var(--text-secondary); }

/* --- PASSWORD STRENGTH --- */

.pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  height: 3px;
}

.pw-strength-bar {
  flex: 1;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.2s;
}

.pw-strength-bar.weak   { background: #e74c3c; }
.pw-strength-bar.fair   { background: #e67e22; }
.pw-strength-bar.good   { background: #f1c40f; }
.pw-strength-bar.strong { background: #27ae60; }

/* --- BUTTONS --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn:active    { transform: scale(0.98); }
.btn:disabled  { opacity: 0.6; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-full      { width: 100%; margin-top: 4px; }

.inline-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
  font-weight: 500;
  padding: 0;
  transition: opacity 0.15s;
}

.inline-link:hover { opacity: 0.75; }

/* --- ALERTS --- */

.form-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.82rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.form-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.82rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* --- OTP INPUTS --- */

.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0 16px;
}

.otp-box {
  width: 48px;
  height: 56px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 1.4rem;
  font-weight: 500;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

.otp-box:focus { border-color: var(--accent); }
.otp-box.filled { border-color: var(--accent); background: var(--bg-surface); }

/* --- RESEND ROW --- */

.resend-row {
  text-align: center;
  margin-top: 16px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* --- SCREEN FOOTER --- */

.screen-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- LOADING SPINNER ON BUTTON --- */

.btn.loading {
  pointer-events: none;
  opacity: 0.75;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- RESPONSIVE --- */

@media (max-width: 800px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-left  { display: none; }
  .auth-right { padding: 32px 24px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .theme-grid { grid-template-columns: 1fr; }
  .otp-box    { width: 40px; height: 50px; font-size: 1.2rem; }
  .otp-inputs { gap: 6px; }
}
