:root {
  --bg: #f5f6fa; --card: #ffffff; --text: #171a26; --muted: #6b7183; --line: #e4e7ef;
  --accent: #4f46e5; --accent-2: #4338ca; --accent-soft: #eef0ff; --c2: #0ea5a4;
  --ok: #0f9d58; --ok-soft: #e6f6ee; --warn: #b45309; --warn-soft: #fff4e0; --err: #c62828; --err-soft: #fdecec;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,24,40,.04), 0 4px 16px rgba(20,24,40,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117; --card: #171a23; --text: #e8eaf2; --muted: #9097a8; --line: #272b38;
    --accent: #7c74ff; --accent-2: #9a94ff; --accent-soft: #24234a; --c2: #2dd4bf;
    --ok: #34d399; --ok-soft: #12302a; --warn: #fbbf24; --warn-soft: #33290f; --err: #f87171; --err-soft: #3a1717;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 24px 0 12px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.card h2:first-child, form h2:first-of-type { margin-top: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
pre.copy, code.copyable { cursor: copy; position: relative; }
.wrap-pre { white-space: pre-wrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 60px; }
main.narrow { max-width: 640px; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.gap { gap: 10px; margin-top: 12px; }
.inline { display: inline; }
.end { display: flex; align-items: flex-end; padding-bottom: 14px; }
.dim { opacity: .5; }

/* Шапка */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.logo { font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .linkbtn { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.topnav a.on, .topnav a:hover, .linkbtn:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.topnav a.btn { color: #fff; }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; font-size: 14px; }
.lang { display: flex; gap: 2px; font-size: 12px; }
.lang a { color: var(--muted); padding: 3px 6px; border-radius: 6px; }
.lang a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* Карточки и сетки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.empty { text-align: center; padding: 48px 20px; }
.card.danger { border-color: var(--err-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.pagehead h1, .pagehead h2 { margin: 0; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 10px;
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 16px; }
.btn.block { display: flex; width: 100%; }

/* Формы */
form.form label, .card label { display: block; margin-bottom: 14px; font-weight: 500; font-size: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--text); font: inherit; font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
input::placeholder { text-transform: none; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 6px 0 0; accent-color: var(--accent); }
label.check, label.radio { font-weight: 400; display: flex; align-items: flex-start; gap: 4px; margin-bottom: 8px; }
label.radio { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
.help { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 500; font-size: 14px; margin-bottom: 8px; }
details { margin-bottom: 14px; }
summary { cursor: pointer; color: var(--accent); margin-bottom: 10px; font-size: 14px; }
.row input, .row select { margin-top: 0; }
.filters { display: flex; gap: 10px; padding: 12px; flex-wrap: wrap; }
.filters input, .filters select { margin: 0; width: auto; flex: 1; min-width: 160px; }
.imgfield { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.imgfield img { width: 160px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.imgfield > label { flex: 1; min-width: 220px; }
.tier-row { display: grid; grid-template-columns: 2fr 1fr .8fr 1.2fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.tier-row input, .tier-row select { margin: 0; }
.switch { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; font-size: 14px; }
.pay-card.enabled { border-color: var(--accent); }
.hookbox { background: var(--bg); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.hookbox pre { background: var(--card); }

/* Таблицы */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .thumb { width: 64px; }
.tbl .thumb img { width: 56px; height: 36px; object-fit: cover; border-radius: 6px; display: block; }
.card:has(> .tbl) { overflow-x: auto; }
.tbl th.right { text-align: right; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.tier-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pager { display: flex; gap: 16px; justify-content: center; padding-top: 12px; }

/* Бейджи */
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 500; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: var(--bg); color: var(--muted); }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

/* Сообщения */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--accent-soft); color: var(--text); }
.flash.success { background: var(--ok-soft); }
.flash.warn { background: var(--warn-soft); }
.flash.error { background: var(--err-soft); }

/* Бот */
.bothead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bt-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--c2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; flex: none; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs a.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.botcard { color: var(--text); display: block; transition: border-color .15s; }
.botcard:hover { border-color: var(--accent); text-decoration: none; }
.stats-mini { margin-top: 16px; justify-content: space-between; }
.stats-mini div { display: flex; flex-direction: column; }
.stats-mini b { font-size: 20px; }
.stats-mini span { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi b { font-size: 24px; display: block; margin: 4px 0 2px; letter-spacing: -.01em; }
.kpi small { color: var(--muted); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg a { padding: 4px 10px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chart { width: 100%; height: 140px; display: block; }
.checklist ul { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done a { color: var(--muted); }
.steps { padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 4px; }

/* Главная */
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 { font-size: 40px; max-width: 760px; margin: 0 auto 14px; line-height: 1.15; }
.lead { font-size: 18px; color: var(--muted); max-width: 600px; margin: 0 auto 26px; }
.hero-cta { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.price-tag { font-weight: 600; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.features p { color: var(--muted); margin: 0; }
.auth { margin-top: 32px; }
.pricebox { text-align: center; padding: 20px; background: var(--accent-soft); border-radius: 12px; margin: 16px 0; }
.pricebox .old-price { text-decoration: line-through; color: var(--muted); font-size: 18px; }
.pricebox .badge { margin-top: 8px; }
.promo-form { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.promo-label { font-weight: 600; margin-bottom: 8px; }
[hidden] { display: none !important; }
.pricebox .big { font-size: 36px; font-weight: 800; color: var(--accent); }

/* Чек-ин */
.checkin video { width: 100%; max-height: 320px; background: #000; border-radius: 12px; display: none; margin-bottom: 10px; object-fit: cover; }
.checkin video.on { display: block; }
.checkin #manual { margin: 12px 0; }
.result { border-radius: 12px; padding: 0; margin: 10px 0; font-size: 17px; }
.result.ok { background: var(--ok-soft); padding: 16px; border: 2px solid var(--ok); }
.result.bad { background: var(--err-soft); padding: 16px; border: 2px solid var(--err); }
.result b { display: block; font-size: 22px; margin-bottom: 4px; }

/* Посадочная и билет */
body.landing { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.land-card { background: var(--card); border-radius: 20px; padding: 24px; max-width: 460px; width: 100%; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--line); }
.land-img { width: 100%; border-radius: 14px; margin-bottom: 16px; }
.land-card h1 { font-size: 24px; }
.land-text { color: var(--muted); text-align: left; }
.tg-btn { background: #229ED9; border-color: #229ED9; margin: 18px 0 8px; }
.tg-btn:hover { background: #1b8bc0; }
.ticket { max-width: 400px; width: 100%; background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.12); border: 1px solid var(--line); }
.tk-head { background: linear-gradient(135deg, var(--accent), var(--c2)); color: #fff; padding: 20px; position: relative; }
.tk-head img { width: calc(100% + 40px); margin: -20px -20px 14px; height: 150px; object-fit: cover; display: block; }
.tk-head h1 { font-size: 22px; margin: 4px 0 0; }
.tk-org { opacity: .85; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.tk-body { padding: 16px 20px; }
.tk-row { display: flex; gap: 10px; padding: 6px 0; }
.tk-cut { border-top: 2px dashed var(--line); margin: 0 16px; }
.tk-qr { padding: 20px; text-align: center; }
.tk-qr svg { width: 220px; height: 220px; }
.tk-code { margin-top: 6px; font-family: ui-monospace, monospace; letter-spacing: .1em; }
.tk-status { margin-top: 12px; padding: 8px; border-radius: 10px; font-weight: 700; }
.tk-status.ok { background: var(--ok-soft); color: var(--ok); }
.tk-status.used, .tk-status.void { background: var(--err-soft); color: var(--err); }

/* Мастер и онбординг */
.wizard-step { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.wizard-step:last-of-type { border-bottom: 0; margin-bottom: 8px; }
.wizard-step h3 { margin: 4px 0 4px; font-size: 17px; }
.wizard-step p { margin: 0 0 10px; }
.num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.mini-steps { margin: 12px 0 4px; padding-left: 20px; color: var(--muted); font-size: 14px; }
.mini-steps li { margin-bottom: 4px; }
.mini-steps b, .mini-steps code { color: var(--text); }
.btn.tg { background: #229ED9; border-color: #229ED9; }
.btn.tg:hover { background: #1b8bc0; }
.tg-sample { background: #e5f2fb; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .tg-sample { background: #17212b; } }
.tg-bubble { background: var(--card); border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: 13px; max-width: 420px; line-height: 1.6; }
.tg-bubble mark { background: #fff3a8; color: #111; padding: 1px 4px; border-radius: 4px; font-family: ui-monospace, monospace; }
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 14px; }
.kind-card { position: relative; border: 2px solid var(--line); border-radius: 14px; padding: 16px !important; cursor: pointer; display: flex !important; flex-direction: column; gap: 4px; margin: 0 !important; }
.kind-card input { position: absolute; opacity: 0; }
.kind-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.kind-card .kc-icon { font-size: 26px; }
.kind-card small { color: var(--muted); font-weight: 400; }
details.more { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
details.more[open] { padding-bottom: 4px; }
details.more summary { margin-bottom: 0; }
details.more[open] summary { margin-bottom: 12px; }
.launch { border: 2px solid var(--accent); }
.launch h2 { margin: 0; }
.progress { height: 6px; background: var(--bg); border-radius: 99px; margin: 12px 0 8px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.launch-steps { display: grid; gap: 4px; }
.lstep { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lstep:last-child { border-bottom: 0; }
.lstep p { margin: 2px 0 0; }
.lstep.done .num { background: var(--ok); }
.lstep.done b { color: var(--muted); }
.share { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--ok-soft); border-color: transparent; }
details.pay-card { padding: 0; }
details.pay-card > summary { list-style: none; cursor: pointer; padding: 18px 20px; margin: 0; color: var(--text); }
details.pay-card > summary::-webkit-details-marker { display: none; }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-body { padding: 0 20px 20px; border-top: 1px solid var(--line); padding-top: 16px; }
label.check.strong { font-weight: 600; margin: 12px 0; }

.kpis6 { grid-template-columns: repeat(6, 1fr); }
.kpis6 .kpi b { font-size: 20px; }
.legend { display: inline-flex; gap: 6px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.qr-box { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.qr-box svg { width: 110px; height: 110px; border: 1px solid var(--line); border-radius: 8px; flex: none; }
.code-input { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.code-input input { margin: 0; }
.dim-row td { background: var(--bg); }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.new-link { padding: 0; }
details.new-link > summary { padding: 18px 20px; margin: 0; color: var(--text); }
details.card:not(.pay-card):not(.new-link) .pc-body { padding: 16px 0 0; border-top: 0; }
.share-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-color: var(--accent); }
.links-tbl td b { font-weight: 600; }

/* Копирование */
.copied::after { content: '✓'; position: absolute; right: 10px; top: 8px; color: var(--ok); font-weight: 700; }

@media (max-width: 860px) {
  .grid2, .cols3, .features { grid-template-columns: 1fr; }
  .kpis, .kpis6 { grid-template-columns: 1fr 1fr; }
  .tier-row { grid-template-columns: 1fr 1fr; }
  .tier-row input[name="tier_name[]"] { grid-column: 1 / -1; }
  .tier-head { display: none; }
  .tier-row { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .hero h1 { font-size: 30px; }
  .top .wrap { gap: 8px; }
  .topnav a { padding: 6px; }
}
@media (max-width: 560px) {
  .cols2 { grid-template-columns: 1fr; }
  .kind-cards { grid-template-columns: 1fr; }
  .wizard-step { gap: 10px; }
  .lstep { flex-wrap: wrap; }
  .logo { font-size: 0; } .logo-mark { font-size: 20px; }
  .checklist ul { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}
@media print {
  body.landing { background: #fff; }
  .ticket { box-shadow: none; }
}
