/* Layout: phone-first guest app (menu → ticket-style checkout → order tracker); staff panel is a tablet board of order columns.
   Identity: espresso ink, cherry-red accent (the coffee fruit), steamed-milk ground; Unbounded for names and numbers, Onest for reading, JetBrains Mono for receipts and times. */
:root {
  --bg: #F6F5F3; --surface: #FFFFFF; --ink: #1E1714; --muted: #6F635D; --line: #E4DFDB; --line-2: #D5CEC9;
  --accent: #BE2F38; --accent-2: #A3242D; --on-accent: #FFFFFF; --soft: #F7E8E8;
  --ok: #2E7A4D; --ok-soft: #E3F1E8; --warn: #A86A00; --warn-soft: #FBF0D9; --bad: #B3261E; --info: #2F5E9E; --info-soft: #E5EDF8;
  --shadow: rgba(30, 23, 20, .16);
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 16px; --r-s: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151110; --surface: #211A18; --ink: #F2EAE6; --muted: #A99993; --line: #3A302C; --line-2: #4A3E39;
    --accent: #EE5A62; --accent-2: #F47A80; --on-accent: #1C0A0B; --soft: #3A2224;
    --ok: #62BE88; --ok-soft: #1E3326; --warn: #E2A93B; --warn-soft: #3A2E17; --bad: #F2726B; --info: #8DB4EE; --info-soft: #1E2A3D;
    --shadow: rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151110; --surface: #211A18; --ink: #F2EAE6; --muted: #A99993; --line: #3A302C; --line-2: #4A3E39;
  --accent: #EE5A62; --accent-2: #F47A80; --on-accent: #1C0A0B; --soft: #3A2224;
  --ok: #62BE88; --ok-soft: #1E3326; --warn: #E2A93B; --warn-soft: #3A2E17; --bad: #F2726B; --info: #8DB4EE; --info-soft: #1E2A3D;
  --shadow: rgba(0, 0, 0, .5); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
body.has-bar { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
body.noscroll { overflow: hidden; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.lab { font-family: var(--mono); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.err { color: var(--bad); font-size: 14px; margin: 0; }
.err.info, .info-box { color: var(--ink); background: var(--soft); padding: 10px 12px; border-radius: var(--r-s); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.warn-t { color: var(--bad); font-weight: 600; }

/* boot / spinner */
.boot { min-height: 50vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); padding: 24px; text-align: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* demo strip */
.demo-bar { background: var(--soft); font-size: 13px; line-height: 1.4; }
.demo-bar .wrap { padding-block: 9px; }
.demo-bar a { font-weight: 600; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 16px; text-decoration: none; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); text-decoration: none; flex: none; }
.me.on { border-color: var(--ink); }
.ava { font-family: var(--display); font-weight: 500; font-size: 15px; }

.page { padding-block: 8px 40px; min-height: 60vh; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-block: 12px 32px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.foot a { color: var(--muted); }

/* hero */
.hero { padding-block: 20px 8px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 8vw, 50px); line-height: 1.04; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status.closed::before { background: var(--muted); }
.lead { max-width: 56ch; margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.h-page { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 6vw, 34px); line-height: 1.1; margin: 8px 0 16px; text-wrap: balance; }
.h-sec { font-family: var(--display); font-weight: 500; font-size: 18px; margin: 28px 0 12px; }

.active-order { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--bg); text-decoration: none; font-size: 15px; }
.active-order b { font-family: var(--mono); }

/* chips & segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; line-height: 1.2; cursor: pointer; min-height: 40px; transition: background .15s, border-color .15s, color .15s; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { font-family: var(--mono); font-size: 12px; opacity: .72; margin-left: 4px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-top: 16px; max-width: 100%; }
.field .seg { margin-top: 0; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 8px 18px; cursor: pointer; font-weight: 500; min-height: 38px; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); }

.cats { position: sticky; top: calc(57px + env(safe-area-inset-top, 0px)); z-index: 10; background: var(--bg); display: flex; gap: 8px; padding: 12px 16px; margin: 8px -16px 0; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats .chip { flex: none; }

.repeat { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); padding: 12px 14px; margin-top: 12px; font-size: 14px; }
.repeat p { margin: 0; min-width: 0; color: var(--muted); }
.repeat b { color: var(--ink); font-weight: 600; }

/* menu rows */
.cat { scroll-margin-top: 130px; }
.cat h2 { font-family: var(--display); font-weight: 500; font-size: 17px; margin: 26px 0 2px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; width: 100%; padding: 14px 0; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.row .tx { min-width: 0; display: grid; gap: 2px; }
.nm { font-weight: 600; font-size: 16px; }
.ds { color: var(--muted); font-size: 14px; line-height: 1.4; }
.pr { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font-size: 20px; line-height: 1; transition: background .15s, color .15s; }
.row:hover .plus { background: var(--ink); color: var(--bg); }
.row.off { cursor: default; opacity: .55; }
.row.off .plus { visibility: hidden; }
.row.off:hover .plus { background: none; }
.tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; background: var(--line); color: var(--muted); white-space: nowrap; }
.incart { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 12px; vertical-align: 2px; margin-left: 4px; }
.empty-note { color: var(--muted); padding: 24px 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 10px 18px; min-height: 44px; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; text-align: center; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--bg); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-big { min-height: 54px; font-size: 16px; width: 100%; }
.grow { flex: 1; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; cursor: pointer; justify-self: start; font-size: 14px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 12px 0 4px; text-decoration: none; color: var(--muted); font-size: 15px; }

/* cart bar */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.cartbar-in { pointer-events: auto; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); text-decoration: none; box-shadow: 0 12px 30px -10px var(--shadow); font-weight: 600; }
.cb-count { min-width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--on-accent); color: var(--accent); font-family: var(--mono); font-size: 14px; padding: 0 8px; }
.cb-text { flex: 1; }
.cb-sum { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* bottom sheet */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(15, 10, 8, .45); }
.sheet-back.enter { animation: fade .2s ease; }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; outline: none; }
.sheet.enter { animation: up .25s ease; }
.sheet h2 { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.15; margin: 0; padding-right: 40px; }
.sheet .muted { margin: -8px 0 0; }
.sheet .x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 22px; line-height: 1; cursor: pointer; }
.og { display: grid; gap: 8px; }
.sheet-foot { display: flex; gap: 12px; align-items: center; position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); background: var(--surface); padding: 12px 0 0; margin-top: 4px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; height: 48px; flex: none; }
.stepper button { width: 44px; height: 100%; border: 0; background: none; font-size: 20px; cursor: pointer; }
.stepper span { min-width: 2ch; text-align: center; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sheet-foot .btn { min-height: 48px; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); border-radius: 22px; }
  .sheet.enter { animation: pop .2s ease; }
  .sheet-foot { bottom: -20px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%); } }

/* ticket (checkout + order) */
.checkout { max-width: 560px; margin: 8px auto 0; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px 24px; box-shadow: 0 18px 40px -28px var(--shadow); }
.t-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.t-title { font-family: var(--display); font-weight: 500; font-size: 20px; margin: 0; }
.code { font-family: var(--mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lines { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm pr" "op qt"; gap: 4px 12px; align-items: center; }
.lines.static .line { grid-template-areas: "nm pr" "op op"; }
.line.warn .l-nm { text-decoration: line-through; color: var(--muted); }
.l-nm { grid-area: nm; font-weight: 600; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.lines.static .l-nm { cursor: default; }
.l-pr { grid-area: pr; font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.l-op { grid-area: op; color: var(--muted); font-size: 13px; min-width: 0; }
.qty { grid-area: qt; display: flex; align-items: center; gap: 8px; justify-self: end; }
.qb { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: none; font-size: 16px; line-height: 1; cursor: pointer; }
.qn { font-family: var(--mono); min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.sum { display: grid; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.sum > div { display: flex; justify-content: space-between; gap: 12px; }
.sum > div span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sum-total { font-weight: 600; font-size: 16px; align-items: baseline; }
.sum-total b { font-family: var(--mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.perf { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 22px -21px; }
.perf::before, .perf::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.perf::before { left: -11px; clip-path: inset(0 0 0 50%); }
.perf::after { right: -11px; clip-path: inset(0 50% 0 0); }

/* forms */
.form { display: grid; gap: 18px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
legend { padding: 0; margin-bottom: 8px; }
.field { display: grid; gap: 8px; min-width: 0; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=time], input[type=url], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 11px 12px; min-height: 46px; color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
input[type=time] { width: auto; font-family: var(--mono); min-height: 40px; padding: 7px 10px; }
.custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.radios { display: grid; gap: 10px; }
.radio { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.radio input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.radio small { display: block; color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 14px; }
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.cta > div { min-width: 0; flex: 1 1 260px; }
.cta p { margin: 4px 0 0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.empty-block { display: grid; gap: 12px; justify-items: start; padding-block: 24px; }
.empty-block p { margin: 0; }

/* order status */
.order-view { max-width: 560px; margin: 8px auto 0; }
.big-num { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; margin: 14px 0 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.o-head { font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.25; margin: 0 0 14px; text-wrap: balance; }
.o-head.ready { color: var(--ok); }
.track { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; counter-reset: s; }
.track li { display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.track li::before { content: ""; height: 6px; border-radius: 3px; background: var(--line); }
.track li.done::before { background: var(--ink); }
.track li.now::before { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.track li.now { color: var(--ink); font-weight: 600; }
.track li span { min-width: 0; overflow-wrap: anywhere; }
@keyframes pulse { 50% { opacity: .45; } }
.when { font-family: var(--mono); font-size: 14px; margin: 14px 0 4px; }
.pay { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-s); background: var(--bg); border: 1px solid var(--line); font-size: 14px; display: grid; gap: 2px; }
.pay b { font-size: 15px; }
.pay.act { background: var(--warn-soft); border-color: transparent; }
.pay.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-weight: 600; }
.o-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 12px; border-radius: var(--r-s); background: var(--soft); }
.confirm p { margin: 0; flex: 1 1 100%; font-weight: 600; }

/* history */
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hist-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.hist-main { min-width: 0; flex: 1; display: grid; gap: 4px; text-decoration: none; }
.hist-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hist-top b { font-family: var(--mono); }
.hist-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-side { display: grid; justify-items: end; gap: 6px; flex: none; }
.chip-s { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--ink); font-weight: 500; }
.st-new { background: var(--info-soft); color: var(--info); }
.st-accepted { background: var(--warn-soft); color: var(--warn); }
.st-ready, .st-on_the_way { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--soft); color: var(--bad); }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 90; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px -10px var(--shadow); max-width: calc(100vw - 32px); text-align: center; animation: fade .2s ease; }
.toast.good { background: var(--ok); }
.toast.bad { background: var(--bad); }

/* =====================================================================
   Панель персонала
   ===================================================================== */
body.admin-mode { background: var(--bg); }
.adm-top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.adm-top-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-block: 10px; }
.adm-brand { font-family: var(--display); font-weight: 700; font-size: 15px; margin-right: auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.adm-brand small { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.adm-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs button { flex: none; border: 0; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--muted); min-height: 40px; }
.adm-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.adm-tabs .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 11px; }
.adm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; margin: 0; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px var(--shadow); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.live::before { background: var(--ok); }
.conn.off::before { background: var(--bad); }
.adm-page { padding-block: 16px 40px; }
.adm-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: var(--r); background: var(--warn-soft); margin-bottom: 14px; font-size: 14px; }
.adm-banner.bad { background: var(--soft); }

/* board */
.stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.stats b { font-family: var(--mono); color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.board { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.col { display: grid; gap: 12px; min-width: 0; }
.col-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--display); font-weight: 500; font-size: 15px; padding: 2px 4px; }
.col-h .n { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.col-empty { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.ocard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 14px 18px; display: grid; gap: 10px; overflow: hidden; min-width: 0; }
.ocard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--info); }
.ocard.s-accepted::before { background: var(--warn); }
.ocard.s-ready::before, .ocard.s-on_the_way::before { background: var(--ok); }
.ocard.fresh { animation: fresh 1.4s ease 2; }
@keyframes fresh { 50% { box-shadow: 0 0 0 4px var(--soft); } }
.oc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.oc-num { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.oc-time { text-align: right; display: grid; gap: 2px; justify-items: end; }
.oc-time b { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; }
.left { font-family: var(--mono); font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.left.soon { background: var(--warn-soft); color: var(--warn); }
.left.late { background: var(--soft); color: var(--bad); font-weight: 600; }
.oc-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15px; }
.oc-who b { font-weight: 600; }
.oc-phone { font-family: var(--mono); font-size: 13px; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline dotted; }
.oc-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.oc-items li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
.oc-q { font-family: var(--mono); font-weight: 600; font-size: 15px; min-width: 2.2ch; }
.oc-q.many { color: var(--accent); }
.oc-n { font-weight: 600; }
.oc-d { grid-column: 2; color: var(--muted); font-size: 13px; }
.oc-d.mark { color: var(--ink); background: var(--warn-soft); border-radius: 4px; padding: 0 4px; justify-self: start; }
.oc-note { background: var(--warn-soft); border-radius: var(--r-s); padding: 8px 10px; font-size: 14px; }
.oc-addr { background: var(--info-soft); border-radius: var(--r-s); padding: 8px 10px; font-size: 14px; }
.oc-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.oc-pay .sumv { font-family: var(--mono); font-weight: 600; margin-right: auto; font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.badge.unpaid { background: var(--soft); color: var(--bad); border-color: transparent; }
.badge.invoice_sent { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.del { background: var(--info-soft); color: var(--info); border-color: transparent; }
.oc-act { display: flex; flex-wrap: wrap; gap: 8px; }
.oc-act .btn { flex: 1 1 auto; }
.oc-main { min-height: 50px; font-size: 16px; }
.done-list { margin-top: 24px; }
.done-list summary { cursor: pointer; font-family: var(--display); font-weight: 500; font-size: 15px; padding: 8px 0; }
.done-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.done-row .num { font-family: var(--mono); font-weight: 600; }
.done-row .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.done-row .pr { text-align: right; }

/* menu editor */
.ed { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .ed { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); } .ed-panel { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; } }
.ed-list { display: grid; gap: 16px; min-width: 0; }
.ed-cat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 14px 10px; }
.ed-cat-h { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ed-cat-h h3 { font-family: var(--display); font-weight: 500; font-size: 16px; margin: 0; margin-right: auto; min-width: 0; }
.ed-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ed-item:last-child { border-bottom: 0; }
.ed-item .tx { min-width: 0; display: grid; gap: 1px; }
.ed-item.hidden-p .nm { color: var(--muted); text-decoration: line-through; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-size: 16px; flex: none; }
.iconbtn:hover { border-color: var(--muted); }
.ed-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.ed-panel h3 { font-family: var(--display); font-weight: 500; font-size: 18px; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.sz-row, .md-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 100px 38px; gap: 8px; align-items: center; }
.md-row { grid-template-columns: minmax(0, 1fr) 96px auto 38px; }
.sz-row input, .md-row input { min-height: 40px; padding: 8px 10px; }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sub-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* stop list */
.stop-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.stop-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stop-item.off { background: var(--soft); border-color: transparent; }
.stop-item .nm { min-width: 0; }

/* settings & team */
.set-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.set-grid .card h3 { font-family: var(--display); font-weight: 500; font-size: 16px; margin: 0 0 14px; }
.team-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.team-row .em { margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.team-row select { width: auto; min-height: 38px; padding: 6px 10px; }
.login-box { max-width: 420px; margin: 40px auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Статистика
   ===================================================================== */
.st-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 10px; }
.st-bar .chips { flex: 1 1 auto; }
.st-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.st-dates input { width: auto; min-height: 40px; padding: 6px 10px; font-family: var(--mono); font-size: 14px; }
.st-cap { margin: 4px 0 16px; font-size: 13px; color: var(--muted); max-width: 90ch; }
.st-cap b { color: var(--ink); font-weight: 600; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-v { font-family: var(--display); font-weight: 500; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-main .kpi-v { font-size: 30px; font-weight: 700; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); font-weight: 400; }

.st-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .st-wide { grid-column: 1 / -1; } }
.st-card { padding: 16px 18px 18px; min-width: 0; }
.st-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.st-h h3, .st-card summary h3 { font-family: var(--display); font-weight: 500; font-size: 16px; margin: 0; }
.st-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.st-card summary::-webkit-details-marker { display: none; }
.st-card summary::after { content: "▾"; color: var(--muted); }
.st-card[open] summary { margin-bottom: 12px; }
.st-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.st-note b { color: var(--ink); font-weight: 600; }
.st-sub { font-size: 14px; margin: 16px 0 8px; font-weight: 600; }
.seg-sm { margin-top: 0; padding: 3px; }
.seg-sm button { min-height: 32px; padding: 4px 12px; font-size: 13px; }

/* column chart */
.cc { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.cc-y { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(-0.5em); }
.cc-y span { line-height: 1; }
.cc-main { min-width: 0; }
.cc-plot { position: relative; height: 200px; }
.cc-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.cc-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; }
.cc-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.cc-col:hover, .cc-col:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 4px; }
.cc-bar { display: block; width: min(24px, 100%); background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.cc-bar.dim { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.cc-val { position: absolute; left: 50%; transform: translate(-50%, -4px); font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink); white-space: nowrap; pointer-events: none; }
.cc-x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cc-x span { text-align: center; white-space: nowrap; overflow: visible; }

/* heatmap */
.hm-wrap { overflow-x: auto; padding-bottom: 4px; }
.hm { display: grid; grid-template-columns: 28px repeat(var(--cols), minmax(22px, 1fr)); gap: 3px; min-width: calc(28px + var(--cols) * 25px); }
.hm-hx { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; }
.hm-wd { font-size: 12px; color: var(--muted); align-self: center; }
.hm-c { display: block; height: 26px; border-radius: 4px; background: var(--bg); outline: none; }
.hm-c:focus-visible, .hm-c:hover { box-shadow: 0 0 0 2px var(--ink); }
.hm-c.l1 { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.hm-c.l2 { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.hm-c.l3 { background: color-mix(in srgb, var(--accent) 54%, var(--surface)); }
.hm-c.l4 { background: color-mix(in srgb, var(--accent) 76%, var(--surface)); }
.hm-c.l5 { background: var(--accent); }
.hm-key { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.hm-key .hm-c { width: 16px; height: 12px; border-radius: 3px; }
.hm-key .hm-c:first-child { margin-left: 4px; }
.hm-key .hm-c:last-child { margin-right: 4px; }

/* tables */
.tbl-wrap { overflow-x: auto; }
.tbl-wrap + .tbl-wrap { margin-top: 12px; }
.st-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.st-tbl td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.st-tbl tr:last-child td { border-bottom: 0; }
.st-tbl .num { text-align: right; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-tbl th.num { font-family: var(--body); font-size: 12px; }
.bar-th { width: 32%; }
.bar-td { display: flex; align-items: center; gap: 8px; padding-right: 0; min-width: 90px; }
.hbar { display: block; height: 10px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.pct { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.st-list li { display: flex; justify-content: space-between; gap: 12px; }
.st-list b { font-family: var(--mono); }

.chart-tip { position: fixed; z-index: 95; pointer-events: none; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; max-width: 260px; box-shadow: 0 8px 20px -8px var(--shadow); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) {
  .kpi-main { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-v { font-size: 20px; }
  .kpi-main .kpi-v { font-size: 30px; }
  .cc-y, .cc-plot { height: 170px; }
}
