:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --input-border: rgba(11,11,11,0.18);
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --series-1: #2a78d6;
  --series-1-wash: rgba(42,120,214,0.10);
  --up: #006300;
  --down: #d03b3b;
  --error-bg: rgba(208,59,59,0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255,255,255,0.10);
    --input-border: rgba(255,255,255,0.20);
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --series-1: #3987e5;
    --series-1-wash: rgba(57,135,229,0.16);
    --up: #0ca30c;
    --down: #e66767;
    --error-bg: rgba(230,103,103,0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255,255,255,0.10);
  --input-border: rgba(255,255,255,0.20);
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --series-1: #3987e5;
  --series-1-wash: rgba(57,135,229,0.16);
  --up: #0ca30c;
  --down: #e66767;
  --error-bg: rgba(230,103,103,0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.sub { color: var(--text-secondary); margin: 0; }
.muted { color: var(--text-secondary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
input, select {
  width: 100%;
  font: inherit;
  color: var(--text-primary);
  background: var(--page);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 9px 11px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.btn {
  font: inherit; font-weight: 500;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text-primary); border-color: var(--input-border); }
.btn.ghost:hover { background: var(--border); }

.error {
  display: none;
  background: var(--error-bg); color: var(--down);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
}
.error.show { display: block; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px 16px;
}
.auth .card { width: 100%; max-width: 380px; padding: 28px 24px; }
.auth .brand { font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.auth h1 { margin-bottom: 6px; }
.auth .sub { margin-bottom: 22px; }
.auth .switch { text-align: center; margin: 18px 0 0; color: var(--text-secondary); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-secondary);
  font: inherit; font-size: 12px; cursor: pointer; padding: 4px 6px;
}

/* ---------- Brand ---------- */
.by, .site-footer { color: var(--text-muted); font-size: 12px; text-align: center; margin: 0; }
.site-footer { padding: 0 16px 32px; }
.by a, .site-footer a { color: var(--text-secondary); }
