/* Hall Builder — интерфейс конструктора и превью покупателя.
   Раскладка: верхняя панель / [инструменты | холст | свойства]; на телефоне холст сверху, панели снизу.
   Палитра: «чертёж» — холодный светлый фон с точечной сеткой, чернильные кнопки, оранжевый — выделение. */
.hb-app {
    --bg: #eef1f4;
    --panel: #ffffff;
    --panel-2: #f5f7f9;
    --fg: #17202b;
    --muted: #5d6877;
    --line: #dce1e7;
    --ink: #17202b;
    --ink-fg: #ffffff;
    --sel: #e4580b;
    --sel-soft: rgba(228, 88, 11, 0.14);
    --danger: #c23434;
    --ok: #217a4b;
    --canvas: #f8f9fb;
    --grid: #c9d0d9;
    --table: #ffffff;
    --sold: #cdd2d9;
    --stage: #222b36;
    --stage-fg: #f4f6f8;
    --decor: #e2e6eb;
    --decor-fg: #5d6877;
    --seat: #5a6a80;
    --zone: #6b5fa8;
    --shadow: 0 8px 28px rgba(23, 32, 43, 0.14);
    --font-ui: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;
    --r: 10px;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .hb-app {
        --bg: #0f1318;
        --panel: #171c23;
        --panel-2: #1d232b;
        --fg: #e7ebf0;
        --muted: #9aa4b2;
        --line: #2b333d;
        --ink: #e7ebf0;
        --ink-fg: #12161b;
        --sel: #ff8a3d;
        --sel-soft: rgba(255, 138, 61, 0.18);
        --danger: #f0716b;
        --ok: #5fd09a;
        --canvas: #12161c;
        --grid: #2a323c;
        --table: #232a33;
        --sold: #3a424d;
        --stage: #dfe4ea;
        --stage-fg: #151a20;
        --decor: #252c35;
        --decor-fg: #9aa4b2;
        --seat: #8a97ab;
        --zone: #a597e0;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
        color-scheme: dark;
    }
}
:root[data-theme='dark'] .hb-app {
    --bg: #0f1318;
    --panel: #171c23;
    --panel-2: #1d232b;
    --fg: #e7ebf0;
    --muted: #9aa4b2;
    --line: #2b333d;
    --ink: #e7ebf0;
    --ink-fg: #12161b;
    --sel: #ff8a3d;
    --sel-soft: rgba(255, 138, 61, 0.18);
    --danger: #f0716b;
    --ok: #5fd09a;
    --canvas: #12161c;
    --grid: #2a323c;
    --table: #232a33;
    --sold: #3a424d;
    --stage: #dfe4ea;
    --stage-fg: #151a20;
    --decor: #252c35;
    --decor-fg: #9aa4b2;
    --seat: #8a97ab;
    --zone: #a597e0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
}

.hb-app {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 480px;
    background: var(--bg);
    color: var(--fg);
    font: 14px/1.4 var(--font-ui);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}
:where(.hb-app) *,
:where(.hb-app) *::before,
:where(.hb-app) *::after {
    box-sizing: border-box;
}
:where(.hb-app) :where(button, input, select, textarea) {
    font: inherit;
    color: inherit;
}
.hb-app :focus-visible {
    outline: 2px solid var(--sel);
    outline-offset: 2px;
}
.num {
    font-variant-numeric: tabular-nums;
}
.hb-main {
    flex: 1;
    min-height: 0;
    display: flex;
}

/* ---------- верхняя панель ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--ink);
}
.bm-stage {
    fill: var(--ink-fg);
}
.bm-seat {
    fill: var(--sel);
}
.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.save-state {
    color: var(--muted);
    font-size: 12px;
    padding-left: 6px;
}

/* ---------- кнопки ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.45;
    cursor: default;
}
.btn-primary {
    background: var(--ink);
    color: var(--ink-fg);
}
.btn-primary:not(:disabled):hover {
    filter: brightness(1.15);
}
.btn-ghost {
    border-color: var(--line);
    background: var(--panel);
    justify-content: flex-start;
}
.btn-ghost:hover {
    background: var(--panel-2);
}
.btn-danger {
    color: var(--danger);
}
.btn-danger-solid {
    background: var(--danger);
    color: #fff;
}
.btn.wide {
    width: 100%;
}
.btn-float {
    background: var(--panel);
    border-color: var(--line);
    box-shadow: var(--shadow);
}
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--fg);
}
.icon-btn:hover:not(:disabled) {
    background: var(--panel-2);
}
.icon-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--panel-2);
    border: 1px solid var(--line);
}
.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 5px 10px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
}
.segmented button.on {
    background: var(--panel);
    color: var(--fg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    font-weight: 600;
}
.mode-switch button {
    padding: 6px 12px;
}

/* ---------- конструктор ---------- */
.editor {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 320px;
}
.toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}
.tb-sep {
    width: 26px;
    height: 1px;
    background: var(--line);
    margin: 4px 0;
}
.tool {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--fg);
}
.tool:hover {
    background: var(--panel-2);
}
.tool.on {
    background: var(--ink);
    color: var(--ink-fg);
}
.tool-key {
    position: absolute;
    right: 4px;
    bottom: 2px;
    font-size: 9px;
    opacity: 0.55;
}
.canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: var(--canvas);
    overflow: hidden;
}
.vp {
    position: absolute;
    inset: 0;
}
.vp-svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.grid-dot {
    fill: var(--grid);
}
.hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    max-width: min(560px, calc(100% - 32px));
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
    pointer-events: none;
    box-shadow: var(--shadow);
}
.hud {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.hud-k {
    min-width: 46px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.presets {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    width: max-content;
    max-width: calc(100% - 24px);
}
.presets button {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 5px 9px 5px 5px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--muted);
}
.presets button.on {
    background: var(--panel-2);
    color: var(--fg);
    box-shadow: inset 0 0 0 1.5px var(--ink);
}
.preset-glyph ellipse,
.preset-glyph rect:not(.dots rect) {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
}
.preset-glyph .dots rect {
    fill: currentColor;
}

/* элементы на холсте */
.it {
    cursor: pointer;
}
.seat {
    fill: var(--seat);
    stroke: rgba(0, 0, 0, 0.12);
    stroke-width: 0.8;
}
.seat-num {
    fill: #fff;
    font-weight: 600;
    pointer-events: none;
}
.seat-acc {
    fill: #fff;
    pointer-events: none;
}
.row-label {
    fill: var(--muted);
    font-weight: 600;
    pointer-events: none;
}
.sec-name {
    fill: var(--fg);
    font-weight: 700;
    pointer-events: none;
    letter-spacing: 0.02em;
}
.seat-sel {
    stroke: var(--sel) !important;
    stroke-width: 3.5 !important;
}
.seat-ghost,
.chair-ghost {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.2;
    stroke-dasharray: 3 2.5;
    cursor: pointer;
}
.seat-mode .it:not(.seat-editing) {
    opacity: 0.25;
    pointer-events: none;
}
.seat-editing .seat,
.seat-editing .chair {
    cursor: pointer;
}
.chair {
    fill: var(--seat);
    stroke: rgba(0, 0, 0, 0.15);
    stroke-width: 0.8;
}
.chair-whole {
    fill-opacity: 0.55;
}
.table-num {
    fill: var(--fg);
    font-weight: 700;
    pointer-events: none;
}
.stage-fill {
    fill: var(--stage);
}
.stage-text {
    fill: var(--stage-fg);
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.18em;
    pointer-events: none;
}
.zone-text {
    font-weight: 700;
    pointer-events: none;
}
.zone-sub {
    fill: var(--muted);
    font-weight: 500;
    pointer-events: none;
}
.decor-fill {
    fill: var(--decor);
    stroke: var(--line);
    stroke-width: 1.5;
}
.decor-text {
    fill: var(--decor-fg);
    font-weight: 600;
    pointer-events: none;
}
.label-text {
    fill: var(--muted);
    font-weight: 700;
    letter-spacing: 0.14em;
}
.sel-frame {
    fill: none;
    stroke: var(--sel);
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}
.sel-line {
    stroke: var(--sel);
    pointer-events: none;
}
.handle {
    fill: var(--panel);
    stroke: var(--sel);
}
.handle-rot {
    cursor: grab;
}
.handle-size {
    cursor: nwse-resize;
}
.marquee {
    fill: var(--sel-soft);
    stroke: var(--sel);
    pointer-events: none;
}

/* ---------- панель свойств ---------- */
.props {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--panel);
    border-left: 1px solid var(--line);
}
.props-head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
}
.props-head h2 {
    margin: 2px 0 0;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}
.eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.head-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12.5px;
}
.props-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.group {
    border-bottom: 1px solid var(--line);
    padding: 6px 0 10px;
}
.group > summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 0;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.group > summary::-webkit-details-marker {
    display: none;
}
.group > summary::before {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1.6px solid var(--muted);
    border-bottom: 1.6px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s;
}
.group[open] > summary::before {
    transform: rotate(45deg);
}
.group-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.field-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.field-hint,
.note {
    font-size: 11.5px;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
}
.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.num-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.num-row input[type='range'] {
    flex: 1;
    min-width: 0;
    accent-color: var(--ink);
}
.num-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
.num-row:not(:has(input[type='range'])) .num-box {
    flex: 1;
}
.hb-app .num-box input,
.hb-app .text-input,
.hb-app .select-input {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 4px 8px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    font-variant-numeric: tabular-nums;
}
.hb-app .num-box input {
    width: 72px;
    line-height: normal;
    min-height: 0;
    box-shadow: none;
}
.hb-app .num-row:not(:has(input[type='range'])) .num-box input {
    width: 100%;
}
.num-suffix {
    position: absolute;
    right: 8px;
    color: var(--muted);
    font-size: 12px;
    pointer-events: none;
}
.hb-app .text-input:focus,
.hb-app .num-box input:focus,
.hb-app .select-input:focus {
    border-color: var(--ink);
    background: var(--panel);
    outline: none;
}
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}
.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.toggle-track {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: var(--line);
    transition: background 0.15s;
    flex: none;
}
.toggle-track::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--panel);
    transition: transform 0.15s;
}
.toggle input:checked + .toggle-track {
    background: var(--ink);
}
.toggle input:checked + .toggle-track::after {
    transform: translateX(14px);
}
.toggle input:focus-visible + .toggle-track {
    outline: 2px solid var(--sel);
    outline-offset: 2px;
}
.actions,
.btn-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
}
.icon-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.stats div {
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-radius: 8px;
    background: var(--panel-2);
}
.stats b {
    font-size: 17px;
}
.stats span {
    font-size: 11px;
    color: var(--muted);
}
.cat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cat-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 62px 34px 28px;
    gap: 6px;
    align-items: center;
}
.cat-row input[type='color'] {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: none;
    cursor: pointer;
}
.cat-row input[type='color']::-webkit-color-swatch-wrapper {
    padding: 2px;
}
.cat-row input[type='color']::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}
.cat-row .price {
    text-align: right;
}
.cat-count {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}
.cat-row .icon-btn {
    width: 28px;
    height: 28px;
}
.issues {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.issues button {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 7px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12.5px;
}
.issues .error button {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
}
.issues .warn button {
    background: var(--panel-2);
    color: var(--muted);
}
.ok-line {
    margin: 0;
    color: var(--ok);
    font-size: 12.5px;
}
.tips {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    background: var(--panel-2);
    font-size: 13px;
}

/* ---------- просмотр покупателя ---------- */
.viewer {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.v-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    padding: 10px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.v-event h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
    font-size: 12.5px;
}
.chip i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.chip b {
    font-weight: 600;
}
.chip.on {
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}
.chip.off {
    opacity: 0.5;
}
.v-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
}
.v-canvas {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--canvas);
    overflow: hidden;
}
.v-top {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
}
.crumb {
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    font-weight: 600;
    font-size: 13px;
}
.crumb.muted {
    font-weight: 500;
    color: var(--muted);
}
.v-hud {
    left: auto;
    right: 12px;
    top: 12px;
    bottom: auto;
}
.viewer.wide.has-cart .v-hud {
    right: 352px;
}
.v-key {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.v-key span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.v-key i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.k-free {
    background: var(--muted);
}
.k-picked {
    background: var(--sel);
}
.k-sold {
    background: var(--sold);
}
.v-hull {
    cursor: pointer;
}
.v-sec:not(.seats-on) .v-hull:hover {
    filter: brightness(1.08) saturate(1.1);
}
.v-sec.dim,
.v-table.dim,
.v-zone.dim {
    opacity: 0.28;
}
.v-sec {
    transition: opacity 0.2s;
}
.v-sec-name {
    fill: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.18);
    stroke-width: 3px;
}
.v-sec-sub {
    fill: #fff;
    font-weight: 600;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.18);
    stroke-width: 2px;
}
.v-seat {
    cursor: pointer;
    stroke: rgba(0, 0, 0, 0.12);
    stroke-width: 0.8;
}
.v-seat:hover {
    stroke: var(--fg);
    stroke-width: 2.5;
}
.v-seat.sold {
    fill: var(--sold);
    cursor: default;
    stroke: none;
}
.v-seat.picked {
    fill: var(--sel);
    stroke: var(--panel);
    stroke-width: 2.5;
}
.seat-num.on {
    fill: #fff;
}
.v-chair {
    cursor: pointer;
    stroke: rgba(0, 0, 0, 0.15);
    stroke-width: 0.8;
}
.v-chair:hover {
    stroke: var(--fg);
    stroke-width: 2;
}
.v-chair.sold {
    fill: var(--sold);
    stroke: none;
    cursor: default;
}
.v-chair.picked {
    fill: var(--sel);
    stroke: var(--panel);
    stroke-width: 2;
}
.v-table.whole [data-item] {
    cursor: pointer;
}
.v-table.whole [data-item]:hover {
    filter: brightness(1.08);
}
.table-num.on {
    fill: #fff;
}
.v-zone [data-item] {
    cursor: pointer;
}
.v-zone [data-item]:hover {
    filter: brightness(1.06);
}
.tip {
    position: absolute;
    transform: translate(14px, 14px);
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 260px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--ink-fg);
    font-size: 12.5px;
    pointer-events: none;
    box-shadow: var(--shadow);
    z-index: 3;
}
.tip span {
    opacity: 0.75;
}

.cart {
    position: absolute;
    z-index: 4;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.viewer.wide .cart {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 328px;
    border-radius: 14px;
}
.viewer.wide .cart-bar {
    display: none;
}
.viewer:not(.wide) .cart {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 14px 14px 0 0;
    max-height: 92%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Мобильная корзина: плавно раскрываем и сворачиваем список, а не display:none */
.viewer:not(.wide) .cart {
    animation: cart-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* Мобильная корзина — один блок: шапка, середина (список + итого), кнопка.
   Открытие: середина плавно растёт по высоте, весь блок поднимается вверх целиком (шапка едет вместе с ним). */
.cart-head {
    display: none;
}
.viewer:not(.wide) .cart-head {
    display: flex;
    padding: 12px 16px 0;
}
.viewer:not(.wide) .cart-mid {
    overflow: hidden;
    transition: height 0.36s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.viewer:not(.wide) .cart.open .cart-mid {
    overflow-y: auto;
}
.viewer:not(.wide) .cart-body {
    padding-top: 10px;
}
.viewer:not(.wide) .cart:not(.open) .cart-body {
    gap: 0;
}
.viewer:not(.wide) .cart-mid-in {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
}
.viewer.wide .cart-mid,
.viewer.wide .cart-mid-in {
    display: contents;
}
@keyframes cart-in {
    from {
        transform: translateY(100%);
    }
}
@media (prefers-reduced-motion: reduce) {
    .viewer:not(.wide) .cart,
    .viewer:not(.wide) .cart-mid {
        animation: none;
        transition: none;
    }
}
.viewer:not(.wide) .v-key {
    bottom: 76px;
}
.cart-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
}
.cart-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}
.cart-bar-row > .cart-bar-text {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-bar-row > .cart-bar-text b {
    color: var(--fg);
    font-weight: 700;
    margin-right: 4px;
}
.cart-bar-row > svg {
    flex: 0 0 auto;
}
.cart-bar-sum {
    font-size: 18px;
    font-weight: 700;
}
.cart-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}
.cart-body h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
}
.empty {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}
.lines li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.lines li > i {
    flex: none;
    width: 8px;
    align-self: stretch;
    border-radius: 4px;
}
.l-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.l-main b {
    font-weight: 600;
    font-size: 13px;
}
.l-main span {
    font-size: 12px;
    color: var(--muted);
}
.l-price {
    font-weight: 600;
    white-space: nowrap;
}
/* колонки строки корзины ровные: «− N +» у всех зон на одной вертикали, цена справа одинаковой ширины */
.lines .qty {
    flex: none;
}
.lines .qty .num {
    min-width: 22px;
    text-align: center;
}
.lines .l-price {
    flex: none;
    min-width: 76px;
    text-align: right;
}
.lines .icon-btn {
    width: 26px;
    height: 26px;
}
.qty {
    display: flex;
    align-items: center;
    gap: 4px;
}
.qty button {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    cursor: pointer;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    color: var(--muted);
}
.cart-total b {
    font-size: 20px;
    color: var(--fg);
}

/* ---------- модалка / тост ---------- */
.modal-back {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(10, 14, 20, 0.45);
}
.modal {
    width: min(720px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.modal header,
.modal footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.modal footer {
    justify-content: flex-end;
}
.modal h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
}
.modal textarea {
    width: 100%;
    min-height: 280px;
    flex: 1;
    resize: vertical;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    font: 12px/1.45 ui-monospace, 'JetBrains Mono', Consolas, monospace;
}
.error {
    margin: 0;
    color: var(--danger);
    font-size: 13px;
}
.toast-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 70px;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 30;
}
.toast {
    padding: 9px 14px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--ink-fg);
    font-size: 13px;
    box-shadow: var(--shadow);
}

/* ---------- узкие экраны ---------- */
@media (max-width: 900px) {
    .editor {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto auto;
    }
    .canvas-wrap {
        grid-row: 1;
    }
    .toolbar {
        grid-row: 2;
        flex-direction: row;
        overflow-x: auto;
        border-right: 0;
        border-top: 1px solid var(--line);
        padding: 6px 10px;
    }
    .tb-sep {
        width: 1px;
        height: 26px;
        margin: 0 4px;
    }
    .props {
        grid-row: 3;
        max-height: 42vh;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .props-head {
        padding: 10px 16px 8px;
    }
    .hint {
        display: none;
    }
    .brand-name {
        display: none;
    }
    .save-state {
        display: none;
    }
    .legend {
        margin-left: 0;
    }
}
@media (max-width: 520px) {
    .mode-switch span {
        display: none;
    }
    .v-head {
        padding: 8px 12px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hb-app * {
        transition: none !important;
    }
}

/* ---------- совместимость со стилями WP admin ---------- */
.hb-app li {
    margin-bottom: 0;
}
.hb-app .text-input,
.hb-app .select-input {
    line-height: normal;
    min-height: 0;
    box-shadow: none;
    max-width: none;
}
.hb-app .select-input {
    padding-right: 24px;
}
.hb-app a.icon-btn {
    text-decoration: none;
}
.hb-app input[type='range'] {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}
.hb-app h2,
.hb-app h3 {
    color: inherit;
}

.empty-state {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: min(380px, calc(100% - 32px));
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--panel);
    border: 1px dashed var(--line);
    text-align: center;
    color: var(--muted);
    pointer-events: none;
}
.empty-state b {
    color: var(--fg);
    font-family: var(--font-display);
    font-weight: 600;
}

/* ---------- без билетов / зоны столов ---------- */
.v-seat.neutral,
.v-chair.neutral {
    fill: var(--seat);
}
.v-seat.off,
.v-chair.off {
    fill: none;
    stroke: var(--sold);
    stroke-width: 1.2;
    stroke-dasharray: 2.5 2;
    cursor: default;
}
.v-seat.faded,
.v-chair.faded {
    /* фильтр по цене: места другой цены — серые */
    fill: var(--sold) !important;
    stroke: none;
    opacity: 0.7;
}
.v-sec-name.plain,
.v-sec-sub.plain {
    fill: var(--fg);
    stroke: none;
}
.v-sec-sub.plain {
    opacity: 0.72;
}
.v-group {
    cursor: pointer;
    transition: opacity 0.2s;
}
.v-group:hover {
    filter: brightness(1.08) saturate(1.1);
}
.v-group.dim {
    opacity: 0.28;
}
.v-group .v-sec-name {
    font-family: var(--font-display);
    font-weight: 600;
}
.group-outline {
    cursor: pointer;
}
.group-line {
    fill: none;
    stroke: var(--seat);
    stroke-dasharray: 8 6;
    opacity: 0.55;
    pointer-events: none;
}
.group-outline.no-collapse .group-line {
    stroke-dasharray: 2 5;
}
.group-name {
    fill: var(--muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    pointer-events: all;
}
.group-hit {
    fill: none;
    stroke: transparent;
    pointer-events: stroke;
}
.group-outline:hover .group-line {
    opacity: 1;
}
.stage-note {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--panel-2);
    border: 1px dashed var(--line);
}
.v-head .segmented button {
    font-size: 12.5px;
}

.decor-outline {
    fill: none;
    stroke: var(--muted);
    stroke-width: 3;
    opacity: 0.6;
}

/* заготовки многоугольника */
.poly-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.poly-presets button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    cursor: pointer;
}
.poly-presets button:hover {
    color: var(--fg);
    border-color: var(--ink);
}
.poly-presets polygon {
    fill: currentColor;
    fill-opacity: 0.18;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linejoin: round;
}
/* углы многоугольника на холсте */
.handle-vertex {
    fill: var(--panel);
    stroke: var(--sel);
    cursor: move;
}
.handle-vertex:hover {
    fill: var(--sel);
}
.handle-add {
    fill: var(--panel);
    stroke: var(--sel);
    stroke-dasharray: 2 1.5;
    cursor: copy;
    opacity: 0.85;
}
.handle-add-plus {
    fill: var(--sel);
    pointer-events: none;
}
.poly-edge {
    fill: none;
    stroke: var(--sel);
    pointer-events: none;
}

/* линии (борт арены, ограждения) */
.line-ink {
    fill: none;
    stroke: var(--line-ink, #8a939e);
    stroke-linejoin: round;
    stroke-linecap: round;
}
.line-gap {
    fill: none;
    stroke: var(--canvas);
    stroke-linejoin: round;
    stroke-linecap: butt;
}
.line-hit {
    fill: none;
    stroke: transparent;
    pointer-events: stroke;
}
.it-line.sel .line-ink {
    stroke: var(--sel);
}
/* рамка секции с билетами (у покупателя, при приближении) */
.v-frame {
    fill: none;
    stroke-linejoin: round;
    pointer-events: none;
}
.v-frame-gap {
    fill: var(--canvas);
    stroke: var(--canvas);
}
.contour-edge {
    fill: none;
    stroke: var(--canvas);
    stroke-linejoin: round;
    pointer-events: none;
}

/* ---------- справка ---------- */
.help-btn {
    gap: 6px;
}
.modal.help {
    width: min(1000px, 100%);
    height: min(86vh, 820px);
    padding: 0;
    gap: 0;
    overflow: hidden;
}
.modal.help > header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.help-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 250px 1fr;
}
.help-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    border-right: 1px solid var(--line);
    background: var(--panel-2);
    overflow-y: auto;
}
.help-search {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--fg);
    font: inherit;
    font-size: 13px;
}
.help-nav button {
    text-align: left;
    border: 0;
    background: none;
    padding: 8px 10px;
    border-radius: 8px;
    font: inherit;
    font-size: 13.5px;
    color: var(--muted);
    cursor: pointer;
}
.help-nav button:hover {
    color: var(--fg);
    background: var(--panel);
}
.help-nav button.on {
    color: var(--fg);
    background: var(--panel);
    box-shadow: inset 3px 0 0 var(--sel);
    font-weight: 600;
}
.help-article {
    overflow-y: auto;
    padding: 20px 28px 28px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--fg);
}
.help-article h2 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
}
.help-article h4 {
    margin: 18px 0 6px;
    font-size: 14px;
    font-weight: 700;
}
.help-article p {
    margin: 0 0 10px;
    max-width: 68ch;
}
.help-article ul,
.help-article ol {
    margin: 0 0 10px;
    padding-left: 20px;
    max-width: 68ch;
}
.help-article li {
    margin-bottom: 5px;
}
.help-article code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--panel-2);
    font-size: 12.5px;
}
.help-article kbd {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--panel);
    font: 600 12px/20px var(--font-ui);
    text-align: center;
    white-space: nowrap;
}
.help-steps li::marker {
    font-weight: 700;
}
.help-tip {
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--sel);
    background: var(--sel-soft);
    font-size: 13.5px;
}
.help-glyphs {
    display: flex;
    gap: 6px;
    color: var(--muted);
}
.help-glyphs polygon {
    fill: currentColor;
    fill-opacity: 0.18;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linejoin: round;
}
.help-keys {
    border-collapse: collapse;
    width: 100%;
    max-width: 640px;
}
.help-keys td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.help-keys td:first-child {
    width: 46%;
}
.help-next {
    margin-top: 14px;
}
@media (max-width: 700px) {
    .help-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .help-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .help-search {
        margin: 0 6px 0 0;
        min-width: 150px;
    }
    .help-nav button {
        white-space: nowrap;
    }
    .help-nav button.on {
        box-shadow: inset 0 -2px 0 var(--sel);
    }
    .help-btn span {
        display: none;
    }
    .help-article {
        padding: 16px;
    }
}

/* умные направляющие */
.hud-sep {
    width: 1px;
    height: 20px;
    margin: 0 3px;
    background: var(--line);
}
.hud .icon-btn.on {
    color: var(--guide);
    background: var(--guide-soft);
}
.hb-app {
    --guide: #e5398f;
    --guide-soft: rgba(229, 57, 143, 0.12);
}
.guide-line {
    stroke: var(--guide);
    pointer-events: none;
}
.guide-dot {
    fill: var(--guide);
    pointer-events: none;
}
/* в правке мест номер ряда кликабелен — выбрать весь ряд */
.row-label.row-pick {
    pointer-events: auto;
    cursor: pointer;
    fill: var(--sel);
    text-decoration: underline;
}
/* быстрый выбор нумерации */
.num-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 5px;
}
.num-presets button {
    min-width: 28px;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--muted);
    font: 600 12px/18px var(--font-ui);
    cursor: pointer;
}
.num-presets button:hover {
    color: var(--fg);
    border-color: var(--ink);
}
.num-presets button.on {
    color: var(--ink-fg);
    background: var(--ink);
    border-color: var(--ink);
}
.num-preview {
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.field.numbering > .field {
    margin: 0;
}
.save-state.save-error {
    color: var(--danger);
    font-weight: 600;
}

/* картинка схемы (PNG): всегда светлая тема, даже если интерфейс тёмный */
.hb-app .hb-export {
    --bg: #eef1f4;
    --panel: #ffffff;
    --panel-2: #f5f7f9;
    --fg: #17202b;
    --muted: #5d6877;
    --line: #dce1e7;
    --ink: #17202b;
    --ink-fg: #ffffff;
    --sel: #e4580b;
    --sel-soft: rgba(228, 88, 11, 0.14);
    --danger: #c23434;
    --ok: #217a4b;
    --canvas: #f8f9fb;
    --grid: #c9d0d9;
    --table: #ffffff;
    --sold: #cdd2d9;
    --stage: #222b36;
    --stage-fg: #f4f6f8;
    --decor: #e2e6eb;
    --decor-fg: #5d6877;
    --seat: #5a6a80;
    --zone: #6b5fa8;
    --shadow: 0 8px 28px rgba(23, 32, 43, 0.14);
    --font-ui: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;
    --r: 10px;
    --canvas: #ffffff;
}

/* кнопка «PNG» и её меню */
.png-menu {
    position: relative;
}
.png-pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 25;
    width: 290px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.png-pop button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    text-align: left;
    font: inherit;
    color: var(--fg);
    cursor: pointer;
}
.png-pop button:hover,
.png-pop button:focus-visible {
    background: var(--panel-2);
}
.png-pop b {
    font-size: 13.5px;
    font-weight: 600;
}
.png-pop span {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- редактор билетов на схеме (страница события, режим editor) ---------- */
.te {
    flex: 1;
    min-height: 0;
    display: flex;
}
.te-canvas {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--canvas);
    overflow: hidden;
}
.te-canvas .vp {
    position: absolute;
    inset: 0;
}
.te-panel {
    width: 360px;
    flex: 0 0 360px;
    position: relative;
}
.te-hud {
    left: 12px;
    bottom: 12px;
}
.te-seat {
    cursor: pointer;
    stroke-width: 1;
}
.te-seat.none {
    fill: var(--panel);
    stroke: var(--seat);
    stroke-dasharray: 2 1.6;
}
.te-seat.available {
    stroke: rgba(0, 0, 0, 0.18);
}
.te-seat.reserved {
    fill-opacity: 0.35;
    stroke: var(--fg);
    stroke-width: 1.4;
    stroke-dasharray: 2 1.6;
}
.te-seat.sold {
    fill: var(--te-sold);
    stroke: none;
}
:root {
    --te-sold: #111;
    --te-booked: #d62828;
}
.te-seat.booked {
    fill: var(--te-booked);
    stroke: none;
}
.te-breakdown .booked {
    color: var(--te-booked);
    font-weight: 600;
}
.te-locked {
    color: var(--te-booked);
}
.te-tip {
    gap: 2px;
    max-width: 280px;
    padding: 9px 12px;
    font-size: 12.5px;
    line-height: 1.35;
}
.te-tip.fx {
    transform: translate(calc(-100% - 14px), 14px);
}
.te-tip.fy {
    transform: translate(14px, calc(-100% - 14px));
}
.te-tip.fx.fy {
    transform: translate(calc(-100% - 14px), calc(-100% - 14px));
}
.te-tip > b {
    font-size: 13.5px;
}
.te-tip .tt-row {
    display: flex;
    flex-direction: column;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid color-mix(in srgb, var(--ink-fg) 16%, transparent);
}
.te-tip .tt-row em {
    font-style: normal;
    font-size: 11px;
    opacity: 0.6;
}
.te-tip .tt-row b {
    font-weight: 600;
    word-break: break-word;
}
.te-tip .tt-row span {
    opacity: 0.75;
    overflow-wrap: anywhere;
}
.te-tip .tt-row.warn b {
    color: #e8590c;
}
.te-seat.bundle {
    stroke: var(--fg);
    stroke-width: 1.2;
}
.te-seat:hover {
    stroke: var(--fg);
    stroke-width: 2.4;
}
.te-seat.sel {
    stroke: var(--sel);
    stroke-width: 3.2;
    stroke-dasharray: none;
}
.te-num {
    fill: var(--muted);
    font-weight: 600;
}
.te-num.on {
    fill: #fff;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.25);
    stroke-width: 1.5px;
}
.te-hull {
    cursor: pointer;
}
.te-row {
    cursor: pointer;
}
.te-row-hit {
    fill: transparent;
}
.te-row:hover .te-row-hit {
    fill: var(--sel-soft);
}
.te-tbody {
    cursor: pointer;
}
.te-tbody:hover {
    filter: brightness(1.06);
}
.te-zone [data-cell] {
    cursor: pointer;
}
.te-zone.sel path,
.te-zone.sel rect,
.te-zone.sel ellipse {
    stroke: var(--sel);
    stroke-width: 3;
}
.marquee.te-minus {
    stroke: var(--danger);
}
.te-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}
.te-breakdown .sold {
    color: var(--fg);
    font-weight: 600;
}
.te-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.te-block h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}
.te-block > summary {
    cursor: pointer;
    list-style: none;
}
.te-block > summary::-webkit-details-marker {
    display: none;
}
.te-input {
    position: relative;
    display: flex;
}
.te-input i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-style: normal;
    color: var(--muted);
    pointer-events: none;
}
.hb-app .te-panel .text-input {
    height: 38px;
    font-size: 15px;
}
.te-panel .btn.wide {
    width: 100%;
}
.te-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.te-actions .btn {
    justify-content: center;
}
.te-confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
}
.te-confirm span {
    flex: 1 1 100%;
    font-weight: 600;
}
.te-kbd {
    margin-left: auto;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 11px;
    color: var(--muted);
}
.te-stats {
    margin-top: 10px;
}
.te-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.te-price {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--fg);
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.te-price:hover {
    border-color: var(--ink);
}
.te-price i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}
.te-price span {
    justify-self: end;
    color: var(--muted);
    font-size: 12px;
}
.te-olist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}
.te-orow {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
}
.te-orow i {
    flex: 0 0 10px;
    height: 10px;
    margin-top: 4px;
    border-radius: 50%;
}
.te-orow span {
    color: var(--muted);
    font-size: 11.5px;
}
.te-msg {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--ink-fg);
    font-size: 13px;
    box-shadow: var(--shadow);
}
.te-msg.error {
    background: var(--danger);
    color: #fff;
}
@media (max-width: 900px) {
    .te {
        flex-direction: column;
    }
    .te-panel {
        width: auto;
        flex: 0 0 auto;
        max-height: 48vh;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
}
.te-price-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.te-price-row .te-input {
    flex: 1;
}
.te-color {
    position: relative;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--panel);
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
    overflow: hidden;
}
.te-color:hover {
    box-shadow: 0 0 0 2px var(--ink);
}
.te-color.auto {
    background: conic-gradient(#e5398f, #ff8c00, #e5ea08, #15d637, #1e90ff, #9400d3, #e5398f);
}
.te-color input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
}
.te-price .te-color {
    width: 22px;
    height: 22px;
}
.te-price > button {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}
.te-price > button span {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}
.te-cp {
    position: relative;
    flex: 0 0 auto;
    display: flex;
}
button.te-color {
    padding: 0;
}
.te-cp-pop {
    position: fixed;
    z-index: 50;
    width: 262px;
    padding: 12px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.te-cp-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}
.te-cp-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}
.te-cp-sw {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.te-cp-sw:hover {
    transform: scale(1.12);
}
.te-cp-sw.on {
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink);
}
.te-cp-sw.used::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.te-cp-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--muted);
}
.te-cp-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.te-cp-row .btn {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12.5px;
}
.te-cp-custom {
    position: relative;
    flex: 1;
    overflow: hidden;
    cursor: pointer;
}
.te-cp-custom input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.te-cp-cdot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
/* шапка страницы схемы события: одна строка на любом экране, название — обрезается многоточием */
.te-topbar {
    flex-wrap: nowrap;
}
.te-head {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
}
.te-head-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--fg);
}
@media (max-width: 700px) {
    .te-topbar .brand {
        display: none;
    }
    .te-head {
        justify-content: flex-start;
        margin-left: 0;
    }
}

.te-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- схема для покупателя (режимы view / purchase) ---------- */
/* шапка как на старой схеме: чёрная полоса, стрелка назад, «<b>Название</b> — дата, зал адрес, город» */
.client-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 16px 8px 8px;
    background: #000;
    color: #fff;
}
.client-back {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #fff;
}
.client-back:hover {
    background: rgba(255, 255, 255, 0.12);
}
.client-bar .event-details {
    min-width: 0;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.client-bar .event-details b {
    font-weight: 700;
}
.v-head.v-head-client {
    padding: 8px 0;
    gap: 0;
}
.v-head-client .price-slider {
    width: 100%;
}
/* цены одной строкой, листаются */
.price-slider {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
}
.ps-track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    padding: 2px 16px;
    -webkit-overflow-scrolling: touch;
}
.ps-track::-webkit-scrollbar {
    display: none;
}
.price-slider.at-left .ps-track {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px);
    mask-image: linear-gradient(90deg, transparent 0, #000 48px);
}
.price-slider.at-right .ps-track {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%);
}
.price-slider.at-left.at-right .ps-track {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}
.ps-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--fg);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.ps-chip i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.ps-chip b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ps-chip:hover {
    border-color: var(--ink);
}
.ps-chip.on {
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}
.ps-chip.off {
    opacity: 0.45;
}
.ps-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--fg);
    box-shadow: var(--shadow);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.ps-arrow.left {
    left: 6px;
}
.ps-arrow.right {
    right: 6px;
}
@media (hover: none) {
    .ps-arrow {
        display: none;
    }
}

/* таймер брони в корзине (как на старой схеме: часики + время, заметно) */
.cart-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: #7b2cbf;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.cart-timer b {
    font-weight: 800;
}
.cart-timer.urgent {
    color: var(--danger);
    animation: cart-timer-blink 1s steps(2, start) infinite;
}
@keyframes cart-timer-blink {
    to {
        opacity: 0.45;
    }
}
.cart-bar .cart-timer {
    margin-left: 8px;
}
.cart-body h3:has(.cart-timer) {
    display: flex;
    align-items: center;
}
.cart-body h3 .cart-timer {
    margin-left: auto;
}
@media (prefers-reduced-motion: reduce) {
    .cart-timer.urgent {
        animation: none;
    }
}

/* «Ожидайте…» в точке клика, пока сервер бронирует (заметнее, чем на старой схеме) */
.v-wait {
    position: absolute;
    z-index: 5;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.v-wait-pulse,
.v-wait-ring {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
/* мягкая волна от места */
.v-wait-pulse {
    width: 56px;
    height: 56px;
    background: rgba(123, 44, 191, 0.25);
    animation: v-wait-pulse 1.1s ease-out infinite;
}
/* кольцо вокруг места */
.v-wait-ring {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(123, 44, 191, 0.2);
    border-top-color: #7b2cbf;
    animation: v-wait-spin 0.7s linear infinite;
}
/* карточка с текстом под местом */
.v-wait-card {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, calc(-100% - 14px));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: v-wait-in 0.15s ease-out;
}
.v-wait-dots {
    display: inline-flex;
    gap: 3px;
}
.v-wait-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: v-wait-dot 0.9s ease-in-out infinite;
}
.v-wait-dots i:nth-child(2) {
    animation-delay: 0.15s;
}
.v-wait-dots i:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes v-wait-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
@keyframes v-wait-pulse {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0;
    }
}
@keyframes v-wait-dot {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}
@keyframes v-wait-in {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 8px));
    }
}
@media (prefers-reduced-motion: reduce) {
    .v-wait-pulse,
    .v-wait-dots i {
        animation: none;
    }
}

/* корзина: билеты другого мероприятия */
.cart-foreign {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.cf-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--muted);
}
.cf-head b {
    margin-left: auto;
    color: var(--fg);
    font-size: 16px;
}
.cart-foreign p {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--panel);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
}
/* сообщение сервера у покупателя (как на старой схеме) */
.client-toast {
    position: fixed;
    top: 64px;
    right: 16px;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 380px;
    padding: 14px 36px 14px 14px;
    border-radius: 8px;
    background: #fde8ea;
    color: #3b1d22;
    font-size: 13.5px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.client-toast svg {
    flex: 0 0 auto;
    color: #e5484d;
    margin-top: 1px;
}
.client-toast button {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    background: none;
    color: #8a6b70;
    font-size: 18px;
    cursor: pointer;
}
@media (max-width: 600px) {
    .client-toast {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* цвет в свойствах конструктора (цвет фигуры на обзоре) */
.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-swatch {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line);
    cursor: pointer;
    overflow: hidden;
    flex: 0 0 auto;
}
.color-swatch.auto {
    background: repeating-linear-gradient(45deg, var(--panel-2) 0 6px, var(--line) 6px 12px);
}
.color-swatch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.color-row .btn {
    margin-left: auto;
    min-height: 30px;
    padding: 4px 10px;
}

/* пока сервер отвечает — курсор «ожидание», клики по схеме не принимаются */
.v-canvas.is-busy,
.v-canvas.is-busy * {
    cursor: progress !important;
}

/* Корзина во время запроса: фон остаётся непрозрачным, гасим только содержимое */
.cart.is-busy {
    pointer-events: none;
}
.cart.is-busy .cart-body > *,
.cart.is-busy .cart-bar > * {
    opacity: 0.55;
    transition: opacity 0.15s;
}
/* На мобиле таймер уже есть в плашке корзины — заголовок «Ваш выбор» с часами не дублируем */
.viewer:not(.wide) .cart-body h3 {
    display: none;
}

/* Отступ области стола (TableItem.pad): невидимая зона клика; в конструкторе у выделенного — пунктир */
.pad-hit {
    fill: transparent;
    stroke: none;
    pointer-events: all;
}
.it-table.sel .pad-hit {
    fill: var(--sel);
    fill-opacity: 0.05;
    stroke: var(--sel);
    stroke-opacity: 0.55;
    stroke-dasharray: 5 4;
    stroke-width: 1.2;
}
.note.warn {
    color: #c2410c;
}
.v-cover {
    cursor: pointer;
}
/* Конструктор: фигуру «только контур» можно выбрать кликом внутри, а не только по тонкой рамке */
.it-shape .decor-outline {
    pointer-events: all;
}

/* Панель заказа в редакторе билетов */
.te-buyer {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
}
.te-buyer b {
    font-size: 14px;
}
.te-buyer a {
    color: var(--fg);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.te-buyer a:hover {
    text-decoration: underline;
}
.te-buyer span {
    color: var(--muted);
}
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* «Не на схеме» — сразу заметно: красная рамка блока и метка */
.te-orphans {
    margin: 12px 0;
    padding: 10px 12px;
    border: 2px solid var(--te-booked, #d62828);
    border-radius: 10px;
    background: color-mix(in srgb, var(--te-booked, #d62828) 6%, transparent);
}
.te-orphans > summary h3 {
    color: var(--te-booked, #d62828);
}
.te-off-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid var(--te-booked, #d62828);
    border-radius: 6px;
    color: var(--te-booked, #d62828);
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
}
.te-cart-left {
    color: #7b2cbf;
    font-variant-numeric: tabular-nums;
}
.te-cart-left.urgent,
.te-cart-left.over {
    color: var(--te-booked, #d62828);
}

/* «Подпись не совпадает со схемой» — заметно, но не так тревожно, как «не на схеме» */
.te-relabel {
    margin: 12px 0;
    padding: 10px 12px;
    border: 2px solid #e8590c;
    border-radius: 10px;
    background: color-mix(in srgb, #e8590c 6%, transparent);
}
.te-relabel > summary h3 {
    color: #c2410c;
}
.te-diff {
    color: var(--te-booked, #d62828);
    font-weight: 700;
}
.te-ids {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    color: var(--muted);
    overflow-wrap: anywhere;
    user-select: all;
}
.te-sync {
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 11px;
    color: var(--muted);
    pointer-events: none;
}
.te-panel .props-scroll {
    padding-bottom: 28px;
}



/* мобильная плашка: таймер посередине строки «N билетов в корзине · таймер · сумма» */
.cart-bar-row .cart-timer {
    flex: none;
    margin: 0 auto;
}
.cart-bar-row > .cart-bar-text {
    flex: 0 1 auto;
}
.viewer.wide .lines .l-price {
    min-width: 62px;
}

/* Мобильная корзина: без синей подсветки/выделения при тапе */
.cart button,
.cart-bar-row {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}
.cart-bar-row:focus:not(:focus-visible) {
    outline: none;
}
.viewer.wide .cart-head {
    display: none;
}
