:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1c1a;
  --muted: #6d6a64;
  --line: #e4e1da;
  --brand: #24507A;
  --brand-ink: #ffffff;
  --brand-soft: #e4ecf5;
  --ok: #2f7d4f;
  --ok-soft: #e3f1e8;
  --warn: #9a6b00;
  --err: #b3261e;
  --err-soft: #fbe5e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #1f1d1a; color: #d9d5cd; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; }
.side .logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; font-style: normal; font-size: 14px; }
.side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8f8a80; padding: 14px 10px 6px; }
.side a { display: block; color: #d9d5cd; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.side a:hover { background: #2c2925; text-decoration: none; }
.side a.on { background: #36322d; color: #fff; }
.side .venue-name { color: #fff; font-weight: 600; padding: 6px 10px 4px; font-size: 14px; }
.main { padding: 24px 28px 60px; max-width: 1120px; width: 100%; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; padding: 8px 10px; display: flex; gap: 4px; align-items: center; overflow-x: auto; white-space: nowrap; }
  .side .logo { padding: 4px 8px; font-size: 15px; }
  .side .logo span { display: none; }
  .side .group, .side .venue-name { display: none; }
  .side a { display: inline-block; padding: 7px 10px; }
  .main { padding: 16px 14px 60px; }
}

/* ---------- карти ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid.two, .grid.three { grid-template-columns: 1fr; } .grid.four { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- бутони ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: #cfcac0; background: #faf9f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: #f0c4bf; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.icon { padding: 4px 8px; min-height: 30px; min-width: 32px; }
.btn.ghost { border-color: transparent; background: transparent; }
form.inline { display: inline; margin: 0; }

/* ---------- форми ---------- */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=time], select, textarea {
  width: 100%; border: 1px solid #d6d2c9; border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 15px; background: #fff; color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type=color] { width: 54px; height: 38px; border: 1px solid #d6d2c9; border-radius: 8px; padding: 2px; background: #fff; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; }
.lang-tabs { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.lang-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 9px; font-size: 12.5px; cursor: pointer; }
.lang-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.lang-tabs button.missing::after { content: " •"; color: var(--warn); }
.i18n [data-lang] { display: none; }
.i18n [data-lang].on { display: block; }
.formbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }

/* ---------- таблици и списъци ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eeebe5; color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--err-soft); color: var(--err); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- съобщения ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--ok-soft); color: var(--ok); border: 1px solid #c4e3cf; }
.flash.err { background: var(--err-soft); color: var(--err); border-color: #f0c4bf; }
.errors { background: var(--err-soft); color: var(--err); border: 1px solid #f0c4bf; border-radius: 8px; padding: 10px 14px 10px 30px; margin: 0 0 16px; }

/* ---------- меню редактор ---------- */
.cat { margin-bottom: 18px; }
.cat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
.cat-head h3 { margin: 0; flex: 1; font-size: 15px; }
.cat-head .tools { display: flex; gap: 4px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: #f0ede7; }
.item .thumb.none { display: grid; place-items: center; color: #b6b0a5; font-size: 11px; }
.item .info { flex: 1; min-width: 0; }
.item .info .nm { font-weight: 600; }
.item .info .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .price { font-weight: 600; white-space: nowrap; }
.item.soldout .info, .item.soldout .price, .item.soldout .thumb { opacity: .45; }
.item .tools { display: flex; gap: 4px; align-items: center; }

.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d3cec4; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(17px); }

.photo-box { display: flex; gap: 14px; align-items: flex-start; }
.photo-box img { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-box .ph { width: 140px; height: 105px; border-radius: 8px; border: 1px dashed #cfc9bd; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px; }

.variants .vrow { display: grid; grid-template-columns: 1fr 120px 34px; gap: 8px; margin-bottom: 6px; }

.points { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 8px; }
.point { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.point b { font-size: 15px; }
.point .tools { display: flex; gap: 4px; flex-wrap: wrap; }
.point.off { opacity: .5; }
.link-box { display: flex; gap: 8px; align-items: center; background: #fbfaf8; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; word-break: break-all; }
.link-box code { flex: 1; }

/* ---------- вход ---------- */
.plain { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.plain .box { width: 100%; max-width: 420px; }
.plain .box.wide { max-width: 640px; }
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; margin-bottom: 18px; justify-content: center; }
.brandmark i { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-style: normal; }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; }
.checklist li { padding: 3px 0; }
.checklist .y { color: var(--ok); }
.checklist .n { color: var(--err); }
