:root {
    --bg: #f3f6f8;
    --surface: #fff;
    --text: #0b2e4a;
    --muted: #6b7280;
    --border: #dfe7ea;
    --accent: #0e9aa7;
    --accent-hover: #0b7f9e;
    --accent-soft: #e3f5f4;
    --sidebar: #0b2e4a;
    --sidebar-text: #c7d6e0;
    --danger: #c62f2f;
    --success: #1f8a4c;
    --warning: #9a6200;
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 16px; margin: 0; }
a { color: var(--accent-hover); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; margin: 0; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #fff;
    font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #eef3f5; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #f0c9c9; }
.btn-danger:hover { background: #fdeeee; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #fdeeee; color: var(--danger); }
.alert-success { background: #e5f5ec; color: var(--success); }
.alert-info { background: #e8f3fb; color: #0b4f7a; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
input, select, textarea {
    font: inherit; font-weight: 400; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    color: var(--text); min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-panel { width: 100%; max-width: 360px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 64px; height: 64px; align-self: center; }
.login-panel h1 { text-align: center; font-size: 22px; }

/* ---------- Каркас: боковое меню + контент ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--sidebar); color: var(--sidebar-text);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; color: #fff; text-decoration: none; font-size: 18px; }
.sidebar-brand img { width: 34px; height: 34px; }
.sidebar-brand b { color: #4fd1c5; }
.sidebar-brand small { font-size: 11px; font-weight: 700; color: var(--sidebar-text); margin-left: 4px; letter-spacing: .05em; }

.menu { flex: 1; padding: 8px 10px; overflow-y: auto; }
.menu-group { margin-bottom: 18px; }
.menu-title { padding: 6px 10px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #7f98aa; }
.menu-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 600;
}
.menu-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu-item.active { background: var(--accent); color: #fff; }
.menu-icon { width: 20px; text-align: center; opacity: .9; }

.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-user { flex: 1; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.avatar-sm {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 800;
}
.sidebar-footer .btn-ghost { background: transparent; color: var(--sidebar-text); border-color: rgba(255, 255, 255, .2); }
.sidebar-footer .btn-ghost:hover { background: rgba(255, 255, 255, .08); }

.content { padding: 28px 32px; min-width: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; margin-bottom: 12px; }
.filters label { min-width: 130px; }
.filters .filter-wide { flex: 1; min-width: 200px; }
.filters .check { flex-direction: row; align-items: center; gap: 8px; min-width: 0; padding-bottom: 9px; }
.filters .check input { width: 18px; height: 18px; accent-color: var(--accent); }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: #eef3f5; align-self: flex-end; }
.segmented button {
    padding: 7px 14px; border: 0; border-radius: 8px; background: none; color: var(--muted);
    font: inherit; font-weight: 700; cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.list-count { margin: 0 0 12px; font-size: 13px; }

/* ---------- Плашки событий ---------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card.is-past { opacity: .85; }
.card-cover { height: 84px; width: 100%; object-fit: cover; display: block; }
.cat-CONFERENCE   { background: linear-gradient(135deg, #0e9aa7, #0b5f86); }
.cat-MASTER_CLASS { background: linear-gradient(135deg, #2bb59a, #0e8a7e); }
.cat-COURSE       { background: linear-gradient(135deg, #3b6fd8, #26479c); }
.cat-WEBINAR      { background: linear-gradient(135deg, #7b6be0, #4f3fb3); }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; flex: 1; }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent-hover); }
.card-sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.card-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.card-stats .warn { color: var(--warning); font-weight: 700; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; font-size: 13px; }
.card-actions { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; grid-column: 1 / -1; }
.empty p { margin: 0 0 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef0f4; color: var(--muted); }
.badge-PUBLISHED, .badge-CONFIRMED { background: #e5f5ec; color: var(--success); }
.badge-DRAFT, .badge-HELD { background: #eef0f4; color: var(--muted); }
.badge-PENDING_PAYMENT { background: #fff4e0; color: var(--warning); }
.badge-REFUNDED { background: #f0eafd; color: #6a3fc1; }
.badge-ARCHIVED, .badge-EXPIRED, .badge-CANCELLED { background: #fdeeee; color: var(--danger); }
.badge-cat { background: var(--accent-soft); color: var(--accent-hover); }

/* ---------- Форма события ---------- */
.form-section { padding: 20px; margin-bottom: 16px; }
.form-section > h2 { margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-footer { display: flex; gap: 10px; margin-bottom: 40px; }

.rows { display: grid; gap: 10px; margin-top: 12px; }
.row {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
    padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafcfd;
}
.row label { flex: 1 1 160px; }
.row label.grow { flex: 3 1 240px; }
.row label.narrow { flex: 0 1 90px; }
.row .btn-danger { margin-bottom: 4px; }
.row-meta { flex-basis: 100%; font-size: 12px; }

.slug-block { display: flex; flex-direction: column; gap: 6px; }
.slug-block > label { display: block; }
.slug-field { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; }
.slug-field:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.slug-prefix { display: flex; align-items: center; padding: 0 4px 0 10px; color: var(--muted); background: #f6f8fa; white-space: nowrap; }
.slug-field input { flex: 1; min-width: 0; border: 0; border-radius: 0; outline: none; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.slug-field .btn { margin: 4px; }

/* ---------- Записи ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th, td:first-child, td.actions { white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; }
td.actions > * + * { margin-left: 6px; }
td.empty { text-align: center; color: var(--muted); padding: 32px; }

/* ---------- Контроль входа ---------- */
.checkin-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.checkin-panel { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.checkin-form input { font-size: 20px; padding: 14px; font-family: ui-monospace, Consolas, monospace; }
.checkin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.camera { width: 100%; max-height: 360px; border-radius: 10px; background: #000; }
.checkin-card { padding: 20px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; border: 2px solid; }
.checkin-card.ok { background: #e5f5ec; border-color: #9fd9b8; }
.checkin-card.warn { background: #fff4e0; border-color: #f2cf8f; }
.checkin-card.bad { background: #fdeeee; border-color: #f0b4b4; }
.checkin-title { font-size: 22px; font-weight: 800; }
.checkin-card.ok .checkin-title { color: var(--success); }
.checkin-card.warn .checkin-title { color: var(--warning); }
.checkin-card.bad .checkin-title { color: var(--danger); }
.checkin-name { font-size: 18px; font-weight: 700; }
.checkin-history { padding: 20px; }
.checkin-history h2 { margin-bottom: 12px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.history li { padding: 8px 10px; border-radius: 8px; background: #f6f8fa; border-left: 4px solid var(--border); }
.history li.ok { border-left-color: var(--success); }
.history li.warn { border-left-color: #e0a92e; }
.history li.bad { border-left-color: var(--danger); }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .menu { display: flex; gap: 12px; overflow-x: auto; }
    .menu-group { margin: 0; display: flex; align-items: center; gap: 4px; }
    .menu-title { display: none; }
    .content { padding: 16px; }
    .checkin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .cards { grid-template-columns: 1fr; }
}

/* Строки городов и спикеров: в одну линию на широком экране */
.session-row { display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(180px, 2fr) minmax(170px, 1.3fr) minmax(170px, 1.3fr) 80px auto; }
.speaker-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto; }
.session-row .row-meta { grid-column: 1 / -1; }
@media (max-width: 1200px) {
    .session-row { grid-template-columns: 1fr 1fr; }
    .session-row .btn-danger { justify-self: start; }
}

/* ---------- Цветные блоки формы события ---------- */
.form-section { --sec: var(--accent); --sec-soft: var(--accent-soft); border-left: 5px solid var(--sec); }
.form-section > h2, .form-section .section-head h2 { display: flex; align-items: center; gap: 10px; color: var(--sec-dark, var(--text)); }
.sec-num {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
    background: var(--sec-soft); color: var(--sec); font-size: 14px; font-weight: 800;
}
.sec-main     { --sec: #0e9aa7; --sec-soft: #e3f5f4; }
.sec-cover    { --sec: #7b6be0; --sec-soft: #efedfc; }
.sec-desc     { --sec: #3b6fd8; --sec-soft: #e8effc; }
.sec-cities   { --sec: #e08a1e; --sec-soft: #fdf1e1; }
.sec-speakers { --sec: #1f9d6a; --sec-soft: #e2f5ec; }
.sec-sponsor  { --sec: #d1497a; --sec-soft: #fbe8ef; }
.sec-cities .row   { background: #fffaf2; border-color: #f3dfc0; }
.sec-speakers .row { background: #f4fbf7; border-color: #cdebdc; }

.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Обложка ---------- */
.cover-picker { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.cover-preview {
    display: grid; place-items: center; aspect-ratio: 16 / 7; border-radius: 10px; overflow: hidden;
    background: repeating-linear-gradient(45deg, #f4f2fd, #f4f2fd 10px, #ebe8fb 10px, #ebe8fb 20px);
    color: var(--muted); font-size: 13px; border: 1px dashed #cfc8f3;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-controls { display: grid; gap: 12px; }
.cover-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-btn { cursor: pointer; }

/* ---------- Редактор описания ---------- */
.html-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.html-toolbar button {
    padding: 6px 10px; border: 1px solid #c9d8f4; border-radius: 8px; background: #f3f7fe; color: #26479c;
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.html-toolbar button:hover { background: #e3ecfc; }
.desc-editor { display: grid; gap: 12px; margin-top: 8px; }
.desc-editor textarea { width: 100%; min-height: 260px; line-height: 1.5; }
.desc-editor.is-html { grid-template-columns: 1fr 1fr; }
.desc-editor.is-html textarea {
    font-family: ui-monospace, Consolas, monospace; font-size: 13px;
    background: #0f1f3a; color: #e6eefc; border-color: #0f1f3a;
}
.desc-preview-wrap { display: flex; flex-direction: column; border: 1px solid #c9d8f4; border-radius: 8px; overflow: hidden; }
.preview-label { padding: 6px 10px; font-size: 12px; font-weight: 800; color: #26479c; background: #e8effc; }
.desc-preview { flex: 1; width: 100%; min-height: 260px; border: 0; background: #fff; }

/* ---------- Галерея ---------- */
.media-hint { margin: -8px 0 16px; }
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.media-tile { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.media-thumb { display: block; width: 100%; padding: 0; border: 0; background: #f2f5f7; cursor: pointer; aspect-ratio: 4 / 3; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb:hover img { opacity: .85; }
.media-tile figcaption { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; font-size: 12px; }
.media-actions { display: flex; gap: 6px; }

.modal {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
    background: rgba(11, 46, 74, .55);
}
.modal-box { width: min(980px, 100%); max-height: 85vh; overflow-y: auto; padding: 20px; }

/* ---------- Пользователи ---------- */
.user-form { margin-bottom: 16px; }

@media (max-width: 1000px) {
    .cover-picker, .desc-editor.is-html { grid-template-columns: 1fr; }
}

/* ---------- Скидки ---------- */
.alert-warning { background: #fff4e0; color: #8a5a00; }
.sec-value  { --sec: #7b6be0; --sec-soft: #efedfc; }
.sec-cond   { --sec: #3b6fd8; --sec-soft: #e8effc; }
.sec-period { --sec: #e08a1e; --sec-soft: #fdf1e1; }
.sec-events { --sec: #1f9d6a; --sec-soft: #e2f5ec; }

.value-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.value-row label { width: 180px; }
.value-row .segmented { align-self: flex-end; margin-bottom: 2px; }
.value-row .hint { padding-bottom: 10px; }

.cond-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cond-options.two { grid-template-columns: repeat(2, 1fr); }
.cond-option {
    position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 42px;
    border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface);
    transition: border-color .15s, background .15s;
}
.cond-option input { position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; accent-color: var(--sec); margin: 0; }
.cond-option b { font-size: 15px; }
.cond-option span { color: var(--muted); font-size: 13px; font-weight: 500; }
.cond-option:has(input:checked) { border-color: var(--sec); background: var(--sec-soft); }

.list-block { margin-top: 16px; display: grid; gap: 10px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.list-block .hint { margin: 0; }
#list-entries {
    width: 100%; font: 14px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 10px; resize: vertical; background: #fbfcfe;
}

.events-pick { margin-top: 14px; display: grid; gap: 8px; }
.events-pick-list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fbfdfc; }
.pick-item { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.pick-item:hover { background: var(--sec-soft); }
.pick-item input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--sec); flex: none; }

.discount-card .discount-head {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 16px; color: #fff; background: linear-gradient(135deg, #0e9aa7, #0b5f86);
}
.discount-card.cond-PHONE_LIST .discount-head  { background: linear-gradient(135deg, #3b6fd8, #26479c); }
.discount-card.cond-SERIAL_LIST .discount-head { background: linear-gradient(135deg, #7b6be0, #4f3fb3); }
.discount-value { font-size: 26px; font-weight: 800; }
.discount-cond { font-size: 13px; font-weight: 700; opacity: .9; text-align: right; }

.price-cell { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.price-cell s { font-size: 12px; }
.price-cell .discount-name { color: #1f9d6a; font-size: 12px; white-space: normal; max-width: 160px; }

@media (max-width: 900px) {
    .cond-options, .cond-options.two { grid-template-columns: 1fr; }
}

/* ---------- Роли ---------- */
.badge-root { background: #0b2e4a; color: #ffc24b; }
.user-form select:disabled, .user-form input:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Видео в галерее ---------- */
.media-video { position: relative; display: block; width: 100%; height: 100%; background: #0b2e4a; }
.media-video video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.media-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(11, 46, 74, .75); color: #fff; font-size: 16px; padding-left: 3px;
}

/* Загрузка прямо в описание: выделена цветом, чтобы её было видно среди вставок */
.html-toolbar .toolbar-upload {
    display: inline-flex; flex-direction: row; align-items: center; padding: 6px 10px; border-radius: 8px;
    background: #3b6fd8; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.html-toolbar .toolbar-upload:hover { background: #26479c; }

/* ---------- Кнопка «Записи участников»: отдельная, светло-зелёная ---------- */
.btn-bookings {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 11px 14px; border-radius: 10px; border: 1px solid #bfe6d1;
    background: #e2f5ec; color: #17734b; font-weight: 800; text-decoration: none;
}
.btn-bookings:hover { background: #cdeedd; color: #115c3b; }
.btn-count { min-width: 28px; padding: 2px 8px; border-radius: 999px; background: #fff; color: #17734b; text-align: center; font-size: 13px; }
.toolbar-actions .btn-bookings { width: auto; padding: 8px 14px; }
.card-actions { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Телефон ---------- */
.menu-toggle { display: none; }

@media (max-width: 900px) {
    /* Меню: верхняя полоса с логотипом и кнопкой ☰, пункты раскрываются списком */
    .sidebar { position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar-brand { padding: 12px 14px; flex: 1; }
    .menu-toggle {
        display: grid; place-items: center; order: 2; width: 44px; height: 44px; margin-right: 10px;
        border: 1px solid rgba(255, 255, 255, .2); border-radius: 10px; background: transparent; color: #fff;
        font-size: 22px; cursor: pointer;
    }
    .sidebar .menu, .sidebar .sidebar-footer { display: none; order: 3; flex: 0 0 100%; width: 100%; }
    .sidebar.open .menu { display: block; max-height: calc(100vh - 140px); overflow-y: auto; padding: 4px 10px 10px; }
    .sidebar.open .sidebar-footer { display: flex; }
    .sidebar.open .menu-group { display: block; margin-bottom: 10px; }
    .sidebar.open .menu-title { display: block; }
    .menu-item { padding: 12px 12px; font-size: 16px; }

    .content { padding: 14px 12px 40px; }
    .toolbar h1 { font-size: 22px; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions .btn, .toolbar-actions select { flex: 1 1 auto; }

    /* Удобно нажимать пальцем */
    .btn { min-height: 42px; }
    .btn-sm { min-height: 38px; padding: 8px 12px; font-size: 14px; }
    input, select, textarea { font-size: 16px; }

    .filters { padding: 12px; }
    .filters label, .filters .filter-wide { min-width: 0; flex: 1 1 140px; }
    .form-section { padding: 16px; }
    .form-footer { position: sticky; bottom: 0; z-index: 5; padding: 10px 0; background: var(--bg); }
    .form-footer .btn { flex: 1; }
    .card-footer { flex-direction: column; align-items: stretch; }
    .card-actions { justify-content: stretch; }
    .card-actions > * { flex: 1; }
    .stats { grid-template-columns: 1fr; }
}

/* Таблицы записей и пользователей на телефоне превращаются в карточки */
@media (max-width: 760px) {
    .responsive-table { background: none; box-shadow: none; border: 0; overflow: visible; }
    .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table thead { display: none; }
    .responsive-table tr {
        margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
    }
    .responsive-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; white-space: normal; text-align: right; }
    .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; flex: none; }
    .responsive-table td:empty, .responsive-table td[data-label]:not(:has(*)):empty { display: none; }
    .responsive-table td.cell-main { font-size: 17px; font-weight: 800; justify-content: flex-start; text-align: left; }
    .responsive-table td.cell-main::before { display: none; }
    .responsive-table td.actions { flex-wrap: wrap; justify-content: stretch; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
    .responsive-table td.actions > * { flex: 1 1 auto; margin: 0; }
    .responsive-table td.empty { justify-content: center; }
    .responsive-table td.empty::before { display: none; }
}

/* ---------- Реквизиты пользователя ---------- */
.pay-details { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.pay-details h3 { margin: 0 0 4px; font-size: 16px; }
.pay-details .hint { margin: 0 0 12px; }
.qr-picker { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 14px; }
.qr-preview {
    width: 140px; height: 140px; flex: none; display: grid; place-items: center; text-align: center;
    border: 2px dashed var(--border); border-radius: 12px; background: #fafcfd; color: var(--muted); font-size: 13px; overflow: hidden;
}
.qr-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.qr-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cover-error { padding: 10px; color: var(--danger); font-size: 13px; text-align: center; }

/* Галочка "Без возвратов" */
/* Окончание регистрации (раздел "Города и даты") */
.reg-close { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 16px; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: #fff4e0; border: 1px solid #f3dfc0; }
.reg-close label { font-weight: 600; }
.reg-close-input { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-weight: 500; }
.reg-close-input input { width: 90px; }
.reg-close .hint { flex: 1 1 260px; margin: 0; color: #8a5a00; }
.reg-close-at { color: #0b7f9e; font-weight: 600; }
.reg-close-at.is-closed { color: #c0392b; }

/* ---------- Настройки сайта ---------- */
.policy-editor { width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 12px; border: 1px solid var(--border); border-radius: 10px; resize: vertical; background: #fbfcfe; }
#settings-form code { padding: 1px 5px; border-radius: 5px; background: #eef3f5; font-size: 12px; }
.cell-sub { display: block; font-size: 12px; }

/* Excel-выгрузка и возврат в записях */
.btn-excel { background: #1d7a45; border-color: #1d7a45; color: #fff; }
.btn-excel:hover { background: #166238; border-color: #166238; color: #fff; }
.btn-refund { background: #f0eafd; border-color: #d9cbf7; color: #6a3fc1; }
.btn-refund:hover { background: #e3d7fb; color: #5530a8; }
.cell-note { display: block; margin-top: 4px; font-size: 12px; }

/* QR-билет в записях */
.btn-qr { background: #0b2e4a; color: #fff; }
.btn-qr:hover { background: #134466; color: #fff; }
.qr-box { width: min(560px, 100%); }
.qr-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr-body img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid #dcebea; background: #fff; flex: none; }
.qr-info { display: grid; gap: 6px; flex: 1 1 200px; min-width: 0; }
.qr-name { font-size: 18px; font-weight: 800; }
.qr-code { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 1px; word-break: break-all; }
.qr-checkin { font-weight: 700; }
.qr-checkin.is-free { color: var(--success); }
.qr-checkin.is-used { color: #b26b00; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
@media (max-width: 600px) { .qr-body { justify-content: center; } .qr-body img { width: 200px; height: 200px; } }
