/* Напарник: одна колонка шириной с телефон, нижняя панель разделов, листы снизу для действий. */
:root {
  --bg: #F3F2EE; --surface: #FCFBF8; --sunk: #ECE9E3; --ink: #1D1B18; --muted: #6B655D; --line: #E1DCD3;
  --accent: #9C4A1A; --accent-ink: #FFF8F2; --accent-soft: #F4E5D8;
  --crit: #B42318; --crit-soft: #FBE6E2; --warn: #9A5A00; --warn-soft: #FBEFD9; --ok: #2F6B3F; --ok-soft: #E2F0E4;
  --ghost: #D9D3C9; --backdrop: rgba(29, 20, 12, .45);
  --font-ui: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Unbounded', 'Onest', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141311; --surface: #1E1C19; --sunk: #191714; --ink: #F2EEE8; --muted: #A69F95; --line: #322E29;
  --accent: #E39A5E; --accent-ink: #1E1408; --accent-soft: #3A2A1D;
  --crit: #FF8B7B; --crit-soft: #3A1D19; --warn: #F0B357; --warn-soft: #382A13; --ok: #8BCB99; --ok-soft: #1C3123;
  --ghost: #3A3631; --backdrop: rgba(0, 0, 0, .6); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #141311; --surface: #1E1C19; --sunk: #191714; --ink: #F2EEE8; --muted: #A69F95; --line: #322E29;
  --accent: #E39A5E; --accent-ink: #1E1408; --accent-soft: #3A2A1D;
  --crit: #FF8B7B; --crit-soft: #3A1D19; --warn: #F0B357; --warn-soft: #382A13; --ok: #8BCB99; --ok-soft: #1C3123;
  --ghost: #3A3631; --backdrop: rgba(0, 0, 0, .6); color-scheme: dark }

* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; overflow-x: hidden }
h1, h2, h3, p, ul, ol { margin: 0 }
ul, ol { padding: 0 }
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
button:disabled { cursor: default; opacity: .6 }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }
[hidden] { display: none !important }

.app { width: 100%; max-width: 480px; margin-inline: auto; padding-inline: 16px; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); min-height: 100dvh }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-inline: -16px; padding-inline: 16px }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.wordmark { font: 600 20px/1 var(--font-display); letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px }
.chip-demo { font: 600 11px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 5px 8px; border-radius: 99px }
.place { color: var(--muted); font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 10px; color: var(--muted); display: inline-grid; place-items: center; min-width: 40px; min-height: 40px }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.icon-btn.spin svg { animation: spin .8s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }

main { padding-block: 16px; display: grid; gap: 22px }
.screen-title { font: 600 20px/1.2 var(--font-display); letter-spacing: -0.01em }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.section { display: grid; gap: 10px; min-width: 0 }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px }
.section-h h2 { font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600 }
.section-h .hint { font-size: 13px; color: var(--muted); text-align: right }
.note { font-size: 13px; color: var(--muted) }
.loading { color: var(--muted); padding: 24px 0; text-align: center; animation: loading-in .2s ease .4s both }
@keyframes loading-in { from { opacity: 0 } to { opacity: 1 } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; min-width: 0 }
.card.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok) }
.card.err { background: var(--crit-soft); border-color: transparent; color: var(--crit) }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 12px }
.kpi-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap }
.kpi-label { font-size: 13px; color: var(--muted) }
.kpi-value { font: 600 34px/1.05 var(--font-ui); letter-spacing: -0.02em }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px }
.kpi-row b { display: block; font-size: 18px; font-weight: 600 }
.kpi-row span { font-size: 13px; color: var(--muted) }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap }
.pill.crit { color: var(--crit); background: var(--crit-soft) }
.pill.warn { color: var(--warn); background: var(--warn-soft) }
.pill.ok { color: var(--ok); background: var(--ok-soft) }
.pill.neutral { color: var(--muted); background: var(--sunk) }

.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 12px 8px; min-width: 0 }
.chart svg { display: block; width: 100%; height: auto }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding: 0 4px 6px }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px }

.alert { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px }
.alert-top { display: flex; justify-content: space-between; align-items: center; gap: 10px }
.alert-top h3 { font-size: 16px; font-weight: 600; min-width: 0 }
.alert .gap { color: var(--muted); font-size: 14px }
.actions { display: flex; gap: 8px; flex-wrap: wrap }
.actions.grid2 { display: grid; grid-template-columns: 1fr 1fr }
.actions.grid2 .wide { grid-column: 1 / -1 }
.actions.col { display: grid; grid-template-columns: 1fr }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; min-height: 42px; text-align: center }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.done { background: var(--ok-soft); color: var(--ok); border-color: transparent }
.btn.danger { color: var(--crit) }
.btn.big { width: 100%; padding: 14px; font-size: 16px }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-align: left }

.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) }
.rows > li { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center }
.rows > li:first-child { border-top: 0 }
.rows b { font-weight: 600 }
.rows .sub { color: var(--muted); font-size: 13.5px; grid-column: 1 / -1 }
.rows .sub.inline { grid-column: auto }

.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px }
.order-h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap }
.order-h h3 { font-size: 16px; font-weight: 600 }
.order-h span { font-size: 13px; color: var(--muted) }
.lines { display: grid; gap: 6px }
.lines li { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; font-size: 14px }
.lines li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap }
.order-f { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; flex-wrap: wrap }
.order-f b { font-variant-numeric: tabular-nums }

.stock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) }
.stock li { list-style: none; border-top: 1px solid var(--line) }
.stock li:first-child { border-top: 0 }
.stock .row { width: 100%; background: none; border: 0; text-align: left; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center }
.stock .nm { font-weight: 600; min-width: 0 }
.stock .qty { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--sunk); overflow: hidden }
.bar i { display: block; height: 100% }
.more { padding: 0 14px 12px; font-size: 13.5px; color: var(--muted); display: grid; gap: 6px }

.report-text { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 14px 32px; display: grid; gap: 8px }
.top5 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) }
.top5 li { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px }
.top5 li:first-child { border-top: 0 }
.top5 span { color: var(--muted); font-variant-numeric: tabular-nums }
.top5 b { font-variant-numeric: tabular-nums; font-weight: 600 }
.datenav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; text-align: center }
.datenav .icon-btn svg { width: 20px; height: 20px }

.check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 0 }
.check label { display: flex; gap: 12px; align-items: center; padding: 11px 14px; cursor: pointer; border-top: 1px solid var(--line) }
.check label:first-child { border-top: 0 }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0 }
.check input:checked + span { color: var(--muted); text-decoration: line-through }
.progress { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted) }
.progress .bar { flex: 1; height: 6px }
.photo { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 12px 14px }
.photo img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px }
.photo .thumbs { display: flex; gap: 6px; flex-wrap: wrap }

.recount { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) }
.recount li { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center }
.recount li:first-child { border-top: 0 }
.recount .nm { font-weight: 600 }
.recount .exp { color: var(--muted); font-size: 13px }
.res { grid-column: 1 / -1; font-size: 13.5px }
.res.ok { color: var(--ok) } .res.warn { color: var(--warn) } .res.crit { color: var(--crit) }

.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted) }
.field > span { font-weight: 500 }
.input, .field input, .field select, .field textarea, .recount input {
  width: 100%; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); min-height: 44px }
.recount input { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.4 }
.qty-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px }
.form { display: grid; gap: 14px }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sunk); border-radius: 12px; padding: 4px; gap: 4px }
.seg label { text-align: center; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer }
.seg input { position: absolute; opacity: 0; pointer-events: none }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08) }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13.5px }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent) }
.switch { position: relative; width: 48px; height: 28px; flex: none }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer }
.switch i { position: absolute; inset: 0; background: var(--ghost); border-radius: 99px; transition: background .15s }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2) }
.switch input:checked + i { background: var(--crit) }
.switch input:checked + i::after { transform: translateX(20px) }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px }
.codebox { font: 500 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--sunk); border-radius: 10px; padding: 10px 12px; word-break: break-all; color: var(--ink) }
.log li, .rows.log > li { list-style: none; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px }
.log li:first-child { border-top: 0 }
.log time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums }

.center { min-height: 80dvh; display: grid; align-content: center; gap: 16px; padding-block: 32px }
.center h1 { font: 600 24px/1.2 var(--font-display); letter-spacing: -0.01em; text-wrap: balance }
.center p { color: var(--muted) }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; max-width: 480px; margin-inline: auto }
.tabbar button { background: none; border: 0; border-radius: 10px; padding: 6px 2px; display: grid; justify-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); min-height: 50px }
.tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.tabbar button[aria-current="page"] { color: var(--accent); background: var(--accent-soft) }
@media (min-width: 520px) { .tabbar { border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0 } }

dialog.sheet { margin: auto auto 0; width: 100%; max-width: 480px; border: 0; border-radius: 20px 20px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--surface); color: var(--ink); max-height: 92dvh; overflow: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .18) }
dialog.sheet::backdrop { background: var(--backdrop) }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px }
.sheet-h h2 { font: 600 18px/1.25 var(--font-display); letter-spacing: -0.01em }
#sheet-body { display: grid; gap: 14px }
#sheet-body .rows, #sheet-body .check { background: var(--bg) }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; width: max-content; max-width: min(420px, calc(100vw - 32px)); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30 }
.toast.show { opacity: 1; transform: translate(-50%, 0) }
.toast.err { background: var(--crit); color: #fff }
@media (prefers-reduced-motion: reduce) { .toast, .switch i, .switch i::after { transition: none } .icon-btn.spin svg { animation: none } }
.link.danger { color: var(--crit) }
.install-card { grid-template-columns: minmax(0, 1fr); background: var(--accent-soft); border-color: transparent }
.install-card .note { display: block; margin-top: 2px }
.demo-push { border-color: var(--accent) }
.steps-list { counter-reset: st }
.steps-list li { list-style: none; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line) }
.steps-list li:first-child { border-top: 0 }
.steps-list li::before { counter-increment: st; content: counter(st); font-weight: 700; color: var(--accent) }

/* ---------- пульт оператора ---------- */
body.pult .app { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)) }
body.pult .toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)) }
.kpi-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.cafes { display: grid; gap: 10px }
.cafe { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 6px; color: var(--ink); min-width: 0 }
.cafe-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0 }
.cafe-h b { font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.cafe-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere }
.cafe .line { font-size: 14px }
.line.muted { color: var(--muted); font-size: 13.5px }
.line.crit { color: var(--crit); font-weight: 600; font-size: 13.5px }
.line.warn { color: var(--warn); font-weight: 600; font-size: 13.5px }
.card.warnc { background: var(--warn-soft); border-color: transparent; color: var(--warn) }
.seg.grid2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr }
.marks > li { grid-template-columns: 26px minmax(0, 1fr); align-items: start }
.mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ghost); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px }
.mark.ok { background: var(--ok); border-color: var(--ok); color: var(--surface) }
.marks .sub { display: block; grid-column: auto }
.qr { background: #fff; border-radius: 12px; padding: 6px; width: 240px; max-width: 100%; justify-self: center }
.qr svg { display: block; width: 100%; height: auto }
.file-btn { display: block; cursor: pointer }
.bar i.indeterminate { width: 35%; background: var(--accent); animation: slide 1.4s ease-in-out infinite }
@keyframes slide { 0% { transform: translateX(-100%) } 100% { transform: translateX(290%) } }
@media (prefers-reduced-motion: reduce) { .bar i.indeterminate { animation: none; width: 100%; opacity: .5 } }
a.btn { display: block; text-decoration: none; color: var(--ink) }
a.btn.primary { color: var(--accent-ink) }
.bigcode { font: 600 40px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-align: center; background: var(--sunk); border-radius: 14px; padding: 18px 12px; color: var(--ink) }
.rows.tap > li { padding: 0; display: block }
.rowbtn { width: 100%; background: none; border: 0; text-align: left; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; color: inherit; align-items: baseline }
.rowbtn .sub { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px }
.crit-t { color: var(--crit) }
.recipe { display: grid; gap: 8px }
.recipe li { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) 76px 34px 40px; gap: 6px; align-items: center }
.recipe .input { padding: 8px 10px; min-height: 42px }
.recipe input.input { text-align: right; font-variant-numeric: tabular-nums }
.recipe .unit { color: var(--muted); font-size: 14px }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--ink) }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0 }
.check.pick input:checked + span { text-decoration: none; color: var(--ink) }
.place-btn { background: none; border: 0; padding: 2px 0; font: 600 14px/1.3 var(--font-ui); color: var(--accent); display: inline-flex; align-items: center; gap: 4px; max-width: 100%; text-align: left }
.place-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none }
.cafe .line.warn, .cafe .line.crit { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.marks.setup > li { grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center }
.marks.setup .btn { min-height: 36px; padding: 6px 12px }

.shot { display: block; width: 100%; height: auto; border-radius: 14px; margin: 12px 0 0; background: var(--ghost) }
