/* ===== CSS Reset (lightweight) ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body,
h1,
h2,
h3,
p,
figure {
  margin: 0;
}
img,
svg {
  display: block;
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
}

body {
  position: relative;
  background: var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
      1200px 800px at 15% 10%,
      rgba(59, 130, 246, 0.18),
      transparent 60%
    ),
    radial-gradient(
      1000px 700px at 85% 90%,
      rgba(99, 102, 241, 0.18),
      transparent 60%
    ),
    var(--bg);
  pointer-events: none;
}

/* ===== Theme Tokens ===== */
:root {
  --bg: #0b0e13;
  --bg-soft: #11161d;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #e9eef5;
  --muted: #b6c1ce;
  --brand: #6aa9ff;
  --brand-strong: #3b82f6;
  --success: #22c55e;
  --danger: #ef4444;
  --focus: 0 0 0 3px rgba(59, 130, 246, 0.45);
  --radius-lg: 20px;
  --radius-sm: 10px;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.25);
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --max-w: 420px;
  color-scheme: dark light;
}

:root[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-soft: #eef3fb;
  --panel: rgba(0, 0, 0, 0.04);
  --panel-border: rgba(0, 0, 0, 0.08);
  --text: #0d1117;
  --muted: #4b5563;
  --brand: #2f6df6;
  --brand-strong: #1f57e7;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* ===== Layout ===== */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(
      1200px 800px at 15% 10%,
      rgba(59, 130, 246, 0.18),
      transparent 60%
    ),
    radial-gradient(
      1000px 700px at 85% 90%,
      rgba(99, 102, 241, 0.18),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  padding: var(--space-6) var(--space-3);
}

/* ===== Brand area ===== */
.brand {
  text-align: center;
  margin-bottom: var(--space-6);
}
.logo-img {
  width: 62px;
  height: 70px;
  margin-inline: auto;
  margin-bottom: var(--space-2);
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}
.brand-title {
  font-size: clamp(1.25rem, 1.1rem + 1vw, 1.75rem);
  letter-spacing: 0.2px;
}
.brand-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

/* ===== Panel ===== */
.panel {
  width: min(100%, var(--max-w));
  background: linear-gradient(180deg, var(--panel), transparent 140%);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
}
.panel-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-4);
}

/* ===== Form ===== */
.auth-form {
  display: grid;
  gap: var(--space-4);
}

.field {
  display: grid;
  gap: 0.5rem;
}
label {
  font-size: 0.95rem;
  color: var(--muted);
}
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: color-mix(in oklab, var(--bg-soft) 85%, transparent);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.02s ease;
}
input::placeholder {
  color: color-mix(in oklab, var(--muted) 70%, transparent);
}
input:focus {
  border-color: color-mix(in oklab, var(--brand) 70%, white 30%);
  box-shadow: var(--focus);
}

input:active {
  transform: translateY(1px);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  user-select: none;
  cursor: pointer;
  color: var(--muted);
}
.checkbox input {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: color-mix(in oklab, var(--bg-soft) 85%, transparent);
  display: grid;
  place-items: center;
}
.checkbox input:checked {
  border-color: var(--brand);
  background: var(--brand);
}
.checkbox input:checked::after {
  content: "✓";
  font-size: 0.8rem;
  color: white;
  line-height: 1;
}

/* ===== Buttons & Links ===== */
.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.02s ease, box-shadow 0.2s ease, opacity 0.2s ease,
    background 0.2s ease, border-color 0.2s ease;
}
.btn:active {
  transform: translateY(1px);
}

.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.primary:hover {
  filter: brightness(1.03);
}

.ghost {
  background: transparent;
  border-color: var(--panel-border);
  color: var(--text);
}
.ghost:hover {
  background: color-mix(in oklab, var(--panel) 70%, transparent);
}

.link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.link:hover {
  text-decoration: underline;
}

.meta {
  margin-top: var(--space-3);
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ===== Divider ===== */
.divider {
  width: 100%;
  height: 1px;
  margin: var(--space-6) 0 var(--space-4);
  background: linear-gradient(
    90deg,
    transparent,
    var(--panel-border),
    transparent
  );
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  border: 1px solid var(--panel-border);
  background: color-mix(in oklab, var(--bg-soft) 85%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.03s ease, background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, opacity 0.2s ease;
}
.theme-toggle:hover {
  background: color-mix(in oklab, var(--panel) 70%, transparent);
}
.theme-toggle:active {
  transform: translateY(1px);
}
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.theme-toggle .theme-icon {
  display: inline-block;
  font-size: 1rem;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--danger) 45%, var(--panel-border));
  background: color-mix(in oklab, var(--danger) 12%, transparent);
  color: color-mix(in oklab, var(--danger) 85%, var(--text));
}

/* ===== Footer ===== */
.site-footer {
  margin-top: var(--space-6);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
