:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2230;
  --muted: #5b6272;
  --border: #c9ced8;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-text: #1e6b34;
  --err-bg: #fdecec;
  --err-text: #9b1c1c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171f;
    --card: #1d222d;
    --text: #e8ebf2;
    --muted: #a3aab9;
    --border: #3a4252;
    --accent: #5b8fe0;
    --accent-text: #0e1320;
    --ok-bg: #1d3626;
    --ok-text: #9fe0b3;
    --err-bg: #3a1e1e;
    --err-text: #ffb4b4;
  }
}

:root[data-theme="dark"] {
  --bg: #14171f;
  --card: #1d222d;
  --text: #e8ebf2;
  --muted: #a3aab9;
  --border: #3a4252;
  --accent: #5b8fe0;
  --accent-text: #0e1320;
  --ok-bg: #1d3626;
  --ok-text: #9fe0b3;
  --err-bg: #3a1e1e;
  --err-text: #ffb4b4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.card {
  max-width: 640px;
  margin: 24px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--err-text); }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; min-height: 140px; }

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.error { color: var(--err-text); font-size: 0.9rem; margin: 4px 0 0; }

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button {
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  min-height: 44px;
}

button:disabled { opacity: 0.6; cursor: default; }

.status {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 500;
}
.status.success { background: var(--ok-bg); color: var(--ok-text); }
.status.error { background: var(--err-bg); color: var(--err-text); }
.status[hidden], .error[hidden] { display: none; }
