/* Рассадка · Зал №2 — тема «лоцманская карта»: речной синий, бумага, латунь. */
:root {
  --ink: #14283a;        /* речной синий — рейка, текст, стены */
  --ink-2: #1e3a52;
  --ink-soft: #51606e;   /* подписи: контраст к бумаге ≥ 5:1 — читается и на солнце */
  --paper: #f4efe4;      /* бумага карточек */
  --chart: #e7e0d1;      /* фон холста */
  --floor: #fbf8f1;
  --line: #d9d0bd;
  --brass: #b5883a;      /* латунь — главный стол, акценты */
  --brass-soft: #f6e9cc;
  --teal: #1d6f6b;       /* выделение */
  --teal-soft: #d6ebe8;
  --coral: #c24e36;      /* ошибки — крупно и на плашках */
  --coral-ink: #a63a23;  /* тот же красный для мелкого текста: контраст выше 4.5:1 */
  --amber: #cf8f22;      /* предупреждения */
  --magnet: #d2386c;     /* магниты */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(20, 40, 58, .14), 0 1px 3px rgba(20, 40, 58, .08);
  --font-ui: "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--chart); color: var(--ink); font: 14px/1.4 var(--font-ui); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app { display: grid; grid-template-columns: 84px 1fr; height: 100dvh; position: relative; overflow: hidden; }

/* ============ рейка инструментов ============ */
.rail { background: var(--ink); color: var(--paper); display: flex; flex-direction: column; align-items: stretch;
  padding: 10px 8px; gap: 4px; overflow-y: auto; z-index: 3; }
.mark { display: flex; flex-direction: column; align-items: center; padding: 6px 0 12px; margin-bottom: 4px;
  border-bottom: 1px solid rgba(244, 239, 228, .14); }
.mark span { font: 700 30px/1 var(--font-display); color: var(--brass); letter-spacing: -1px; }
.mark small { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; opacity: .7; margin-top: 3px; }
.palette { display: flex; flex-direction: column; gap: 4px; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; color: inherit;
  padding: 8px 2px 7px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.rail-btn:hover { background: rgba(244, 239, 228, .18); }
.rail-btn:active { background: rgba(244, 239, 228, .16); }
.rail-btn:disabled { opacity: .38; cursor: default; background: transparent; }
.rail-btn.soon { position: relative; }
.rail-btn.soon::after { content: "скоро"; position: absolute; right: 4px; top: 4px; font-size: 8.5px; letter-spacing: .06em;
  background: var(--brass); color: var(--ink); border-radius: 4px; padding: 0 3px; opacity: .9; }
.rail-btn svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn span { font-size: 11px; letter-spacing: .02em; opacity: .85; }
.rail-btn[data-add="main"] { color: #e7c27a; }
.rail-sep { height: 1px; background: rgba(244, 239, 228, .14); margin: 8px 6px; }
.rail-btn .key { position: absolute; }

/* ============ холст ============ */
.stage { position: relative; overflow: hidden; touch-action: none;
  background-color: var(--chart);
  background-image: radial-gradient(rgba(20, 40, 58, .13) 1px, transparent 1.2px);
  background-size: 22px 22px; }
#svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }

.card { background: var(--paper); border: 1px solid rgba(20, 40, 58, .08); border-radius: var(--radius); box-shadow: var(--shadow); }

.titlecard { position: absolute; top: 14px; left: 14px; right: 364px; display: flex; align-items: center; gap: 18px;
  padding: 10px 12px 10px 18px; z-index: 2; }
.titleblock { min-width: 170px; flex: 1; }
.eyebrow { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scheme-name { display: block; width: 100%; border: 0; background: transparent; padding: 0; margin-top: 1px;
  font: 600 22px/1.2 var(--font-display); color: var(--ink); outline: none; text-overflow: ellipsis; }
.scheme-name:focus { box-shadow: inset 0 -2px 0 var(--brass); }
.scheme-name:hover { box-shadow: inset 0 -1px 0 var(--line); }
.scheme-pick { margin-top: 2px; max-width: 100%; border: 0; background: transparent; color: var(--ink-soft);
  font-size: 11.5px; padding: 0; cursor: pointer; }
.stats { display: flex; gap: 16px; white-space: nowrap; }
.stat { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.stat b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.stat.bad b { color: var(--coral); }
.stat.good b { color: #3f7a43; }
.stat.warn b { color: #b07d2b; }
.guide-center { stroke: var(--brass); opacity: .85; }
.guide-center-label { fill: var(--brass); font: 600 14px var(--font-ui); text-anchor: middle; letter-spacing: .06em; }
/* «призрак» стола, который тянут из рейки: настоящие габариты со стульями */
.ghost { pointer-events: none; }
.ghost .g-fp { fill: var(--brass); fill-opacity: .08; stroke: var(--brass); stroke-width: 1.5;
  stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.ghost .g-top { fill: var(--paper); fill-opacity: .7; stroke: var(--ink); stroke-width: 1.5;
  vector-effect: non-scaling-stroke; }
.ghost .ghost-bad .g-fp, .ghost.ghost-bad .g-fp { fill: #c0392b; fill-opacity: .1; stroke: #c0392b; }
.ghost .ghost-bad .g-top, .ghost.ghost-bad .g-top { fill: #f6e7e4; fill-opacity: .8; stroke: #c0392b; }
.ghost .ghost-twin { opacity: .75; }   /* зеркальные копии чуть бледнее — видно, какой стол ставишь сам */
.stage.dropping { cursor: copy; }
/* свой стол, добавленный кнопкой «Запомнить стол»: помечаем точкой, правой кнопкой убирается */
.rail-btn.rail-my { position: relative; }
.rail-btn.rail-my::after { content: ""; position: absolute; top: 6px; right: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--brass); }
/* тащим стол через занятое место: видно, что сюда он не встанет */
.stage.drag-bad .t-sel .table { stroke: #c0392b; }
.stage.drag-bad .t-sel .seat .chair { fill: #f0cdc7; stroke: #c0392b; }
.stage.drag-bad { cursor: not-allowed; }
.hint-do { margin-left: 10px; padding: 0 12px; min-height: 26px; font-size: 12px; vertical-align: middle; }
.actions { display: flex; gap: 6px; }

.btn { border: 1px solid var(--line); background: #fffdf8; border-radius: 10px; padding: 0 12px; min-height: 36px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .15s, background .15s, transform .05s; }
.btn:hover { border-color: #bfb296; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
/* главное действие раздела — выше и весомее соседних */
.btn-go { min-height: 42px; font-weight: 600; font-size: 14.5px; }
.btn-ghost { background: transparent; }
.btn-brass { color: #6f4e12; border-color: #e3cd9f; background: var(--brass-soft); }
.btn-brass:hover { border-color: #cbae72; }
/* включённый переключатель (тип стола для автоподбора, режим симметрии, линейка) */
.btn-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-on:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-mini { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-danger { color: var(--coral); }
/* фокус с клавиатуры виден везде, не только на полях */
.btn:focus-visible, .rail-btn:focus-visible, summary:focus-visible, .sheet-grip:focus-visible,
.problems li:focus-visible, .scheme-name:focus-visible, .scheme-pick:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
.panel-toggle { display: none; }
/* под названием банкета — короткая подпись без рамки: дата, заказчик, гостей */
.title-meta { font-size: 12.5px; color: var(--ink-soft); letter-spacing: .01em; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* выравнивание по краям — реже нужно, поэтому мелкой строкой из четырёх кнопок */
.tools.tools-edges { grid-template-columns: repeat(4, 1fr); }
/* мини-навигация по разделам панели: липкая строка иконок, чтобы не прокручивать всё */
.sec-nav { position: sticky; top: 0; z-index: 4; display: flex; gap: 2px; align-items: center;
  padding: 6px 0; margin: 0 0 6px; background: var(--paper);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sec-nav::-webkit-scrollbar { display: none; }
.nav-btn { flex: 1 1 auto; min-width: 34px; height: 30px; display: grid; place-items: center;
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: var(--ink-soft); }
.nav-btn .sec-ico { width: 17px; height: 17px; stroke: currentColor; }
.nav-btn:hover { background: rgba(20, 40, 58, .06); color: var(--ink); }
.nav-btn.nav-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.nav-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.scale { position: absolute; left: 18px; bottom: 16px; display: flex; align-items: center; gap: 8px; z-index: 2;
  background: rgba(244, 239, 228, .92); border-radius: 10px; padding: 6px 10px; box-shadow: var(--shadow); font-size: 12px; font-variant-numeric: tabular-nums; }
.scale-bar { display: flex; height: 8px; border: 1px solid var(--ink); }
.scale-bar i { display: block; height: 100%; width: 50px; }
.scale-bar i:first-child { background: var(--ink); }
.hint { position: absolute; left: calc((100% - 350px) / 2); bottom: 18px; transform: translateX(-50%); z-index: 2; max-width: min(560px, calc(100% - 420px));
  font-size: 12.5px; color: var(--ink-soft); background: rgba(244, 239, 228, .92); border-radius: 999px; padding: 6px 14px; pointer-events: none; text-align: center; }
.hint:empty { display: none; }
.hint .hint-x, .hint .hint-do { pointer-events: auto; }   /* строка не мешает мыши, а кнопки в ней нажимаются */
.hint-x { margin-left: 10px; width: 24px; height: 24px; border: 0; border-radius: 50%; cursor: pointer; vertical-align: middle;
  font: 700 16px/24px var(--font-ui); padding: 0; background: var(--ink); color: var(--paper); }
.hint.flash .hint-x { background: var(--paper); color: var(--ink); }
.hint-x:hover { background: var(--coral); color: #fff; }
body.no-hints ::placeholder { color: transparent; }
body.no-hints .tip { display: none; }
/* полоса «этот банкет правят с другого компьютера» */
.lockbar { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--coral); color: #fff; border-radius: 999px; padding: 7px 18px; font-size: 13px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
.lockbar[hidden] { display: none; }
.lockbar button { border: 0; background: rgba(255,255,255,.22); color: #fff; border-radius: 999px;
  padding: 3px 12px; font-size: 12px; cursor: pointer; }
body.read-only .rail .palette, body.read-only .inspector .acts { opacity: .45; pointer-events: none; }
.hint.flash { color: var(--paper); background: var(--ink); }

/* ============ зал ============ */
.floor { fill: var(--floor); }
.balcony { fill: #ece6d8; stroke: #b9ad94; stroke-width: 25; }
.wall { fill: none; stroke: var(--ink); stroke-width: 130; stroke-linejoin: miter; }
.window { stroke: #7faacc; stroke-width: 80; }
.door-gap { stroke: var(--floor); stroke-width: 150; }
.door { fill: none; stroke: #8e9aa6; stroke-width: 20; }
.door-arc { stroke-dasharray: 60 50; }
.grid line { stroke: #eee7d8; stroke-width: 12; }
.grid line.major { stroke: #e4dac6; stroke-width: 22; }
.grid line.axis { stroke: #b9a887; stroke-width: 16; stroke-dasharray: 160 110; }
.ob { fill: #e3dccb; stroke: #b4a88c; stroke-width: 15; }
.ob-column { fill: #56626e; stroke: var(--ink); }
.ob-booth { fill: #eadcc0; stroke: #c3a978; }
.ob-partition { fill: var(--ink); stroke: var(--ink); stroke-width: 25; }   /* перегородка между ложами */
.ob-stage { fill: url(#hatch) #dcd3bf; stroke: #6f6450; stroke-width: 35; }
.ob-steps { fill: #ebe4d4; }
.ob-sound { fill: var(--ink); stroke: none; }
.hatch-line { stroke: #b9ad94; stroke-width: 28; }
.ob-label { font: 700 440px var(--font-display); fill: #5d5342; text-anchor: middle; dominant-baseline: middle; letter-spacing: 60px; }
.ob-label-small { font-size: 300px; letter-spacing: 20px; }
.lbl { font: 700 360px var(--font-ui); fill: #a3988a; text-anchor: middle; dominant-baseline: middle; letter-spacing: 30px; }
.lbl-board { font: italic 600 440px var(--font-display); fill: var(--ink-2); letter-spacing: 10px; }
.hide-obstacles .obstacles { opacity: .2; }

/* ============ столы ============ */
.t { cursor: grab; }
.t .top { fill: #fffdf8; stroke: var(--ink); stroke-width: 26; }
.t .chair { fill: #cdd3d8; stroke: #8d98a3; stroke-width: 12; }
.t .guest-head { fill: #9aa8b4; stroke: var(--ink); stroke-width: 11; }
.t .guest-body { fill: #b9c4cd; stroke: var(--ink); stroke-width: 11; stroke-linejoin: round; }
.t .seat-kid .chair { fill: #dbe7cf; stroke: #4f7a45; stroke-width: 22; }
.t .sofa { fill: #d8d2c4; stroke: #8b8271; stroke-width: 18; }
.t .high-mark { font: 500 190px var(--font-ui); fill: #8a7f6c; text-anchor: middle; pointer-events: none; }
.ob-label-booth { font: 500 300px var(--font-ui); fill: #6d5a38; letter-spacing: 30px; }
.t .kid-letter { font: 700 220px var(--font-ui); fill: #fff; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.t .kid-dot { fill: #4f7a45; stroke: #fffdf8; stroke-width: 30; }
.t .seat-kid .guest-head { fill: #a9c294; } .t .seat-kid .guest-body { fill: #c3d6b3; }
.kid-badge circle { fill: #4f7a45; stroke: #fffdf8; stroke-width: 30; }
.main-badge circle { fill: #8c2f4a; stroke: #fffdf8; stroke-width: 30; }   /* главный — винный, не путается с детским */
.main-badge text { font: 700 220px var(--font-ui); fill: #fff; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
/* детские стулья — белая плашка с зелёной рамкой и «ДС»; не путается с зелёным кружком «Д» детского стола */
.kid-tag rect { fill: #fffdf8; stroke: #2f7a36; stroke-width: 30; }
.kid-tag .kid-tag-n { font: 700 190px var(--font-ui); fill: #2f7a36; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.kid-badge text { font: 700 220px var(--font-ui); fill: #fff; text-anchor: middle; dominant-baseline: middle; }
.t .fp { fill: none; stroke-width: 20; stroke-dasharray: 100 80; stroke: #9aa3ad; }
.t-num { font: 700 400px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.t-num-small { font-size: 260px; }
.t-seats { font: 500 230px var(--font-ui); fill: var(--ink-soft); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.t-high .top { fill: #e8eef2; stroke-dasharray: 90 50; }
.t-station .top { fill: #efe2c6; stroke: #8a6a2c; stroke-width: 30; }
.t-station .t-num { fill: #7a5616; font-family: var(--font-display); }
/* главный стол — обычный стол с буквой «Г» (жёлтую заливку Тимур убрал 26.09) */
.t-sel .top { stroke: var(--teal); stroke-width: 55; stroke-dasharray: none; }   /* выделение сплошное и у высоких столов */
.t-sel .fp { stroke: var(--teal); }
/* замечания больше не красят столы — они видны в «Проверке»; выделение остаётся бирюзовым */
.guide { stroke: var(--magnet); pointer-events: none; }
.measure, .measure-tick { stroke: var(--magnet); pointer-events: none; }
.measure-label { pointer-events: none; }
.measure-label rect { fill: var(--magnet); }
.measure-label text { font-family: var(--font-ui); font-weight: 600; fill: #fff; text-anchor: middle; dominant-baseline: middle; }
.marquee { fill: rgba(29, 111, 107, .08); stroke: var(--teal); stroke-width: 22; stroke-dasharray: 90 60; }
.dragging .t { cursor: grabbing; }
.scalebar .sb-dark { fill: var(--ink); } .scalebar .sb-light { fill: #fff; stroke: var(--ink); stroke-width: 20; }
.scalebar .sb-text { font: 500 260px var(--font-ui); fill: var(--ink); text-anchor: middle; }

/* ============ инспектор ============ */
.inspector { position: absolute; top: 14px; right: 14px; bottom: 14px; width: 336px; overflow-y: auto; z-index: 2; padding: 0 0 4px; }
.sec { padding: 12px 16px 14px; }
.sec + .sec { border-top: 1px solid var(--line); }

/* один ритм заголовков: иконка — название — короткий итог справа */
.sec h3,
.inspector details.fold > summary { margin: 0 0 10px; padding: 2px 0; min-height: 26px;
  font: 600 15.5px/1.25 var(--font-display); color: var(--ink);
  display: flex; align-items: center; gap: 8px; list-style: none; }
.inspector details.fold > summary { cursor: pointer; margin-bottom: 0; }
.inspector details.fold[open] > summary { margin-bottom: 10px; }
.inspector details.fold > summary::-webkit-details-marker { display: none; }
.inspector details.fold > summary::after { content: ""; margin-left: auto; flex: none; width: 9px; height: 9px;
  border: solid var(--ink-soft); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s; }
.inspector details.fold[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.sec h3 .sec-name, .inspector details.fold > summary .sec-name { flex: 0 1 auto; }
.sec h3 small, .inspector details.fold > summary small { margin-left: auto;
  font: 500 11px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 47%; }
.inspector details.fold > summary small { margin-left: auto; padding-right: 6px; }
.sec-ico { flex: none; width: 17px; height: 17px; fill: none; stroke: var(--brass);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fold-bad > summary .sec-ico { stroke: var(--coral); }
.inspector details.fold.fold-bad > summary small { color: var(--coral-ink); }   /* сигнал сильнее общей подписи */
/* вложенные разделы «Разложить» — тише основных */
.inspector details.fold.sub { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.inspector details.fold.sub > summary { font: 600 13px var(--font-ui); color: var(--ink-2); }
.inspector details.fold.sub[open] > summary { margin-bottom: 8px; }

/* одна строка вместо простыни инструкций: полный текст — в окне по «?» */
.sec-tip { padding-top: 14px; padding-bottom: 12px; }
.tipline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.tipline .sec-ico { stroke: var(--ink-soft); }
.tipline span { flex: 1; min-width: 0; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 8px; }
.row + .seg, .seg + .row, .seg + .seg, .stack + .row, .row + .stack { margin-top: 8px; }
.sub-head { margin-top: 14px !important; }
.sub-head + .seg, .sub-head + .stack, .sub-head + .row { margin-top: 6px; }
.check-side { align-self: flex-end; padding-bottom: 9px; }
.field > span.warnword, .warnword { color: var(--coral-ink); }   /* «прошедший» должен быть виден сразу */

/* «гостей: 130» с кнопкой «изменить» — поле ввода одно на всю панель, оно в «Банкете» */
.need-line { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin-bottom: 8px;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; }
.need-line b { font: 600 15px var(--font-ui); font-variant-numeric: tabular-nums; }
.need-line .need-empty { color: var(--ink-soft); font-weight: 500; }
.need-line .btn { margin-left: auto; }

/* ручка листа — только на телефоне */
.sheet-grip { display: none; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.field > span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fffdf8; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.field textarea { resize: vertical; min-height: 44px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--teal); width: 16px; height: 16px; }
.muted { color: var(--ink-soft); font-size: 12.5px; }
.lead { font-size: 13px; color: var(--ink-soft); }
.lead b { color: var(--ink); font-weight: 600; }

.stepper { display: inline-flex; flex: none; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fffdf8; }
.stepper button { border: 0; background: transparent; width: 40px; height: 42px; font-size: 21px; cursor: pointer; color: var(--ink); }
.stepper button:hover { background: #f1e9d8; }
.stepper input { width: 46px; border: 0; background: transparent; text-align: center; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.big-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.big-row + .big-row, .row + .big-row, .big-row + .row, .big-row + .seg { margin-top: 8px; }
.big-row > div:first-child { min-width: 0; }
.plan { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.seg .btn { padding: 0 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* текст не прилипает к краям */
.tools { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 6px; }
.tools .btn { padding: 0; font-size: 16px; line-height: 1.1; }
.stack { display: grid; gap: 6px; }
.stack .btn { text-align: left; justify-content: space-between; padding: 0 12px; }
.stack .btn em { font-style: normal; color: var(--ink-soft); font-size: 12px; margin-left: 10px; }
.stack .btn.btn-brass em { color: #6f5420; }   /* было 4.18:1 — не проходило по контрасту */
.stack .btn.btn-ink em { color: #c9c2b2; }

.problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.problems li { font-size: 13px; line-height: 1.35; padding: 8px 10px 8px 26px; border-radius: 9px; cursor: pointer;
  border-left: 3px solid var(--line); background: #fffdf8; position: relative; transition: background .12s, border-color .12s; }
.problems li::before { content: "•"; position: absolute; left: 10px; top: 7px; font-size: 15px; line-height: 1.2; color: var(--ink-soft); }
.problems li:hover { background: #fff; border-color: var(--ink-soft); }
.problems li.error { border-color: var(--ink); font-weight: 600; }
.problems li.error::before { content: "!"; color: var(--ink); font-weight: 700; }
.problems li.warn::before { content: "•"; color: var(--brass); }
.problems li.ok { border-color: var(--teal); background: var(--teal-soft); cursor: default; }
.problems li.ok::before { content: "✓"; color: var(--teal); font-size: 13px; }
kbd { font: 11px var(--font-ui); background: #fffdf8; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

/* ============ планшет и телефон ============ */
@media (max-width: 1180px) {
  .actions #example { display: none; }
}
@media (max-width: 1100px) {
  .eyebrow { display: none; }
  .stats { gap: 10px; }
  .stat b { font-size: 18px; }
}
/* ноутбук без развёрнутого окна: шапке негде сжаться и кнопки уезжали под панель.
   PDF и PNG прячем — они есть в разделе «Отдать клиенту», «Печать» остаётся на месте */
@media (max-width: 1150px) {
  .titlecard { gap: 10px; padding-right: 8px; }
  .actions .btn:not(.btn-ink):not(.panel-toggle) { display: none; }   /* кнопку панели ☰ не трогаем */
  .stats { gap: 8px; }
  .stat span { font-size: 10px; }
}
@media (max-width: 1000px) {
  .stat:nth-child(n+4) { display: none; }   /* оставляем «заказано · мест · запас» */
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px; gap: 2px; }
  .palette { flex-direction: row; gap: 2px; }
  .mark, .rail-sep { display: none; }
  .rail-btn { min-width: 62px; padding: 6px 2px; }
  .rail { flex-wrap: wrap; justify-content: center; overflow: visible; }   /* все кнопки видны, «Весь зал» не уезжает */
  .rail-btn { min-width: 58px; }
  .guest-table li.kid { border-bottom-style: dashed; }
  .rail-btn svg { width: 24px; height: 24px; }
  .titlecard { right: 10px; left: 10px; top: 10px; gap: 8px; padding: 8px 8px 8px 12px; }
  .scheme-name { font-size: 17px; }
  /* цифры нужны и на телефоне: переносим их второй строкой под названием */
  .titlecard { flex-wrap: wrap; }
  /* цифр бывает пять — на узком экране они переносятся, а не уезжают за край */
  .stats { order: 3; flex-basis: 100%; gap: 4px 14px; justify-content: flex-start; flex-wrap: wrap; }
  .stat { flex-direction: row; gap: 4px; align-items: baseline; }
  .stat b { font-size: 15px; }
  .stat span { font-size: 9.5px; }
  .actions #png, .actions #example { display: none; }
  .panel-toggle { display: inline-block; }
  /* кнопки стола не должны уезжать под край экрана */
  .inspector .row.acts { position: sticky; bottom: 0; z-index: 2; padding: 8px 0; margin-bottom: 0;
    background: linear-gradient(to bottom, rgba(255,253,248,.2), var(--paper) 35%); }
  /* панель — лист снизу: стоит НАД рейкой инструментов, а не под ней, и тянется за ручку */
  .inspector { top: auto; left: 0; right: 0; bottom: var(--railh, 0px); width: auto;
    height: var(--sheet, 46%); max-height: calc(100dvh - var(--railh, 0px) - 10px);
    border-radius: 18px 18px 0 0; overscroll-behavior: contain;
    transform: translateY(calc(100% + var(--railh, 0px))); transition: transform .22s; z-index: 4; }
  .inspector.open { transform: none; }
  .sheet-grip { display: block; position: sticky; top: 0; z-index: 6; padding: 9px 0 7px;
    background: var(--paper); border-radius: 18px 18px 0 0; cursor: grab; touch-action: none; }
  .sheet-grip i { display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: #c9bfa8; }
  .sheet-grip:active { cursor: grabbing; }
  .sheet-grip:active i { background: var(--brass); }
  .scale { bottom: 10px; left: 10px; }
  .hint { bottom: 54px; left: 50%; max-width: calc(100% - 24px); }
  .sec { padding: 12px 14px 14px; }
  .btn { min-height: 40px; }        /* палец, а не курсор */
  .btn-mini { min-height: 32px; }
}

/* ============ окно «Печать рассадки» ============ */
.modal-back { position: fixed; inset: 0; background: rgba(20, 40, 58, .35); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal-back[hidden] { display: none; }
.modal { width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 18px 20px; }
.modal h2 { margin: 0 0 4px; font: 600 22px var(--font-display); }
.modal .lead { margin-bottom: 14px; }
.modal .opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.modal .opt input { margin-top: 3px; accent-color: var(--teal); width: 17px; height: 17px; }
.modal .opt b { display: block; font-weight: 600; }
.modal .opt span { font-size: 12.5px; color: var(--ink-soft); }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ============ печать ============ */
.print-sheet { display: none; }
@media print {
  html, body { background: #fff; height: auto; overflow: visible; }
  .app, .modal-back { display: none !important; }
  .print-sheet { display: block; font-family: var(--font-ui); color: #000; }
  .print-page { page-break-after: always; break-after: page; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-sheet h1 { font: 600 18pt var(--font-display); margin: 0 0 1mm; }
  .print-sheet .meta { font-size: 10pt; color: #444; margin-bottom: 3mm; }
  .print-sheet .plan svg { width: 100%; height: auto; max-height: var(--plan-h, 160mm); display: block; }
  .print-sheet .floor { fill: #fff; } .print-sheet .grid { display: none; }
  .print-sheet .t-num { font-size: 520px; }
  .print-sheet table { border-collapse: collapse; font-size: 9pt; margin-top: 3mm; }
  .print-sheet td, .print-sheet th { border: 1px solid #bbb; padding: 1mm 3mm; text-align: left; }
  /* бланк «кто за каким столом» */
  .guest-grid { columns: var(--cols, 3); column-gap: 8mm; }
  .guest-table { break-inside: avoid; page-break-inside: avoid; margin: 0 0 5mm; }
  .guest-table h3 { margin: 0 0 1.5mm; font: 600 12pt var(--font-display); border-bottom: 1.5pt solid #000; padding-bottom: 1mm; }
  .guest-table h3 small { font: 9pt var(--font-ui); color: #555; }
  .guest-table ol { margin: 0; padding-left: 7mm; font-size: 9pt; }
  .guest-table li { height: 6.5mm; border-bottom: .5pt solid #999; }
  .guest-table li.kid { border-bottom: .8pt dashed #4f7a45; }   /* детское место */
  /* таблички с номерами на столы */
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .card-num { height: var(--card-h, 95mm); border: .5pt dashed #999; display: flex; flex-direction: column; align-items: center; justify-content: center;
    break-inside: avoid; page-break-inside: avoid; }
  .card-num b { font: 700 110pt/1 var(--font-display); }
  .card-num span { font: 12pt var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: #444; margin-top: 3mm; }
}

/* ---- вход на общий сервер ---- */
.login-veil { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 40, 58, .55); backdrop-filter: blur(3px); }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; padding: 22px 22px 18px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); font-family: var(--font-ui); color: var(--ink); }
.login-card h2 { margin: 0 0 4px; font: 600 22px var(--font-display); }
.login-card .field { display: grid; gap: 4px; }
.login-card .field span { font-size: 13px; color: var(--ink-soft); }
.login-card input { font: 16px var(--font-ui); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--floor); color: var(--ink); }
.login-card input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.login-msg { min-height: 1.2em; font-size: 13px; color: var(--coral-ink); }
.login-skip { font-size: 12px; }
.user-chip { max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
