/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.01em; color: var(--text); }

.ico { flex-shrink: 0; display: block; }

/* ===== FORMS ===== */
input, select, textarea {
  font: inherit;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  min-height: 40px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input[type="checkbox"] {
  width: 16px; height: 16px; min-height: 0; padding: 0;
  accent-color: var(--brand); cursor: pointer;
}
input.invalid, select.invalid, textarea.invalid { border-color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.hint { font-size: 12px; color: var(--mute); }
.field-err { font-size: 12px; color: var(--bad); min-height: 0; }
.field-err:empty { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }

/* ===== TEXT UTILITIES ===== */
.muted { color: var(--mute); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

::selection { background: var(--brand-soft); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* The hidden attribute must win over display rules like .field { display: flex }. */
[hidden] { display: none !important; }
