@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b1018; --panel: #121b27; --panel2: #0f1722; --line: #243244; --line2: #2c3a4b;
  --text: #edf4f7; --muted: #8f9dae; --dim: #6f8292;
  --teal: #b9ef9e; --mint: #6cd2b3; --gold: #e5c98c; --red: #fd8585;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, Arial, sans-serif; font-size: 14px; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
.pos { color: var(--teal); }
.neg { color: var(--red); }
.warn-t { color: var(--gold); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 68px; display: flex; align-items: center; gap: 24px;
  padding: 0 28px; background: rgba(11, 16, 24, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.6px; font-size: 17px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; border: 1px solid #4c7664; border-radius: 10px; width: 40px; height: 40px; color: var(--teal); font-size: 26px; }
.brand-light { color: var(--teal); }
.brand small { display: block; font-size: 8px; letter-spacing: 2.5px; color: #8c9da6; margin-top: 2px; }
.top-nav { display: flex; gap: 4px; margin-left: 12px; }
.top-nav a { padding: 8px 12px; border-radius: 8px; font-size: 12px; color: #9fb0bf; }
.top-nav a:hover { color: var(--teal); background: #172430; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }
.ghost { cursor: pointer; background: transparent; color: #d4e0e8; border: 1px solid #31404f; border-radius: 8px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn { cursor: pointer; background: var(--teal); color: #0b1a12; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; padding: 13px; font-size: 15px; }

/* ---------- Раскладка ---------- */
.layout { display: grid; grid-template-columns: 410px minmax(0, 1fr); gap: 22px; max-width: 1760px; margin: 0 auto; padding: 22px 28px 40px; }
.controls { position: sticky; top: 86px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: #2c3a4b transparent; }
.results { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
section, #summary { scroll-margin-top: 84px; }

/* ---------- Карточки параметров ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 12px; }
.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 15px 18px; font-weight: 700; font-size: 15px; }
.card > summary::-webkit-details-marker { display: none; }
.card > summary::after { content: '▾'; margin-left: 8px; color: var(--dim); transition: transform .2s; }
.card:not([open]) > summary::after { transform: rotate(-90deg); }
.card .sum { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; color: var(--teal); }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #1b2c2a; color: var(--teal); font-size: 12px; font-weight: 800; flex: none; }
.card-body { padding: 0 18px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #9aaaba; }
.field.inline { margin-top: 14px; }
input[type=number], input[type=text], input[type=password] {
  width: 100%; min-width: 0; background: #0d1520; border: 1px solid var(--line2); color: #f0f5f5; border-radius: 8px; padding: 10px; outline: 0; font-size: 14px;
}
input:focus { border-color: var(--teal); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.hint { font-size: 12px; color: #7d8b9b; line-height: 1.6; margin: 12px 0 0; }
.hint.top { margin: 0 0 10px; }
.msg { font-size: 12px; color: var(--teal); min-height: 0; margin-top: 6px; }
.msg:empty { display: none; }
.msg.bad { color: var(--red); }

.slider-box { margin-bottom: 14px; }
.slider-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #b7c4d2; }
.slider-head b { color: var(--teal); font-size: 26px; font-weight: 800; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 8px 0 2px; background: transparent; cursor: pointer; --pct: 20%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--teal) var(--pct), #2a3848 var(--pct)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--teal); border: 4px solid #0b1018; box-shadow: 0 0 0 1px var(--teal); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: #2a3848; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--teal); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--teal); border: 4px solid #0b1018; }
.endpoints { display: flex; justify-content: space-between; color: #718595; font-size: 11px; }

.stepper-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: #b7c4d2; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; height: 42px; border: 0; background: #16212e; color: var(--teal); font-size: 22px; cursor: pointer; }
.stepper button:hover { background: #1d2c3a; }
.stepper output { min-width: 52px; text-align: center; font-size: 22px; font-weight: 800; }
.mini-tables { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; min-height: 16px; }
.mini-tables i { width: 30px; height: 16px; border-radius: 50%; background: #173a2e; border: 2px solid #4b896f; }

.list { display: flex; flex-direction: column; gap: 6px; }
.list-head { display: grid; gap: 6px; font-size: 11px; color: var(--dim); margin-bottom: 4px; padding: 0 2px; }
.list-head.staff, .list-row.staff { grid-template-columns: minmax(0, 1fr) 54px 96px 30px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px; gap: 6px; align-items: center; }
.list-row input { padding: 8px 9px; font-size: 13px; }
.del { width: 30px; height: 34px; border: 1px solid transparent; background: transparent; color: #75879a; border-radius: 7px; cursor: pointer; font-size: 18px; line-height: 1; }
.del:hover { color: var(--red); border-color: #4a2d33; background: #241a20; }
.empty { font-size: 12px; color: var(--dim); padding: 8px 2px; line-height: 1.5; }
.add { margin-top: 8px; width: 100%; background: transparent; border: 1px dashed #3a4a5c; color: var(--teal); padding: 9px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.add:hover { border-color: var(--teal); background: #14231f; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button { background: #16212e; border: 1px solid var(--line2); color: #a9b9c7; border-radius: 100px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.chips button::before { content: '+ '; color: var(--teal); }
.chips button:hover { border-color: var(--teal); color: var(--text); }
.auto-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #9aaaba; background: #0d1520; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 6px; }
.auto-row b { color: var(--text); font-weight: 600; text-align: right; }

.save-row { display: flex; gap: 8px; }
.scenario-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.scenario { display: flex; align-items: center; gap: 4px; background: #0d1520; border: 1px solid var(--line); border-radius: 9px; }
.scenario:hover { border-color: #3d5a4c; }
.sc-open { flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; padding: 9px 10px; cursor: pointer; }
.sc-open b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-open small { display: block; font-size: 11px; color: var(--dim); margin-top: 3px; }

/* ---------- Итоги ---------- */
.verdict { background: linear-gradient(120deg, #15282a, #121b27); border: 1px solid #2f4b42; border-radius: 13px; padding: 18px 22px; font-size: 16px; line-height: 1.6; color: #d7e3e8; }
.verdict.bad { background: linear-gradient(120deg, #2a1a1f, #121b27); border-color: #5a333a; }
.verdict b { color: var(--text); }
.verdict b.pos { color: var(--teal); }
.verdict b.neg { color: var(--red); }
.verdict .warn { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 14px; color: var(--gold); }

.kpis { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.kpi, .panel { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.kpi { padding: 18px; min-width: 0; }
.main-kpi { background: linear-gradient(120deg, #1a3632, #172727); border-color: #46694e; }
.main-kpi.loss { background: linear-gradient(120deg, #3a1f25, #241a20); border-color: #6a3a42; }
.main-kpi.loss .big-num { color: var(--red); }
.cap { font-size: 11px; color: #9eadb4; letter-spacing: 1px; font-weight: 700; text-transform: uppercase; }
.big-num { font-size: clamp(26px, 2.4vw, 38px); font-weight: 800; color: var(--teal); letter-spacing: -1.5px; margin: 12px 0 6px; white-space: nowrap; }
.kpi-num { font-size: clamp(20px, 1.7vw, 28px); font-weight: 800; letter-spacing: -1px; margin: 14px 0 6px; white-space: nowrap; }
.unit { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.sub { font-size: 12px; color: #94a3ae; line-height: 1.45; }

.scenarios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.sc-card { text-align: left; cursor: pointer; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.sc-card:hover { border-color: var(--mint); }
.sc-card.base { border-color: #3d5a4c; background: #13211f; }
.sc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 700; }
.sc-g { font-size: 13px; color: #b7c4d2; }
.sc-card b { font-size: 20px; color: var(--teal); letter-spacing: -.5px; }
.sc-card.loss b { color: var(--red); }
.sc-card small { font-size: 11px; color: var(--dim); }

/* ---------- Панели и графики ---------- */
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 19px; letter-spacing: -.5px; margin-top: 5px; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--teal); text-transform: uppercase; }
.subdued { color: #8394a3; font-size: 12px; }
.sub-h { font-size: 15px; margin: 24px 0 10px; color: #cbd8e0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #9daeb5; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.pos { background: var(--teal); }
.dot.neg { background: var(--red); }
.dash { width: 16px; border-top: 2px dashed var(--gold); display: inline-block; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: Manrope, Arial, sans-serif; }
.chart .grid { stroke: #223041; stroke-dasharray: 3 5; }
.chart .axis { fill: #7f93a3; font-size: 11px; }
.chart .axis.cur-t { fill: var(--teal); font-weight: 800; font-size: 13px; }
.chart .axis-title { fill: #6f8292; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.chart .lbl { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart .lbl.dim { fill: #9aaaba; font-weight: 600; }
.chart .lbl.gold { fill: var(--gold); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: rgba(255, 255, 255, .04); }
.chart .bar { cursor: pointer; }
.chart .bar:hover rect:nth-child(2) { fill-opacity: .8; }
.chart .cbar:hover { fill-opacity: 1; }

.waterfall { display: flex; flex-direction: column; gap: 7px; }
.wf-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 74px; gap: 10px; align-items: center; font-size: 12px; }
.wf-name { color: #a9b9c7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-row.rev .wf-name, .wf-row.profit .wf-name, .wf-row.loss .wf-name { color: var(--text); font-weight: 700; }
.wf-track { position: relative; height: 20px; background: #0e1620; border-radius: 4px; }
.wf-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: #7fc8f8; }
.wf-row.rev .wf-bar { background: #4f8f86; }
.wf-row.profit .wf-bar { background: var(--teal); }
.wf-row.loss .wf-bar { background: var(--red); }
.wf-row.cost .wf-bar { opacity: .85; }
.wf-zero { position: absolute; top: -2px; bottom: -2px; width: 1px; background: #5d7383; }
.wf-val { text-align: right; font-weight: 700; white-space: nowrap; }
.wf-row.cost .wf-val { color: #c5a3a8; }
.wf-row.profit .wf-val { color: var(--teal); }
.wf-row.loss .wf-val { color: var(--red); }

.donut-wrap { display: flex; gap: 24px; align-items: center; }
.donut-box { position: relative; width: 210px; flex: none; }
#donut { width: 100%; display: block; }
#donut .seg { cursor: pointer; transition: stroke-width .15s; }
#donut .seg:hover { stroke-width: 36; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center small { font-size: 10px; color: #94a4b3; letter-spacing: 1.2px; }
.donut-center strong { font-size: 20px; margin-top: 4px; }
.cost-legend { flex: 1; min-width: 0; }
.cost-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px auto; align-items: center; gap: 8px; font-size: 12px; padding: 7px 0; border-bottom: 1px solid #1c2836; }
.cost-row .cn { display: flex; align-items: center; gap: 8px; color: #a9b9c7; line-height: 1.35; }
.cost-row b { white-space: nowrap; }
.cost-row .pct { color: var(--dim); text-align: right; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

.hall-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 24px; align-items: center; }
.floor-box { background: radial-gradient(ellipse at center, #13202a, #0e161f); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.floor { width: 100%; max-height: 420px; display: block; }
.ptable { cursor: default; }
.ptable .felt { fill: #173a2e; stroke: #4b896f; stroke-width: 3; }
.ptable .felt-in { fill: none; stroke: #2d5549; stroke-width: 1.5; }
.ptable.over .felt { stroke: var(--red); }
.ptable .seat { fill: #1a2633; stroke: #3a4c5e; stroke-width: 1.5; }
.ptable .seat.on { fill: var(--teal); stroke: #3d6b52; }
.ptable.over .seat.on { fill: var(--red); stroke: #7a3a42; }
.ptable .dealer { fill: var(--gold); }
.ptable .tname { fill: #8fc4a8; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; font-family: Manrope, Arial, sans-serif; }
.ptable:hover .felt { fill: #1d4637; }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: #b7c4d2; }
.gauge-head b { font-size: 30px; font-weight: 800; }
.gauge-track { position: relative; height: 14px; background: #0e1620; border-radius: 10px; margin: 10px 0 6px; overflow: hidden; }
.gauge-track .band { position: absolute; left: 40%; width: 40%; top: 0; bottom: 0; background: rgba(185, 239, 158, .09); border-left: 1px dashed #3d5a4c; border-right: 1px dashed #3d5a4c; }
.gauge-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; background: linear-gradient(90deg, var(--mint), var(--teal)); }
.gauge-track i.over { background: linear-gradient(90deg, var(--gold), var(--red)); }
.gauge-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.stats div { background: #0e1620; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.stats dt { font-size: 11px; color: var(--dim); }
.stats dd { margin: 4px 0 0; font-size: 17px; font-weight: 800; }
.legend-inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: 4px; }
.seat-ic { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #1a2633; border: 1px solid #3a4c5e; }
.seat-ic.on { background: var(--teal); }
.dealer-ic { width: 12px; height: 8px; border-radius: 2px; display: inline-block; background: var(--gold); }

.per-guest .pg-head { font-size: 16px; line-height: 1.55; margin: 0 0 16px; color: #d7e3e8; }
.pg-bar { position: relative; display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: #0e1620; }
.pg-bar i { display: block; height: 100%; border-right: 2px solid var(--panel); }
.pg-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #fff; box-shadow: 0 0 0 2px var(--panel); }
.pg-legend { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.pg-legend div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #1c2836; }
.pg-legend span { display: flex; align-items: center; gap: 8px; color: #a9b9c7; }
.pg-legend b { white-space: nowrap; }

.table-scroll { overflow-x: auto; }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; min-width: 520px; }
.heatmap th { color: #8a9baa; font-weight: 600; padding: 8px 6px; white-space: nowrap; }
.heatmap tbody th { width: 56px; }
.heatmap th.corner { text-align: left; font-size: 11px; color: var(--dim); }
.heatmap th.cur-col { color: var(--teal); }
.heatmap td { text-align: center; padding: 11px 6px; border-radius: 6px; font-weight: 700; cursor: pointer; white-space: nowrap; color: #f2f7f9; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.heatmap td:hover { outline: 2px solid rgba(255, 255, 255, .5); }
.heatmap td.cur { outline: 3px solid #fff; outline-offset: -1px; }

.report { width: 100%; border-collapse: collapse; font-size: 13px; }
.report td, .report th { padding: 10px 6px; border-bottom: 1px solid #1f2d3c; }
.report td:last-child, .report th:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.report td:first-child { color: #a3b3c0; }
.report th { text-align: left; color: #8a9baa; font-weight: 600; font-size: 12px; }
.report .group td { color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; padding-top: 16px; border-bottom-color: #2c3a4b; }
.report .subtotal { background: #172331; }
.report .subtotal td { color: #e2efe8; font-weight: 800; }
.report .final { background: #20382d; }
.report .final td { color: var(--teal); font-weight: 800; font-size: 15px; }
.report .final.loss { background: #3a1f25; }
.report .final.loss td { color: var(--red); }
.report .muted td { color: var(--dim); }
.staff-table { min-width: 440px; }
.tag { font-size: 10px; color: var(--teal); border: 1px solid #375749; border-radius: 100px; padding: 2px 7px; margin-left: 4px; white-space: nowrap; }

footer { display: flex; gap: 24px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 18px; }
footer div { white-space: nowrap; font-weight: 800; font-size: 12px; }
footer span { color: var(--teal); }
footer p { color: #778796; font-size: 12px; line-height: 1.6; max-width: 760px; margin: 0; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: #050a10; border: 1px solid #3d5a4c; color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 12px; line-height: 1.55; white-space: pre-line; max-width: 280px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.mobile-bar { display: none; }
.menu-btn, .m-nav { display: none; }
button, summary, a, input[type=range] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.stepper.small { border-radius: 9px; }
.stepper.small button { width: 36px; height: 34px; font-size: 20px; }
.stepper.small b { min-width: 52px; text-align: center; color: var(--teal); font-size: 24px; font-weight: 800; }

/* ---------- Вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at top, #15282a, var(--bg) 60%); }
.login-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.login-box h1 { font-size: 28px; letter-spacing: -1px; margin: 28px 0 6px; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box input { padding: 13px; font-size: 16px; }
.login-error { background: #3a1f25; border: 1px solid #6a3a42; color: #ffc2c2; border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1400px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .main-kpi { grid-column: span 3; }
  .top-nav { display: none; }
}
@media (max-width: 1250px) {
  .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .topbar { height: 60px; padding: 0 12px; gap: 8px; }
  .menu-btn { display: inline-flex; margin-left: auto; width: 46px; height: 42px; align-items: center; justify-content: center; font-size: 20px; }
  .top-actions {
    display: none; position: absolute; right: 12px; top: calc(100% + 6px); flex-direction: column; align-items: stretch; gap: 2px;
    min-width: 220px; padding: 6px; background: #0f1722; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  }
  .top-actions.open { display: flex; }
  .top-actions form { width: 100%; }
  .top-actions .ghost { width: 100%; text-align: left; border: 0; padding: 13px 14px; font-size: 15px; border-radius: 8px; }
  .top-actions .ghost:hover, .top-actions .ghost:active { background: #172430; }

  .layout { grid-template-columns: 1fr; padding: 12px 12px calc(86px + env(safe-area-inset-bottom)); gap: 0; }
  body[data-view=results] .controls { display: none; }
  body[data-view=params] .results { display: none; }
  .controls { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .hall-grid { grid-template-columns: 1fr; }
  section, #summary { scroll-margin-top: 122px; }

  .m-nav {
    display: flex; position: sticky; top: 60px; z-index: 15; gap: 6px; overflow-x: auto; margin: -12px -12px 0; padding: 10px 12px;
    background: rgba(11, 16, 24, .95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); scrollbar-width: none;
  }
  .m-nav::-webkit-scrollbar { display: none; }
  .m-nav a { flex: none; padding: 8px 14px; border-radius: 100px; border: 1px solid var(--line2); font-size: 14px; color: #a9b9c7; }
  .m-nav a.on { background: var(--teal); border-color: var(--teal); color: #0b1a12; font-weight: 700; }

  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 12px; align-items: center;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(9, 14, 21, .97); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
  }
  .mb-num { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .mb-num small:first-child { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .8px; }
  .mb-num b { font-size: 20px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
  #mbBreak { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mb-tabs { display: flex; gap: 3px; padding: 3px; background: #0d1520; border: 1px solid var(--line2); border-radius: 12px; flex: none; }
  .mb-tabs button { border: 0; background: transparent; color: #a9b9c7; height: 44px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: 15px; cursor: pointer; }
  .mb-tabs button[aria-selected=true] { background: var(--teal); color: #0b1a12; }

  /* крупные поля и кнопки под палец; 16px — чтобы iPhone не приближал страницу при вводе */
  input[type=number], input[type=text], input[type=password] { font-size: 16px; padding: 11px 10px; min-height: 46px; }
  .list-row input { font-size: 16px; padding: 10px 8px; }
  .card > summary { padding: 16px; min-height: 56px; font-size: 16px; }
  .card-body { padding: 0 14px 16px; }
  .field { font-size: 13px; }
  .del { width: 40px; height: 46px; font-size: 22px; }
  .add { padding: 13px; font-size: 15px; }
  .chips { gap: 8px; }
  .chips button { padding: 10px 14px; font-size: 14px; }
  .stepper button { width: 52px; height: 48px; }
  .stepper.small button { width: 44px; height: 42px; }
  .btn { padding: 12px 16px; font-size: 15px; }
  .sc-open { padding: 12px; }
  .sc-open b { font-size: 15px; }
  .sc-open small { font-size: 12px; }
  .hint { font-size: 13px; }
  input[type=range] { height: 40px; }
  input[type=range]::-webkit-slider-thumb { width: 30px; height: 30px; margin-top: -12px; }
  input[type=range]::-moz-range-thumb { width: 22px; height: 22px; }
}
@media (max-width: 700px) {
  .brand small { display: none; }
  .brand-mark { width: 34px; height: 34px; font-size: 22px; }
  .brand { font-size: 15px; gap: 8px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .main-kpi { grid-column: span 2; }
  .kpi { padding: 14px; }
  .kpi-num { font-size: 22px; margin: 10px 0 4px; }
  .big-num { font-size: 32px; margin: 8px 0 4px; }
  .sub { font-size: 12px; }
  .scenarios { grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
  .sc-card { padding: 12px 14px; }
  .verdict { font-size: 15px; padding: 14px 15px; margin-top: 12px; }
  .results { gap: 12px; }
  .row2 { gap: 12px; }
  .panel { padding: 16px 14px; }
  .panel-head { margin-bottom: 12px; }
  .panel-head h2 { font-size: 18px; }
  .donut-wrap { flex-direction: column; align-items: stretch; gap: 14px; }
  .donut-box { margin: 0 auto; width: 200px; }
  .cost-row { font-size: 13px; padding: 8px 0; }
  .wf-row { grid-template-columns: minmax(84px, 36%) 1fr 62px; gap: 6px; font-size: 12px; }
  .wf-track { height: 22px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .floor-box { padding: 8px; }
  .heatmap { min-width: 0; border-spacing: 2px; font-size: 11px; }
  .heatmap th { padding: 6px 2px; font-size: 11px; }
  .heatmap tbody th { width: 34px; }
  .heatmap td { padding: 10px 2px; }
  .report { font-size: 13px; }
  .report td, .report th { padding: 10px 4px; }
  .staff-table { min-width: 0; font-size: 12px; }
  .staff-table td, .staff-table th { padding: 9px 3px; }
  .tag { display: none; }
  .pg-head { font-size: 15px; }
  footer { display: block; padding-bottom: 8px; }
  footer p { margin-top: 10px; }
  .grid2 { gap: 10px; }
  .list-row { grid-template-columns: minmax(0, 1fr) 108px 40px; gap: 5px; }
  .list-head.staff, .list-row.staff { grid-template-columns: minmax(0, 1fr) 50px 92px 40px; gap: 5px; }
}

/* ---------- Печать / PDF ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .controls, .mobile-bar, .tip, .hint { display: none !important; }
  .layout { display: block; padding: 0; }
  .results { gap: 12px; }
  .panel, .kpi, .verdict, .sc-card { break-inside: avoid; }
  .row2 { grid-template-columns: 1fr; }
}
.hint.top-sub { margin: 6px 0 0; }
