:root {
  --accent: #2b6cb0;
  --bg: linear-gradient(180deg,#f8f7f4 0%,#efede8 100%);
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #23252b;
  --text-muted: #6b7078;
  --line: #e4e2dd;
  --card-radius: 14px;
  --btn-radius: 10px;
  --chip-radius: 8px;
  --ok: #1e7a44;
  --warn: #b7791f;
  --bad: #b3392e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; word-break: break-all; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.ok { color: var(--ok); }
.error { color: var(--bad); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  position: sticky; top: 0; z-index: 5;
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 18px;
}
.card h3 { margin-top: 0; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  padding: 9px 16px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--accent); border-color: var(--line); }
.btn.big { font-size: 17px; padding: 12px 22px; }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: var(--chip-radius); font-size: 13px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.badge.ok { background: #e5f5ec; color: var(--ok); border-color: #bfe5cf; }
.badge.warn { background: #fdf3e0; color: var(--warn); border-color: #f0dcb2; }
.badge.bad { background: #fdeae8; color: var(--bad); border-color: #f2c8c3; }
.badge.muted { color: var(--text-muted); }

form label { display: block; margin: 10px 0; }
input, select, textarea {
  display: block; width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.auth-box { max-width: 420px; margin: 60px auto; }

.demo-route li { margin: 6px 0; }

/* ---------- витрина ---------- */
.storefront-root {
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
}
.hero { padding: 56px 0 40px; }
.hero h1 { font-size: 34px; margin: 0 0 12px; }
.hero .lead { font-size: 18px; max-width: 640px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 18px 0; }
.gallery-img { width: 100%; height: 170px; object-fit: cover; border-radius: var(--card-radius); border: 1px solid var(--line); }
.storefront-footer { border-top: 1px solid var(--line); padding: 18px 0 30px; margin-top: 40px; }
.storefront-footer .wrap { display: flex; justify-content: space-between; }

/* ---------- запись ---------- */
.step-title { margin: 22px 0 10px; }
.slot-chip {
  display: inline-block;
  margin: 4px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--chip-radius);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
}
.slot-chip:hover { border-color: var(--accent); }
.slot-chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0; }
.date-chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--chip-radius);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
}
.date-chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- билет ---------- */
.ticket h1 { margin-top: 4px; }
.ticket-details { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; }
.ticket-details dt { color: var(--text-muted); }
.ticket-details dd { margin: 0; }

/* ---------- кабинет ---------- */
.cab { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.cab-side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; }
.cab-side .logo { font-weight: 700; margin-bottom: 14px; display: block; }
.cab-side a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; margin: 2px 0; }
.cab-side a.active, .cab-side a:hover { background: var(--surface-2); }
.cab-main { padding: 24px 26px; }
.cab-main h1 { margin-top: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--card-radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
table.list tr:last-child td { border-bottom: none; }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 8px 16px; }
.kv > div { padding: 4px 0; }
.section { margin: 26px 0; }
.notice { background: var(--surface-2); border: 1px dashed var(--line); padding: 10px 14px; border-radius: 10px; color: var(--text-muted); }
.notice.demo { border-color: var(--warn); color: var(--warn); }
.inline-form { display: inline; }
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: inline-block; }
.qr-box svg { display: block; }
.modules-table td { vertical-align: top; }
.module-variants { font-size: 13px; color: var(--text-muted); }
.amount-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.amount-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--card-radius); padding: 16px; }
.amount-card b { font-size: 22px; display: block; margin-top: 4px; }

/* ---------- витрина магазина ---------- */
.shop-cat { margin-top: 26px; }
.product-card { display: flex; flex-direction: column; }
.product-photo { width: 100%; height: 160px; object-fit: cover; border-radius: calc(var(--card-radius) - 4px); border: 1px solid var(--line); margin-bottom: 10px; }
.product-photo-empty { display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-muted); font-size: 14px; }
.product-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.product-row .toolbar { margin: 6px 0; }
@media (max-width: 480px) {
  .product-edit-grid { grid-template-columns: 1fr; }
  .cab { grid-template-columns: 1fr; }
  .cab-side { position: static; }
  .ticket-details { grid-template-columns: 130px 1fr; }
}
