/* Магазин Pro: спокойная тёплая палитра, один акцент, удобно с телефона. */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --text: #2b2a27;
  --muted: #706d65;
  --line: #e4e0d6;
  --accent: #2f6f6a;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0ee;
  --code-ink: #24524d;
  --danger: #a34536;
  --danger-soft: #f8e9e5;
  --notice-soft: #e8f2e6;
  --notice-ink: #2f5d2a;
  --banner: #f3e3b5;
  --banner-ink: #5c4813;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 35, 25, 0.05), 0 4px 18px rgba(40, 35, 25, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1b;
    --surface: #252725;
    --text: #e8e6e1;
    --muted: #a19e96;
    --line: #3a3c39;
    --accent: #5fa59d;
    --accent-ink: #10201e;
    --accent-soft: #23332f;
    --code-ink: #a9d8d1;
    --danger: #e08a7a;
    --danger-soft: #3a2723;
    --notice-soft: #253323;
    --notice-ink: #b5dbab;
    --banner: #4a3f1f;
    --banner-ink: #f1e2b2;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-top: 8px; padding-bottom: 48px; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 0.95em; }
small, .small { font-size: 0.86rem; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; margin: 0 auto; }

.test-banner {
  background: var(--banner);
  color: var(--banner-ink);
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 7px 16px;
}

.top { padding: 14px 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { color: var(--text); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark {
  background: var(--accent); color: var(--accent-ink); border-radius: 8px;
  padding: 2px 8px; font-size: 0.9rem; font-weight: 700;
}
.nav { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }

.foot { border-top: 1px solid var(--line); padding: 20px 0 28px; font-size: 0.9rem; }
.foot .wrap { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.foot a { color: var(--muted); }

.hero { padding: 20px 0 8px; max-width: 640px; }
.hero h1 { font-size: 2rem; }
.lead { font-size: 1.1rem; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 0 0 16px;
}
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin: 16px 0; }
.app-card { display: flex; flex-direction: column; margin: 0; }
.app-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.app-head h1, .app-head h2 { margin: 0 0 2px; }
.app-head p { margin: 0; }
.app-icon { width: 60px; height: 60px; border-radius: 14px; flex: none; object-fit: cover; }
.app-icon-empty {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 1.5rem;
}
.features { margin: 0 0 18px; padding: 0; list-style: none; flex: 1; }
.features li { padding: 4px 0 4px 24px; position: relative; }
.features li b { font-weight: 600; }
.feature-note { color: var(--muted); }
.features li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.price { font-size: 1.3rem; font-weight: 700; margin: 0; }
.price small { font-size: 0.85rem; font-weight: 400; color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 28px; }
.steps div { display: flex; gap: 12px; align-items: baseline; color: var(--muted); }
.steps b {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: 10px;
  padding: 11px 20px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 44px;
}
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;
}
.btn-wide { width: 100%; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: 0.92rem; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.inline { display: inline; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; flex-direction: row; }
.form-row label { flex: 1 1 140px; }
.form-row label.grow { flex: 3 1 220px; }
input[type=email], input[type=password], input[type=text], input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
.form .check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.92rem; margin: -4px 0 0; }

.alert, .notice { border-radius: 10px; padding: 10px 14px; }
.alert { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--notice-soft); color: var(--notice-ink); }
.draft {
  display: inline-block; background: var(--banner); color: var(--banner-ink);
  border-radius: 6px; padding: 2px 8px; font-size: 0.85rem; font-weight: 600;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.back { display: inline-block; margin: 0 0 12px; color: var(--muted); text-decoration: none; }

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; margin: 8px 0 12px;
}
.code-box code { font-size: 1.45rem; letter-spacing: 0.08em; color: var(--code-ink); font-weight: 600; word-break: break-all; }
.code-revoked code { text-decoration: line-through; opacity: 0.6; }
.how { padding-left: 22px; margin: 0 0 12px; }
.how li { margin: 4px 0; }

.summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; word-break: break-word; }
.pay-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.pay-actions .btn { flex: 1 1 140px; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin-bottom: 14px;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.page-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.order { padding: 18px; }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.order-head h2 { margin: 0; }

.tag {
  display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 0.84rem; white-space: nowrap;
  background: var(--line); color: var(--text);
}
.tag-paid, .tag-redeemed { background: var(--notice-soft); color: var(--notice-ink); }
.tag-active, .tag-pending { background: var(--accent-soft); color: var(--code-ink); }
.tag-refunded, .tag-revoked, .tag-cancelled, .tag-expired { background: var(--danger-soft); color: var(--danger); }

.prose p { max-width: 62ch; }

/* Админка */
.admin .wrap { max-width: 1240px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filters select, .filters input { width: auto; flex: 1 1 160px; min-height: 38px; padding: 6px 10px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.events td:last-child { word-break: break-word; }
.issued { font-family: Consolas, monospace; margin-bottom: 10px; }
.key-card { border-color: var(--accent); }
.pager { display: flex; gap: 16px; }
.app-stats { margin-top: 24px; }

@media (max-width: 560px) {
  h1, .hero h1 { font-size: 1.45rem; }
  .card { padding: 18px 16px; }
  .code-box code { font-size: 1.2rem; }
  .summary { grid-template-columns: 1fr; gap: 0; }
  .summary dd { margin-bottom: 8px; }
}
