:root {
  --bg-base: #060608;
  --bg-panel: #0d0d10;
  --bg-soft: #17171b;
  --text-main: #ffffff;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.45);
  --accent: #3b82f6;
  --brand-gradient: linear-gradient(135deg, #ffffff 20%, #a1a1aa 100%);
  --glass: rgba(24, 24, 28, 0.68);
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-brand: "Outfit", "Inter", sans-serif;
}

body.theme-light {
  --bg-base: #f8fafc;
  --bg-panel: #ffffff;
  --bg-soft: #eef2f7;
  --text-main: #020617;
  --text-secondary: #1e293b;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: rgba(15, 23, 42, 0.12);
  --accent: #2563eb;
  --brand-gradient: linear-gradient(135deg, #000000 20%, #64748b 100%);
  --glass: rgba(255, 255, 255, 0.78);
}

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

body {
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-frame {
  width: min(100%, 1040px);
  min-height: 640px;
  display: grid;
  grid-template-columns: 1fr 440px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 28px 80px var(--shadow);
}

.brand-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 36px;
  background: var(--bg-base);
  border-right: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row h1 {
  font-family: var(--font-brand);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 4px;
}

.theme-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-muted);
}

.theme-btn.active {
  background: var(--text-main);
  color: var(--bg-base);
}

.theme-btn svg,
.support-note svg,
.input-shell svg,
.primary-btn svg,
.preview-composer svg {
  width: 16px;
  height: 16px;
}

.session-preview {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.preview-line {
  height: 56px;
  border-radius: 16px;
}

.preview-line.user {
  width: 62%;
  margin-left: auto;
  background: var(--bg-soft);
}

.preview-line.ai {
  width: 82%;
  background: color-mix(in srgb, var(--bg-soft) 78%, var(--accent));
}

.preview-composer {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.preview-composer button {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text-main);
  color: var(--bg-base);
}

.support-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.form-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  background: var(--bg-soft);
  border-radius: 13px;
  margin-bottom: 28px;
}

.auth-tab {
  height: 40px;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
  font-weight: 700;
}

.auth-tab.active {
  color: var(--bg-base);
  background: var(--text-main);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

.form-heading {
  margin-bottom: 4px;
}

.form-heading h2 {
  font-family: var(--font-brand);
  font-size: 28px;
  letter-spacing: 0;
}

.form-heading p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.input-shell {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 0 12px;
}

.input-shell:focus-within {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 48%, transparent);
}

.input-shell input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  min-width: 0;
}

.input-shell input::placeholder {
  color: var(--text-muted);
}

.password-toggle {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-muted);
  flex-shrink: 0;
}

.password-toggle:hover {
  color: var(--text-main);
  background: color-mix(in srgb, var(--text-main) 8%, transparent);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  accent-color: var(--text-main);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
}

.primary-btn {
  height: 48px;
  border: none;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--bg-base);
  background: var(--text-main);
  font-weight: 800;
  margin-top: 4px;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px var(--shadow);
}

.form-feedback {
  min-height: 20px;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.form-feedback:not(:empty) {
  color: #ef4444;
}

@media (max-width: 820px) {
  .auth-page {
    padding: 0;
    place-items: stretch;
  }

  .auth-frame {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: none;
    border-radius: 0;
  }

  .brand-pane {
    min-height: 260px;
    padding: 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .session-preview {
    padding: 18px;
    gap: 14px;
  }

  .preview-line {
    height: 36px;
  }

  .support-note {
    display: none;
  }

  .form-pane {
    padding: 24px;
    justify-content: flex-start;
  }
}
