:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e4e4de;
  --accent: #3355d1;
  --accent-soft: #e6ebfb;
  --accent-text: #ffffff;
  --danger: #c4372b;
  --danger-soft: #fbe9e7;
  --ok: #1d8a4e;
  --ok-soft: #e3f4ea;
  --warn: #b46a00;
  --heart: #e0245e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b1a;
    --surface-2: #252523;
    --text: #ececea;
    --muted: #a2a29c;
    --line: #2f2f2c;
    --accent: #7d96ff;
    --accent-soft: #232b4a;
    --accent-text: #0d1330;
    --danger: #ff7a6e;
    --danger-soft: #3a1f1c;
    --ok: #5ccf8e;
    --ok-soft: #173326;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 500 14px var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 40px; padding: 0; }
.btn:disabled { opacity: .55; cursor: default; }

label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
input[type=text], input[type=password], input[type=number], input[type=url], select {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 15px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #ffb347 0%, #ff5e62 45%, #3355d1 100%); color: #fff; }
.logo svg { width: 20px; height: 20px; fill: #fff; }
.login-card h1 { font-size: 24px; margin: 22px 0 6px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; transition: all .25s; pointer-events: none; z-index: 100; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- dialog ---------- */
dialog { border: none; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(480px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 24px; }
dialog h2 { font-size: 20px; margin-bottom: 18px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
