/* ===== Design tokens ===== */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #ccfbf1;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --brand-bg: #0b3b37;
  --brand-text: #e6fffa;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --primary: #14b8a6;
    --primary-hover: #2dd4bf;
    --primary-soft: #134e4a;
    --danger: #f87171;
    --danger-soft: #3b1111;
    --brand-bg: #042f2e;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.75rem; margin: 0 0 .25rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; line-height: 1.2; margin: 0 0 .75rem; letter-spacing: -0.02em; }
.muted { color: var(--muted); margin: 0; }
code { font-size: .85em; background: var(--primary-soft); padding: 1px 6px; border-radius: 4px; }

.link { color: var(--primary); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ===== Layout ===== */
.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth__brand {
  background: radial-gradient(circle at 20% 10%, #115e59 0%, var(--brand-bg) 60%);
  color: var(--brand-text);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.auth__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ===== Brand ===== */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: #2dd4bf; color: #042f2e; font-weight: 700;
}
.brand--mobile { display: none; margin-bottom: 24px; color: var(--text); }

.brand__pitch p { opacity: .8; max-width: 420px; line-height: 1.6; margin: 0; }

/* Mini dashboard preview */
.preview {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 420px;
  backdrop-filter: blur(6px);
}
.preview__head { display: flex; justify-content: space-between; font-size: .85rem; opacity: .8; }
.preview__trend { color: #5eead4; font-weight: 600; opacity: 1; }
.preview__value { font-size: 1.75rem; font-weight: 700; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.preview__chart { width: 100%; height: 70px; color: #5eead4; display: block; }
.preview__rows { margin-top: 12px; font-size: .9rem; }
.preview__rows div {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-variant-numeric: tabular-nums;
}
.preview__rows .pos { color: #5eead4; }

/* ===== Card & form ===== */
.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

form { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label-row { display: flex; justify-content: space-between; align-items: baseline; }
.field__label-row .link { font-size: .85rem; }
label { font-size: .9rem; font-weight: 500; }

input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); opacity: .7; }
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.field.has-error input { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .8rem; min-height: 1em; }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 64px; }
.toggle-pw {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--primary);
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.toggle-pw:hover { background: var(--primary-soft); }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 400; cursor: pointer; }
.checkbox input { accent-color: var(--primary); width: 16px; height: 16px; }

/* Button */
.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 12px;
  font: inherit; font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 0; border-radius: 10px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .7; cursor: progress; }

.spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alert */
.alert {
  margin-top: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .9rem;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
.alert.is-success {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.demo { margin-top: 20px; font-size: .8rem; text-align: center; }
.signup { margin-top: 16px; font-size: .9rem; text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
  .brand--mobile { display: flex; }
}

@media (max-width: 440px) {
  .card { padding: 28px 20px; border: 0; box-shadow: none; background: transparent; }
}
