:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1d22;
  --muted: #6b7180;
  --border: #dfe2e8;
  --accent: #2f6fed;
  --accent-hover: #2459c4;
  --danger: #d23b3b;
  --ok: #1e9e5a;
  --warn: #d88a0b;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --card: #1c1f25;
    --text: #eceef2;
    --muted: #9aa1ae;
    --border: #2d323b;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

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

a { color: var(--accent); }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
}

.hero h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 8px 0 8px;
}

.lead { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); font-weight: normal; }
.center { text-align: center; }

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

/* ---------- Форма ---------- */
.form { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field__label { font-weight: 600; font-size: 0.95rem; }

input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* без зума на iOS */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 48px; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input:user-invalid, textarea:user-invalid { border-color: var(--danger); }

.turnstile { min-height: 65px; }

.form__error {
  margin: 0;
  color: var(--danger);
  font-size: 0.95rem;
}

.button {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.button:hover { background: var(--accent-hover); }
.button:disabled { opacity: .7; cursor: default; }

.spinner {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.button.is-loading .button__text { visibility: hidden; }
.button.is-loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Статус ---------- */
.status {
  --status-color: var(--accent);
  border-left: 6px solid var(--status-color);
  transition: border-color .4s, box-shadow .4s;
}
.status[data-status="new"] { --status-color: var(--accent); }
.status[data-status="in_stock"] { --status-color: var(--ok); }
.status[data-status="out_of_stock"] { --status-color: var(--danger); }
.status[data-status="shipped"] { --status-color: var(--ok); }
.status[data-status="unavailable"],
.status[data-status="loading"] { --status-color: var(--border); }

.status__label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.status__text {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.35;
  transition: opacity .25s ease, transform .25s ease;
}
.status.is-changing .status__text { opacity: 0; transform: translateY(6px); }
.status.is-updated { box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-color) 25%, transparent); }

.status__conn {
  margin: 10px 0 0;
  color: var(--warn);
  font-size: 0.9rem;
}

@media (min-width: 640px) {
  .page { padding-top: 56px; }
  .hero h1 { font-size: 2.1rem; }
  .card { padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 1.5s !important; }
}
