/* Простая сетка без фреймворка. Один акцент — шкала шагов заказа, всё остальное тихое. */
:root {
  /* Тёмная тема по умолчанию (решение владельца). Светлая — по кнопке в шапке, data-theme="light". */
  color-scheme: dark;
  --page: #15181c;
  --surface: #1e2227;
  --ink: #e6e9ed;
  --muted: #9aa3ad;
  --line: #343a42;
  --action: #5b9be6;
  --action-ink: #0d1520;
  --ok: #4cb37a;
  --warn: #e0a339;
  --err: #f0786b;
  --media-bg: #262b31;
  --radius: 6px;
  --gap: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f2f3f5;
  --surface: #ffffff;
  --ink: #1c2127;
  --muted: #5b6470;
  --line: #d5d9df;
  --action: #1f5fad;
  --action-ink: #ffffff;
  --ok: #1e7a46;
  --warn: #a86500;
  --err: #b42318;
  --media-bg: #e4e7eb;
}

* { box-sizing: border-box; }
body { margin: 0; }
img, video { max-width: 100%; display: block; }
a { color: var(--action); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 650; }
h2 { font-size: 1.2rem; font-weight: 650; margin-top: 1.5em; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 1em; max-width: 68ch; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gap); }

/* Шапка */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--action); }
.top-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
@media (max-width: 640px) {
  .nav { order: 3; flex-basis: 100%; }
}
.lang { display: flex; gap: 2px; }
.lang button { border: 0; background: none; padding: 4px 6px; color: var(--muted); cursor: pointer; font: inherit; font-size: .875rem; }
.lang button[aria-pressed="true"] { color: var(--ink); font-weight: 650; }
.theme button { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: var(--radius); padding: 3px 8px; font: inherit; font-size: .875rem; cursor: pointer; }

main { padding: 32px 0 48px; }
.foot { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .875rem; }

/* Кнопки и поля */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid var(--action); background: var(--action); color: var(--action-ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-plain { background: var(--surface); color: var(--action); }
.btn-danger { background: var(--surface); color: var(--err); border-color: var(--err); }
.btn-link { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.btn-small { padding: 5px 12px; font-size: .875rem; }
input[type=text], input[type=email], input[type=tel], input:not([type]), input[type=file],
input[type=number], input[type=date], select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); width: 100%; max-width: 360px;
}
label { display: block; margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* Сообщения */
.note { padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: var(--gap); max-width: 68ch; }
.note-err { border-color: var(--err); color: var(--err); }
.note-warn { border-color: var(--warn); }

/* Статус заказа */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .875rem; font-weight: 600; border: 1px solid currentColor; }
.tag-ok { color: var(--ok); }
.tag-warn { color: var(--warn); }
.tag-err { color: var(--err); }
.tag-info { color: var(--action); }
.tag-muted { color: var(--muted); }

/* Блок с содержимым */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: var(--gap); }
.panel > :last-child { margin-bottom: 0; }

/* Фото, гифки, видео: всегда 16:9, чтобы страница не прыгала при загрузке */
.media { aspect-ratio: 16 / 9; background: var(--media-bg); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .875rem; margin: 0; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media-empty { border: 1px dashed var(--line); background: var(--surface); text-align: center; padding: 8px; }
figure { margin: 0; }
figcaption { color: var(--muted); font-size: .875rem; margin-top: 6px; }
.panel .media, .panel figure { max-width: 560px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }

/* Каталог: строка = картинка + текст */
.catalog { display: grid; gap: var(--gap); }
.mod { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.mod h2 { margin-top: 0; }
.mod > a { color: inherit; text-decoration: none; }
.mod .price { font-size: 1.25rem; font-weight: 650; }
@media (max-width: 640px) { .mod { grid-template-columns: 1fr; } }

/* Карточка мода: на телефоне порядок — фото, покупка, описание */
.product { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); grid-template-areas: "media buy" "info buy"; gap: 0 32px; align-items: start; }
.product-media { grid-area: media; }
.product-info { grid-area: info; }
.buy { grid-area: buy; position: sticky; top: 16px; }
.buy .price { font-size: 1.75rem; font-weight: 700; margin-bottom: .25em; }
.old { text-decoration: line-through; color: var(--muted); font-weight: 400; font-size: 1rem; margin-right: 8px; }
@media (max-width: 800px) {
  .product { grid-template-columns: 1fr; grid-template-areas: "media" "buy" "info"; }
  .buy { position: static; margin-top: var(--gap); }
}

ol.steps { padding-left: 1.25em; max-width: 68ch; }
ol.steps li { margin-bottom: .5em; }

/* Шкала шагов заказа — единственный яркий элемент */
.track { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(5, 1fr); counter-reset: s; }
.track li { counter-increment: s; position: relative; padding-top: 34px; font-size: .875rem; color: var(--muted); text-align: center; }
.track li::before {
  content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line); color: var(--muted); font-weight: 700; z-index: 1;
}
.track li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.track li:first-child::after { display: none; }
.track li.done { color: var(--ink); }
.track li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--surface); }
.track li.done::after, .track li.now::after { background: var(--ok); }
.track li.now { color: var(--ink); font-weight: 650; }
.track li.now::before { border-color: var(--action); color: var(--action); }
.track li.stop::before { content: "!"; border-color: var(--err); color: var(--err); }
@media (max-width: 520px) { .track li { font-size: .75rem; } }

/* Списки заказов и админки */
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list > li { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 200px; }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); }
.history { list-style: none; padding: 0; color: var(--muted); font-size: .875rem; }
.narrow { max-width: 420px; }
details summary { cursor: pointer; }
code { font-size: .875em; }

.legal-document { max-width: 72ch; }
.legal-document li { margin-bottom: .75em; }
.offer-consent label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.offer-consent input[type=checkbox] { flex: none; margin-top: .35em; }
.offer-consent a { text-underline-offset: .15em; }
textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; max-width: 540px; resize: vertical; }
@media print {
  .top, .foot, .legal-document button { display: none; }
  :root { --page: white; --ink: black; --muted: #333; --action: black; color-scheme: light; }
  .legal-document { max-width: none; }
  .legal-document h2 { break-after: avoid; }
}

/* Второй шаг входа */
.qr { width: 220px; margin: 0 0 12px; border-radius: var(--radius); overflow: hidden; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { word-spacing: 4px; user-select: all; }

/* Админка */
.subnav, .tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 24px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.subnav a, .tabs a { color: var(--muted); text-decoration: none; }
.subnav a:hover, .subnav a[aria-current], .tabs a:hover, .tabs a[aria-current] { color: var(--ink); }
.subnav a[aria-current], .tabs a[aria-current] { font-weight: 650; }
.tabs { border-bottom: 0; margin-bottom: 8px; }
.field small { display: block; margin-top: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--muted); }
.w-num { width: 140px !important; }
.w-pct { width: 90px !important; }
.w-date { width: 180px !important; }
.upper { text-transform: uppercase; }
.scroll { overflow-x: auto; }
td code { white-space: nowrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.media-card { margin: 0; }
.media-card .muted { margin: 8px 0; font-size: .875rem; }
.btn[disabled] { opacity: .4; cursor: default; filter: none; }
.warn { color: var(--warn); }

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