:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e2dd;
  --accent: #1f7a4d;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --warn-bg: #fff4d6;
  --warn-text: #6b4e00;
  --ok-bg: #e5f4ec;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141415;
    --card: #1e1e20;
    --text: #f2f2f3;
    --muted: #a0a0a6;
    --line: #333336;
    --accent: #3fb07a;
    --accent-text: #0b1f15;
    --danger: #ff7b72;
    --warn-bg: #3a3000;
    --warn-text: #ffe28a;
    --ok-bg: #12301f;
  }
}
* { 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, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 520px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1100px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.price { font-size: 2.2rem; font-weight: 700; margin: 8px 0 4px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
header.top { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 12px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
textarea { min-height: 80px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .9rem; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn.block { display: block; width: 100%; font-size: 1.1rem; padding: 16px; margin-top: 18px; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 8px 12px; font-size: .9rem; }

.alert { border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.alert.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }
.alert.ok { background: var(--ok-bg); }

.testbar {
  background: var(--warn-bg); color: var(--warn-text);
  text-align: center; font-size: .85rem; font-weight: 600; padding: 6px 12px;
}

/* Экран «Оплачено» — крупно, чтобы было видно издалека */
.paid { text-align: center; background: var(--ok-bg); border-color: transparent; }
.paid .mark {
  width: 96px; height: 96px; margin: 8px auto 12px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; font-size: 56px; line-height: 1;
}
.paid .big { font-size: 1.8rem; font-weight: 800; margin: 0; }
.paid .num { font-size: 1.3rem; font-weight: 700; margin-top: 12px; }
.spinner {
  width: 40px; height: 40px; margin: 12px auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.foot { text-align: center; font-size: .8rem; color: var(--muted); padding: 16px 0 32px; }
footer.foot a { color: var(--muted); margin: 0 6px; }

/* Админка */
nav.admin { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 16px; }
nav.admin a { text-decoration: none; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.5rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
.low { color: var(--danger); font-weight: 700; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.tag.paid { background: var(--ok-bg); border-color: transparent; }
.tag.canceled { color: var(--muted); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form input[type=number] { width: 72px; padding: 6px 8px; }
.qr-box { max-width: 220px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 260px; }

/* Ценники для печати */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 6mm; }
.label {
  background: #fff; color: #000; border: 1px dashed #999; border-radius: 8px;
  padding: 5mm; text-align: center; break-inside: avoid;
}
.label .name { font-weight: 700; font-size: 13pt; line-height: 1.2; min-height: 2.4em; }
.label .lprice { font-size: 22pt; font-weight: 800; margin: 2mm 0; }
.label .qr { width: 38mm; height: 38mm; margin: 0 auto; }
.label .qr svg { width: 100%; height: 100%; }
.label .hint { font-size: 9pt; margin-top: 2mm; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .wrap.wide { max-width: none; padding: 0; }
}
