:root { --bg: #fafafa; --fg: #212121; --muted: #757575; --line: #e0e0e0; --accent: #1565c0; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
header.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
header .brand { font-weight: 600; color: var(--fg); text-decoration: none; }
header nav a { color: var(--accent); text-decoration: none; margin-right: 12px; }
header .logout { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.who { color: var(--muted); }
main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h1 .muted { font-weight: 400; font-size: 16px; }
.muted { color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; font: inherit; cursor: pointer; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.card.narrow { max-width: 380px; margin: 60px auto; }
.form label { display: block; margin-bottom: 12px; }
.form input { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #bdbdbd; border-radius: 6px; font: inherit; }
.alert { padding: 10px 14px; border-radius: 6px; }
.alert.error { background: #ffebee; color: #b71c1c; }
.alert.warn { background: #fff8e1; color: #7a5a00; border: 1px solid #ffe082; }
table.list { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid var(--line); }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.list th.num, table.list td.num { text-align: right; }
table.list a { color: var(--accent); text-decoration: none; }
.badge { font-size: 12px; padding: 1px 6px; border-radius: 10px; }
.badge.warn { background: #fff3cd; color: #7a5a00; }
.counters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }   /* список спектаклей */
.chip { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--c, #bdbdbd); border-radius: 6px; padding: 4px 10px; }
.chip b { margin-left: 4px; }
.controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-bottom: 10px; }
.hall-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 14px; }
.seat.st-pending { cursor: default; }
.hall { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; height: calc(100vh - 240px); min-height: 600px; overflow: hidden; cursor: grab; }
.hall.dragging { cursor: grabbing; }
.hall svg { width: 100%; height: 100%; display: block; user-select: none; }
.seat { stroke: rgba(0,0,0,.25); stroke-width: .6; cursor: pointer; }
.figure polygon { fill: #eceff1; stroke: #b0bec5; stroke-width: 1; }
.figure.kind-obstacle polygon { fill: #546e7a; stroke: #37474f; }
.figure.kind-exit polygon { fill: none; stroke: #90a4ae; stroke-dasharray: 3 2; }
.figure-label { fill: #37474f; font-weight: 600; pointer-events: none; }
.figure-label.kind-obstacle { fill: #fff; }
.seat.st-unavailable { stroke-width: 1.2; }
.seat.unc { stroke-dasharray: 2 1.5; }
.seat:hover { stroke: #000; stroke-width: 1.6; }
.sector-label { fill: #616161; font-weight: 600; pointer-events: none; }
.sector-halo { fill: #fff; fill-opacity: .75; pointer-events: none; }
svg.only-booked .seat:not(.st-booked):not(.st-pending) { opacity: .12; }
.tooltip { position: absolute; pointer-events: none; background: #212121; color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 2; }
.tooltip b { display: block; }
@media (max-width: 900px) { .hall-wrap { grid-template-columns: 1fr; } }

/* --- ТЗ-02 часть D: вкладки, выделение, панель расписывания --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 12px; }
.tabs .tab { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs .tab.active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; } .tab-panel.active { display: block; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; align-self: start; font-size: 14px; }
.panel-title { font-weight: 600; margin-bottom: 6px; }
.selected-list { margin: 0 0 10px; padding-left: 18px; max-height: 180px; overflow: auto; font-size: 13px; }
.panel .form textarea { display: block; width: 100%; padding: 6px 8px; margin-top: 4px; border: 1px solid #bdbdbd; border-radius: 6px; font: inherit; }
.panel label.inline { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.panel .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.form-error { margin-top: 8px; color: #b71c1c; font-size: 13px; }
.card-lines { margin-bottom: 10px; line-height: 1.5; }
.small { font-size: 12px; }
button.danger { background: #fff; color: #b71c1c; border: 1px solid #ef9a9a; border-radius: 6px; padding: 8px 12px; font: inherit; cursor: pointer; }
a.button { display: inline-block; background: #fff; border: 1px solid #bdbdbd; border-radius: 6px; padding: 6px 12px; color: var(--fg); text-decoration: none; }
.seat.selectable { cursor: pointer; }
.seat.st-sold, .seat.st-free, .seat.st-unavailable, .seat.st-booked:not(.selectable):not(.assigned) { cursor: default; }
.seat.sel { fill: #ffc107 !important; stroke: #000; stroke-width: 1.6; }
.seat.assigned { cursor: pointer; }
.seat.conflict { stroke: #d32f2f; stroke-width: 2; }
.band { fill: rgba(21, 101, 192, .12); stroke: #1565c0; stroke-width: 1; stroke-dasharray: 3 2; pointer-events: none; }
svg.focus-booking .seat:not(.focus) { opacity: .15; }
svg.focus-booking .seat.focus { stroke: #000; stroke-width: 1.6; }
.tooltip .warn { color: #ffcc80; }
.badge.error { background: #ffebee; color: #b71c1c; }
tr.conflict-row td { background: #fff5f5; }
table.summary { width: auto; margin-bottom: 14px; }
details.revoked { margin-top: 14px; } details.revoked summary { cursor: pointer; color: var(--muted); }
.alert.error ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 1100px) { .hall-wrap { grid-template-columns: 1fr; } }

/* --- ТЗ-02c: номера мест, рядов, лож --- */
.seat-numbers text, .row-numbers text, .box-labels text { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; pointer-events: none; user-select: none; }
.row-numbers text { fill: #757575; }
.box-labels text { fill: #455a64; }
svg.hide-seat-numbers .seat-numbers { display: none; }

/* --- ТЗ-03: выпуск --- */
.badge.ok { background: #e8f5e9; color: #1b5e20; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* --- ТЗ-04: гашение на входе, устройства --- */
.tooltip .ok { color: #a5d6a7; }
.card-lines .ok { color: #1b5e20; }
.link-box { display: inline-block; margin: 6px 0; padding: 4px 8px; background: #fff; border: 1px solid var(--line); border-radius: 4px; word-break: break-all; }
form.inline { display: inline; margin-right: 10px; }
button.danger-link { color: #b71c1c; }
.narrow-form { max-width: 520px; margin-top: 10px; }
.narrow-form .row { display: flex; gap: 10px; } .narrow-form .row label { flex: 1; } .narrow-form .row label.short { flex: 0 0 110px; }
h2 { font-size: 18px; margin: 24px 0 10px; }

/* --- ТЗ-07: окно «Выдать места», панель действий, галочки в «Расписано» --- */
dialog.dialog { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; width: min(640px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.25); font-size: 14px; }
dialog.dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-head { font-size: 17px; margin-bottom: 8px; }
.dialog .selected-list { max-height: 140px; }
.dialog .form input, .dialog .form textarea { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #bdbdbd; border-radius: 6px; font: inherit; }
.dialog .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.dialog button:not(.primary):not(.link) { background: #fff; border: 1px solid #bdbdbd; border-radius: 6px; padding: 8px 12px; font: inherit; cursor: pointer; }
.form-error ul { margin: 4px 0 0; padding-left: 18px; }
.delivery { display: block; }
.delivery .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.delivery button:not(.primary):not(.link) { background: #fff; border: 1px solid #bdbdbd; border-radius: 6px; padding: 8px 12px; font: inherit; cursor: pointer; }
.delivery button.small { padding: 3px 8px; font-size: 13px; }
.delivery .delivery-status { margin-top: 4px; min-height: 1.2em; color: var(--muted); }
.delivery .delivery-status.error { color: #b71c1c; }
.delivery .alert { margin-top: 6px; }
#assigned-actions { align-items: flex-start; }
#assigned-actions .delivery { flex: 1; min-width: 320px; }
#assigned-actions .delivery.empty { opacity: .6; }
table.list tr.picked td { background: #fffde7; }
.group-pick { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.marks .mark { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eeeeee; color: #9e9e9e; margin-right: 3px; }
.marks .mark.on { background: #e8f5e9; color: #1b5e20; }
.csv-link { margin-top: 14px; }
button:disabled { opacity: .55; cursor: default; }

/* --- ТЗ-08: Google Диск --- */
.delivery .drive-links { margin-top: 2px; }
.delivery .delivery-status a { color: var(--accent); }

/* --- ТЗ-07b/07c: плашки-файлы --- */
ul.files { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; line-height: 1.3; }
ul.files li.file-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #bdbdbd; border-radius: 8px; background: #fff; }
ul.files li.file-chip .pdf-ico { flex: none; }
ul.files .share-one { font-size: 13px; }

/* --- причина перевыпуска/отмены в панели (вместо prompt) --- */
.reason-box { margin-top: 8px; padding: 10px; background: #fff8e1; border: 1px solid #ffe082; border-radius: 6px; }
.reason-title { font-weight: 600; margin-bottom: 6px; }
.reason-box input.invalid { border-color: #b71c1c; }

/* --- ТЗ-12: легенда и инструменты поверх схемы, отметки «выпущено» / «погашено» --- */
.hall-overlay { position: absolute; left: 0; top: 0; right: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.legend-bar { pointer-events: auto; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 6px 10px; background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.legend-bar.collapsed { width: auto; background: transparent; border: 0; }
.legend-bar.collapsed .legend-items { display: none; }
.legend-toggle { flex: none; background: #fff; border: 1px solid #bdbdbd; border-radius: 6px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.legend-items { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; min-height: 22px; }
.lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg i { width: 13px; height: 13px; border-radius: 50%; display: inline-block; position: relative; box-sizing: border-box; flex: none; }
.lg i.hatch { background: repeating-linear-gradient(45deg, #eee 0 2px, #9e9e9e 2px 3px); }
.lg i.dot { background: #7e57c2; }
.lg i.dot::after { content: ""; position: absolute; left: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.lg i.ring { background: #fff; border: 2px solid #d32f2f; }
.lg i.ring.used::after { content: "✓"; position: absolute; left: 0; right: 0; top: -2px; text-align: center; color: #d32f2f; font-size: 10px; font-weight: 700; line-height: 1; }
.lg i.conflict { background: #7e57c2; box-shadow: 0 0 0 2px #d32f2f; }
.lg i.off { background: transparent; border: 2px solid #cfd8dc; }
.lg i.picked { background: #ffc107; border: 1.5px solid #000; }
.lg-sep { width: 1px; height: 14px; background: var(--line); }
.hall-tools { pointer-events: auto; display: flex; gap: 4px; margin-left: 8px; }
.hall-tools button { background: #fff; border: 1px solid #bdbdbd; border-radius: 6px; min-width: 30px; height: 30px; padding: 0 8px; font: inherit; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.hall-tools button:hover { border-color: var(--accent); }
.hall-tools #zoom-in, .hall-tools #zoom-out { font-size: 18px; line-height: 1; }
.hall-tools #reset-view { font-size: 13px; }
.help { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #bdbdbd; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); cursor: help; background: #fff; }
.seat.issued, .seat.used { fill: #fff; stroke: #d32f2f; stroke-width: 1.6; }
.used-mark { fill: none; stroke: #d32f2f; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.seat.sel { fill: #ffc107; stroke: #000; stroke-width: 1.6; }
.seat.conflict { stroke: #d32f2f; stroke-width: 2.2; }

/* --- ТЗ-13: меню, закреплённая шапка спектакля, «Пояса», подсказка «?», список для входа --- */
header .logout { gap: 14px; }
header .inline-form { display: inline; }
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; color: var(--muted); }
details.menu summary::-webkit-details-marker { display: none; }
details.menu[open] summary, details.menu summary:hover { background: #eeeeee; color: var(--fg); }
details.menu .menu-items { position: absolute; right: 0; top: 30px; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); padding: 6px 0; z-index: 30; }
details.menu .menu-items a { display: block; padding: 7px 14px; color: var(--fg); text-decoration: none; margin: 0; }
details.menu .menu-items a:hover { background: #f5f5f5; }
.perf-head { position: sticky; top: 0; z-index: 20; background: var(--bg); margin: -16px -20px 12px; padding: 3px 20px 0; border-bottom: 1px solid var(--line); max-height: 56px; overflow: hidden; }
.perf-line { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px 12px; min-height: 24px; overflow: hidden; }
.perf-title { font-size: 15px; white-space: nowrap; }
.perf-title b { font-size: 16px; }
.pills { display: flex; flex-wrap: nowrap; gap: 4px 5px; align-items: center; overflow: hidden; }
.pill[hidden] { display: none; }    /* атрибут hidden слабее display: inline-flex — таблетки с нулём (Оформляется, Снято) прячем явно */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.25; padding: 0 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c, #bdbdbd); white-space: nowrap; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.sync-time.stale { color: #7a5a00; background: #fff8e1; border: 1px solid #ffe082; border-radius: 10px; padding: 0 7px; }
/* ТЗ-13b п.1: обычная кнопка с рамкой, шрифт как у таблеток; при устаревших данных — выделена */
.sync-btn { font: inherit; font-size: 13px; line-height: 1.25; padding: 2px 10px; background: #fff; color: var(--fg); border: 1px solid #9e9e9e; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.sync-btn:hover:not(:disabled) { background: #f5f5f5; }
.sync-btn.stale { border-color: #f9a825; background: #fff8e1; color: #5d4300; font-weight: 600; }
.sync-btn.busy { color: var(--muted); }
#sync-status:empty { display: none; }
#sync-status { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px) { .sync-time { display: none; } }   /* узкое окно: время — в подсказке кнопки */
.card .inline-form { display: inline; }
.perf-head .tabs { margin: 0; border-bottom: 0; }
.perf-head .tabs .tab { padding: 3px 12px 2px; font-size: 14px; }
.legend-bar.collapsed { width: 100%; background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--line); }
.legend-bar.collapsed .legend-items { display: flex; }
.legend-bar.collapsed .legend-items .status { display: none; }
.help-wrap { position: relative; display: inline-flex; }
button.help { font: inherit; padding: 0; }
.help-pop { position: absolute; left: 0; top: 26px; z-index: 25; width: min(420px, 90vw); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); padding: 10px 14px; font-size: 13px; line-height: 1.45; }
.help-pop ul { margin: 6px 0 0; padding-left: 18px; }
.help-pop li { margin: 3px 0; }
a.button.entry-list { margin-left: auto; align-self: flex-start; font-size: 13px; }

/* --- ТЗ-14: страницы «Пользователи» и «Настройки театра» --- */
.narrow-form label.inline { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 10px; }
.narrow-form label.inline input { display: inline-block; width: auto; margin: 4px 0 0; flex: none; }
.narrow-form select { font: inherit; padding: 6px 8px; border: 1px solid #bdbdbd; border-radius: 6px; margin-top: 4px; display: block; }
table.list form.inline { display: inline; }
table.list form.inline select { font: inherit; padding: 3px 6px; }
header a.who { text-decoration: none; }

/* ---------- дополнительные зоны (ТЗ-11a) ---------- */
.seat.zone { stroke: #8d6e63; stroke-width: .9; stroke-dasharray: 1.6 1.1; }
.seat.zone.issued, .seat.zone.used { stroke: #d32f2f; stroke-dasharray: none; }
.lg i.zone { background: #fff8e1; border: 1.5px dashed #8d6e63; }
details.zones-menu .zone-hint { margin-left: auto; }
details.zones-menu summary { font-size: 14px; color: var(--accent); padding: 2px 6px; }
details.zones-menu .menu-items { left: 0; right: auto; top: 26px; min-width: 340px; width: max-content; max-width: 90vw; padding: 8px 0; }
details.zones-menu .zone-item { display: flex; align-items: center; gap: 8px; padding: 5px 14px; font-size: 14px; cursor: pointer; white-space: nowrap; }
details.zones-menu .zone-item:hover { background: #f5f5f5; }
details.zones-menu .zone-limit { width: 70px; margin-left: 8px; padding: 2px 6px; border: 1px solid #bdbdbd; border-radius: 4px; font: inherit; font-size: 13px; }
details.zones-menu .zone-note { padding: 6px 14px 0; max-width: 320px; white-space: normal; }
