:root {
  --bg: #000000; --bar: #0F0F0F; --card: #1D1D1D; --card2: #2A2A2A;
  --text: #FFFFFF; --muted: #A3A3A3;
  --ok: #2EC26A; --warn: #F7C34E; --bad: #FF4D4D;
  --main: linear-gradient(90deg, #EF000E, #8A0076);
  --second: linear-gradient(90deg, #730C97, #581FBF);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Montserrat", system-ui, sans-serif; font-weight: 600;
}
header {
  background: var(--bar); padding: 16px 16px; font-weight: 800; font-size: 18px;
  position: sticky; top: 0;
}
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h2 { font-size: 16px; font-weight: 800; margin: 0 0 16px; }
.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 14px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 8px 0 4px; }
input {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 0;
  background: var(--card2); color: var(--text); font: inherit; font-size: 16px;
}
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.btn {
  display: block; width: 100%; min-height: 56px; margin: 0; padding: 0 16px; border: 0; border-radius: 12px;
  color: #fff; font: inherit; font-weight: 800; font-size: 16px; cursor: pointer;
  background: var(--main);
  line-height: 1.2;   /* 2 рядки з емодзі влазять у 56 */
}
.btn.second { background: var(--second); }
.preview { display: block; width: 100%; max-width: 400px; margin: 16px auto 0;
  border-radius: 6px; background: #fff; image-rendering: pixelated; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 2px solid; font-size: 13px; }
.pill.green { color: var(--ok); border-color: var(--ok); }
.pill.yellow { color: var(--warn); border-color: var(--warn); }
.pill.red { color: var(--bad); border-color: var(--bad); }
#result { margin-top: 16px; min-height: 28px; }

/* --- этап 1: каркас, меню, карта --- */
a { color: inherit; }
header { display: flex; align-items: center; justify-content: space-between; z-index: 5; }
header .brand { text-decoration: none; }
nav.top a { text-decoration: none; color: var(--muted); margin-left: 16px; font-size: 15px; }
h1 { font-size: 22px; font-weight: 800; margin: 4px 0 16px; }
.t-orders { color: #A9A5E8; } .t-sklad { color: #F0877B; }
.t-reserves { color: #2DD4BF; } .t-staff { color: #5BA3E8; }

.row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h2link { font-size: 18px; font-weight: 800; text-decoration: none; }
.tag { background: var(--card2); color: var(--muted); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
ul.places { list-style: none; padding: 0; margin: 16px 0 0; }
ul.places li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--card2); border-radius: 10px; min-height: 44px; padding: 8px 12px; margin-bottom: 8px;
}
ul.places li a { text-decoration: none; flex: 1; }
details { margin-top: 16px; }
details summary { color: var(--muted); cursor: pointer; min-height: 32px; }
details.card summary { font-weight: 800; color: var(--text); }
form.inline { display: flex; gap: 8px; margin-top: 8px; }
form.inline input { flex: 1; }
.btn.small { min-height: 44px; font-size: 14px; width: auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* маленькая — всегда в одну строку */
.btn.danger { background: transparent; border: 2px solid var(--bad); color: var(--bad); }
.btn:disabled { opacity: .4; cursor: default; }
select {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 0;
  background: var(--card2); color: var(--text); font: inherit; font-size: 16px;
}
.border-red { border: 1px solid var(--bad) !important; }
.border-yellow { border: 1px solid var(--warn) !important; }
.crumbs { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.crumbs a { text-decoration: none; }
.stickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stickers .preview { margin: 0; }
.small { font-size: 12px; } .center { text-align: center; } .break { word-break: break-all; }
code { background: var(--card2); padding: 2px 8px; border-radius: 6px; word-break: break-all; }
.result { margin-top: 8px; min-height: 4px; }
.steps { padding-left: 24px; line-height: 1.5; }
.scanres { margin-top: 16px; }

/* --- плашки выбора (как фильтры на макетах) --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; color: var(--text); font-size: 14px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: 10px; background: var(--card2); cursor: pointer; user-select: none;
}
.chip input:checked + span { background: #fff; color: #000; }
.chip input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.stepper { display: flex; gap: 8px; }
.stepper input { text-align: center; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper button {
  flex: 0 0 56px; min-height: 44px; border: 0; border-radius: 10px; background: var(--card2);
  color: var(--text); font: inherit; font-size: 22px; font-weight: 800; cursor: pointer;
}

html { background: var(--bg); }
body { overflow-x: hidden; min-height: 100vh; }
header .brand { display: flex; align-items: center; gap: 16px; color: #fff; }
header .brand img { display: block; height: 24px; width: auto; }
header .vline { width: 1px; height: 22px; background: #fff; opacity: .9; }
header .place { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: .25px; }
nav.top { display: flex; gap: 4px; }
nav.top a { display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0; color: var(--muted); border-radius: 10px; }
nav.top a:hover { color: #fff; background: var(--card); }
/* поля в строку не вылезают за край */
.row > *, form.inline > * { min-width: 0; }
input, select, button { max-width: 100%; }

/* --- этап 2: склад, приёмка, товар --- */
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
textarea {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 0; resize: vertical;
  background: var(--card2); color: var(--text); font: inherit; font-size: 16px;
}
h2.section { margin: 24px 0 8px; color: var(--muted); font-size: 14px; }
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar input { flex: 1; min-width: 0; min-height: 56px; font-size: 17px; }
.searchbar .btn { width: auto; flex: 0 0 auto; }
.badge { display: inline-block; min-width: 22px; padding: 1px 8px; margin-left: 8px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 13px; }
ul.log { list-style: none; margin: 0; padding: 0; }
ul.log li { padding: 8px 0; border-bottom: 1px solid var(--card2); display: flex; flex-direction: column; gap: 2px; }
ul.log li:last-child { border-bottom: 0; }
ul.log a { text-decoration: none; }
a.item-card { display: block; text-decoration: none; }
.item-card b { font-weight: 700; }
.where { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.item-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: -8px 0 16px; }
dl.fields { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px;
  background: var(--card); border-radius: 12px; padding: 16px 16px; }
dl.fields dt { color: var(--muted); font-size: 13px; }
dl.fields dd { margin: 0; word-break: break-all; }
form.act { margin-top: 16px; }
.chosen { background: var(--card2); border-radius: 10px; padding: 16px; color: var(--muted);
  font-weight: 700; margin-bottom: 4px; }
.chosen.on { color: var(--ok); border: 2px solid var(--ok); }
.sticky-action { position: sticky; bottom: calc(var(--navh) + env(safe-area-inset-bottom)); padding: 8px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 3; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 8px 0 0; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: #2EC26A; flex: 0 0 auto; }
.checklist li { padding: 0 12px; }
.checklist .check { margin: 0; min-height: 52px; width: 100%; }
.scanbox { margin-bottom: 8px; }
.picker { margin-top: 8px; }
.picker-group { margin-top: 8px; }
.picker-title { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.picker-filter { margin-bottom: 4px; }
.toast { position: sticky; top: 56px; z-index: 6; margin: 8px 16px 0; padding: 12px 16px; border-radius: 12px;
  font-weight: 700; transition: opacity .4s; }
.toast.ok { background: #0f2a1a; color: var(--ok); border: 2px solid var(--ok); }
.toast.err { background: #2a0f0f; color: var(--bad); border: 2px solid var(--bad); }
.toast.hide { opacity: 0; pointer-events: none; }
.cam { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px; gap: 16px; }
.cam video { width: 100%; max-width: 520px; border-radius: 12px; }
.cam .cam-frame { position: absolute; width: 220px; height: 220px; border: 3px solid #fff; border-radius: 16px;
  box-shadow: 0 0 0 4000px rgba(0,0,0,.35); pointer-events: none; }
.cam p { color: #fff; z-index: 1; }
.cam .btn { max-width: 520px; z-index: 1; }

/* --- этапы 3–6: заявки, резервы, працівники, вхід --- */
.filter { margin-bottom: 16px; }
.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chip-link, .chip-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  background: var(--card); color: var(--text); text-decoration: none; font: inherit; font-size: 14px;
  border: 0; cursor: pointer; white-space: nowrap;
}
.chip-link.on { background: #fff; color: #000; }
.chip-btn { background: var(--card2); }
.chip-btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
form.chip-del { display: inline; margin: 0; }
.cnt { background: var(--card2); color: var(--text); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.chip-link.on .cnt { background: #000; color: #fff; }
.chip.wide { flex: 1 1 100%; }
.chip.wide span { width: 100%; flex-direction: column; align-items: flex-start; justify-content: center; padding: 8px 16px; }
.chip small { font-weight: 600; font-size: 12px; opacity: .75; }
b.big { font-size: 20px; font-weight: 800; }
.nowrap { white-space: nowrap; }
.line { border-top: 1px solid var(--card2); margin-top: 16px; padding-top: 12px; }
.line-head { display: flex; justify-content: space-between; gap: 8px; }
.label-s { color: var(--muted); font-size: 13px; margin: 8px 0 8px; }
details.put summary { color: var(--text); font-weight: 700; margin-top: 8px; }
.row.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row.three .btn { padding: 0 8px; font-size: 13px; }
.row form { flex: 1; margin: 0; }
.qr-big { display: block; width: 100%; max-width: 280px; margin: 16px auto; border-radius: 12px; background: #fff; image-rendering: pixelated; }
.dups { background: var(--card2); border-radius: 10px; padding: 8px 12px; margin-top: 16px; }
.dups p { margin: 4px 0; }
summary.arrived-btn { list-style: none; display: flex; align-items: center; justify-content: center;
  background: var(--main); color: #fff; width: 100%; }
summary.arrived-btn::-webkit-details-marker { display: none; }
hr { border: 0; border-top: 1px solid var(--card2); margin: 16px 0; }
a { -webkit-tap-highlight-color: transparent; }
a[href^="tel:"] { color: var(--text); }
[hidden] { display: none !important; }
/* скрытые radio/checkbox в плашках не должны растягивать страницу (iPhone из-за этого уменьшал всё) */
.chip { position: relative; }
.chip input { width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; left: 0; top: 0; }
html, body { max-width: 100%; }

/* --- компьютер (> 900 px): общий контейнер 1100 px для шапки, контента и нижнего меню --- */
.grid { display: block; }
@media (min-width: 901px) {
  main { padding-top: 24px; padding-bottom: 48px; }
  /* кнопки не на всю ширину: одна — до 400 px, в ряду — делят ряд */
  .btn { max-width: 400px; }
  /* списки карточек — 2 колонки */
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }
  .grid > .card { margin: 0; }
  .grid > .wide { grid-column: 1 / -1; }
}

/* --- v2: карта категорий --- */
a.rule-card { display: block; text-decoration: none; }
a.rule-card b { font-weight: 700; }
a.pill { text-decoration: none; }
.test-res { margin-top: 8px; }
.answer-card .q { color: var(--muted); font-size: 13px; margin-bottom: 4px; word-break: break-word; }

/* --- v3: поштучно с полки --- */
.shelf-sum { margin: -8px 0 16px; }
.shelf-list li a { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.it-name { font-weight: 700; }
.it-spec { color: var(--text); opacity: .85; font-size: 14px; }
.list-filter { margin: 8px 0 4px; }
.take-list li { padding: 4px 8px 4px 4px; }
.take-list form { margin: 0; }
.take-one { flex: 1; min-width: 0; }
.take-btn { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px;
  background: transparent; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; padding: 4px 8px; }
.take-btn b { color: var(--warn); }
.add-form .hint { margin: 8px 0 0; }
.sugg { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sugg-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: #fff; color: #000;
  font: inherit; cursor: pointer; }
.sugg-item .muted { color: #555; }
.known { margin-top: 8px; color: var(--warn); }
textarea#name { min-height: 44px; overflow: hidden; }
.stepper button:disabled { opacity: .35; }
.batch-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.batch-log .toast { position: static; margin: 0; }
.unsorted-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-decoration: none; }
.unsorted-link { display: block; margin-top: 16px; text-decoration: none; }
.pick-shelf { margin-top: 16px; }
.item-title { margin-bottom: 4px; }
.item-spec { margin: 0 0 16px; font-size: 16px; }
.intro { margin: -8px 0 16px; line-height: 1.45; }
.intro a, .many-words a { color: inherit; }
.many-words { display: block; border-radius: 10px; margin: 8px 0 0; line-height: 1.35; }
.col { min-width: 0; }
.add-form .inline, #nf .inline { display: flex; gap: 8px; }
#nf .inline input { flex: 1; min-width: 0; }

/* --- поле «Цінник» у формі «Додати товар» --- */
.tagbox { background: var(--card2); border-radius: 12px; padding: 4px 12px 12px; margin-bottom: 8px; }
.tagbox label { color: var(--text); font-size: 15px; font-weight: 800; margin-top: 8px; }
.tagbox textarea { background: #000; min-height: 112px; }
.tag-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tag-ok { color: var(--ok); } .tag-bad { color: var(--warn); }
label .opt { color: var(--muted); font-weight: 600; font-size: 12px; }
summary .opt { color: var(--muted); font-weight: 600; font-size: 12px; }
.req { color: var(--bad); }

/* --- навигация (23.11): > 900 px — вкладки в шапке, ≤ 900 px — нижняя панель с иконками --- */
:root { --wrap: 1100px; --navh: 64px; }
header { display: block; height: auto; padding: 0; position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--card); }
.hwrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; height: 56px;
  display: flex; align-items: center; gap: 24px; }
.hwrap .brand { flex: 0 0 auto; }
nav.top { margin-left: auto; }
main { max-width: var(--wrap); margin: 0 auto; padding: 16px 16px calc(var(--navh) + 24px + env(safe-area-inset-bottom)); }
.toast { max-width: calc(var(--wrap) - 32px); margin: 8px 16px 0; }
@media (min-width: 1133px) { .toast { margin: 8px auto 0; } }
.t-orders { --tc: #A9A5E8; } .t-sklad { --tc: #F0877B; }
.t-reserves { --tc: #2DD4BF; } .t-staff { --tc: #5BA3E8; }

nav.tabs { display: none; align-self: stretch; gap: 4px; }
nav.tabs a { display: flex; align-items: center; padding: 0 12px; text-decoration: none;
  font-size: 15px; font-weight: 700; color: var(--tc); opacity: .55;
  border-bottom: 2px solid transparent; border-top: 2px solid transparent; transition: opacity .15s; }
nav.tabs a:hover { opacity: .85; }
nav.tabs a.on { opacity: 1; border-bottom-color: var(--tc); filter: brightness(1.15); }

nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  max-width: none; margin: 0; border-radius: 0;
  background: var(--bar); border-top: 1px solid var(--card); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; min-width: 0; height: var(--navh); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; text-decoration: none;
  color: var(--tc); opacity: .55; font-size: 12px; font-weight: 700; position: relative; }
nav.bottom a svg { display: block; flex: 0 0 auto; }
nav.bottom a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.bottom a.on { opacity: 1; }
nav.bottom a.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px;
  border-radius: 2px; background: var(--tc); }

@media (min-width: 901px) {
  nav.tabs { display: flex; }
  nav.bottom { display: none; }
  :root { --navh: 0px; }
  main { padding-top: 24px; padding-bottom: 48px; }
}

/* --- «Склад»: три равные кнопки в ряд под поиском --- */
.searchbar { max-width: none; }
.actions3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.actions3 .btn { max-width: none; padding: 4px 8px; line-height: 1.25;
  font-size: 13px; }
@media (min-width: 560px) { .actions3 .btn { font-size: 15px; } }
@media (min-width: 901px) { .actions3 { gap: 16px; } .actions3 .btn { font-size: 16px; } }

/* ================= v4 (23.11): оформлення в стилі jabko.ua — сітка 8 px ================= */
:root { --line: #2A2A2A; --line-hi: #4A4A4A; --accent: #fff; }
body.tab-orders { --accent: #A9A5E8; } body.tab-sklad { --accent: #F0877B; }
body.tab-reserves { --accent: #2DD4BF; } body.tab-staff { --accent: #5BA3E8; }

/* мягкое фиолетовое свечение за шапкой; сам фон остаётся чёрным */
body { background:
  radial-gradient(ellipse 70% 420px at 50% -80px, rgba(115, 12, 151, .15), rgba(115, 12, 151, 0) 100%) no-repeat,
  var(--bg); }
header { background: rgba(15, 15, 15, .78); -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px); border-bottom: 1px solid rgba(255, 255, 255, .06); }

/* вкладки в шапке: иконка + текст, активная — «таблетка» 15 % цвета вкладки */
nav.tabs { align-self: center; gap: 4px; }
nav.tabs a { height: 40px; padding: 0 16px 0 12px; gap: 8px; border: 0; border-radius: 999px;
  color: var(--tc); opacity: .6; transition: background-color .15s, opacity .15s; }
nav.tabs a .ico { flex: 0 0 auto; }
nav.tabs a:hover { opacity: 1; background: rgba(255, 255, 255, .06); }
nav.tabs a.on { opacity: 1; filter: none; background: rgba(255, 255, 255, .08);
  background: color-mix(in srgb, var(--tc) 15%, transparent); }

/* типографика и ритм */
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; margin: 0 0 16px; letter-spacing: -.2px; }
h2 { font-size: 16px; line-height: 1.3; margin: 0 0 8px; }
main > * + * { margin-top: 0; }
.sub { margin: -8px 0 16px; }
.card { border: 1px solid var(--line); margin-bottom: 16px; transition: border-color .15s; }
.card:hover { border-color: var(--line-hi); }
.grid { gap: 16px; margin-bottom: 24px; }
.searchbar { margin-bottom: 16px; }
.row { gap: 8px; }
.line { margin-top: 16px; padding-top: 16px; }
.filter { margin-bottom: 24px; }
details.card summary { min-height: 24px; }

/* статус заявки/резерва — полоса 3 px слева */
.card.status { border-left-width: 3px; }
.card.st-red { border-left-color: var(--bad); }
.card.st-yellow { border-left-color: var(--warn); }
.card.st-green { border-left-color: var(--ok); }
.card.st-none { border-left-color: var(--line-hi); }

/* сводные карточки сверху страницы — они же фильтры */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 24px; }
.stat { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none;
  color: var(--text); text-align: left; transition: border-color .15s, background-color .15s; }
.stat:hover { border-color: var(--line-hi); }
.stat b { font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; line-height: 1.25; min-width: 0; }
.stat.tone-red b { color: var(--bad); } .stat.tone-yellow b { color: var(--warn); }
.stat.tone-green b { color: var(--ok); }
.stat.on { border-color: var(--accent); background: rgba(255, 255, 255, .06);
  background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.stat.on span { color: var(--text); }
@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .stat { flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px;
    min-height: 96px; padding: 16px; }
}

/* предупреждения: жёлтая плашка → «Налаштувати» (Сервіс) */
.warn { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: 0 0 8px;
  padding: 8px 8px 8px 16px; min-height: 56px; border-radius: 12px; color: var(--warn);
  background: rgba(247, 195, 78, .08); border: 1px solid rgba(247, 195, 78, .45); font-size: 14px; }
.warn .ico { flex: 0 0 auto; }
.warn span { flex: 1 1 180px; color: #FBE3A6; }
.warn-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; margin-left: auto;
  border-radius: 10px; background: var(--warn); color: #000; font-weight: 800; font-size: 14px;
  text-decoration: none; white-space: nowrap; }
.warn-btn:hover { filter: brightness(1.08); }
.warns { margin-bottom: 24px; }
.warns .warn:last-child { margin-bottom: 0; }
@media (max-width: 599px) {
  .warn { flex-wrap: nowrap; padding: 8px 8px 8px 12px; font-size: 13px; line-height: 1.3; }
  .warn span { flex: 1 1 auto; }
  .warn-btn { padding: 0 12px; font-size: 13px; }
}

/* пустые состояния: иконка 48, заголовок, одна строка, главное действие */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 24px; gap: 16px; }
.empty-ico { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); background: rgba(255, 255, 255, .05);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.empty h2 { font-size: 18px; margin: 0; }
.empty p { margin: 0; max-width: 420px; }
.empty .btn { width: auto; min-width: 240px; padding: 0 24px; }
.empty-text { display: flex; flex-direction: column; align-items: center; gap: 8px; }
@media (max-width: 599px) { .empty .btn { width: 100%; } }

/* ================= v5 (23.11): Сервіс, Сканер, превью наклеек ================= */
/* иконки справа в шапке: текущая страница подсвечена (вкладки при этом не подсвечены) */
nav.top a.on { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
body.tab-service, body.tab-scan { --accent: #fff; }

h2.section { margin: 24px 0 8px; color: var(--muted); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; }
main > h1 + h2.section, .warns + h2.section { margin-top: 0; }

/* сетка карточек: 3 в ряд на компьютере, 1 на телефоне */
.grid3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 8px; }
.grid3 > .card { margin: 0; }
@media (min-width: 700px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.scard { display: flex; flex-direction: column; gap: 8px; }
.scard-head { display: flex; align-items: center; gap: 16px; min-height: 40px; }
.scard-head b { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.scard-head .pill { flex: 0 0 auto; font-size: 12px; padding: 2px 8px; white-space: nowrap; }
.scard-ico { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  background: var(--card2); color: #fff; }
.scard-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.label-fields .scard-note { margin: 8px 0 0; }
.scard > .scard-note { flex: 1 0 auto; }   /* действие карточки прижато вниз — без margin у кнопки */
.scard .btn.small { width: 100%; max-width: none; }
.howto summary { list-style: none; display: flex; align-items: center; justify-content: center; }
.howto summary::-webkit-details-marker { display: none; }
.howto[open] summary { background: var(--card2); }
.big-date { font-size: 28px; font-weight: 800; line-height: 1.1; }
.big-date small { font-size: 16px; color: var(--muted); font-weight: 700; }
.pathline { display: flex; align-items: center; gap: 8px; }
.pathline code.path { flex: 1; min-width: 0; background: none; padding: 0; color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; direction: rtl; text-align: left; }
.pathline .chip-btn { flex: 0 0 auto; gap: 8px; }

/* шаги 1-2-3 с номерами в кружках */
ol.nsteps { list-style: none; counter-reset: st; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 16px; }
ol.nsteps li { counter-increment: st; position: relative; padding-left: 40px; min-height: 28px; font-size: 14px;
  line-height: 1.45; color: #DADADA; }
ol.nsteps li::before { content: counter(st); position: absolute; left: 0; top: -2px; width: 28px; height: 28px;
  border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff;
  background: var(--second); }

/* сворачиваемая карточка: иконка + заголовок + подзаголовок + шеврон */
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 16px; cursor: pointer;
  min-height: 40px; color: var(--text); }
details.fold > summary::-webkit-details-marker { display: none; }
.fold-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fold-title b { font-weight: 700; font-size: 15px; }
.fold-chev { flex: 0 0 auto; color: var(--muted); display: grid; transition: transform .15s; }
details.fold[open] > summary .fold-chev { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 8px; }
details.fold form[data-print] { margin-top: 16px; }

/* превью этикетки = настоящая наклейка 50×30 */
.sticker { margin: 0; display: inline-flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
.sticker img { display: block; width: 300px; max-width: 100%; height: auto; aspect-ratio: 50 / 30;
  background: #fff; border-radius: 6px; image-rendering: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06); }
.sticker figcaption { color: var(--muted); font-size: 12px; }
.stickers { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; margin: 8px 0 16px; }
details .sticker, form > .sticker { margin: 16px auto 0; display: flex; }

/* тестовая этикетка: слева поля и кнопка, справа превью */
.label-test { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: center; margin-top: 8px; }
.label-test .btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.label-side { display: flex; justify-content: center; padding: 24px 16px 16px; border-radius: 12px;
  background: radial-gradient(circle at 50% 40%, #2a2a2a, #161616 70%); }
.label-side .sticker { margin: 0; }
@media (min-width: 760px) { .label-test { grid-template-columns: minmax(0, 1fr) 360px; } }

/* Сканер */
.scan-hero { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 24px 16px; }
.scan-ico { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: var(--second); }
.scan-form label { color: var(--text); font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.scan-row { display: flex; gap: 8px; }
.big-input { min-height: 56px; font-size: 20px; font-weight: 700; letter-spacing: .3px; border: 1px solid var(--line);
  background: #111; }
.big-input:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .08); }
.scan-row .btn { width: auto; padding: 0 24px; }
.scan-form .hint { margin: 8px 0 0; }
.scanres { margin-top: 0; padding: 16px; border-radius: 12px; background: rgba(255, 77, 77, .06);
  border: 1px solid rgba(255, 77, 77, .35); }
.scanres p { margin: 8px 0 0; }
@media (min-width: 700px) {
  .scan-hero { grid-template-columns: 64px 1fr; padding: 24px; align-items: start; }
  .scan-hero .scanres { grid-column: 2; }
}
@media (min-width: 901px) { .phone-only { display: none !important; } }

ul.recent { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
ul.recent a { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 12px 8px 8px;
  text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s; }
ul.recent a:hover { border-color: var(--line-hi); }
.recent-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-t b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-empty { margin: 0 0 24px; }
@media (min-width: 901px) { ul.recent { grid-template-columns: 1fr 1fr; } }

/* пустое состояние с формой на месте */
.empty-form { width: 100%; max-width: 560px; margin-top: 8px; text-align: left; }

/* ================= v6 (23.11): ціннік з Команди, номенклатура, камера, полірування ================= */
/* пилюлі: текст ніколи не обрізаємо — у шапках карток вони не стискаються, довгі переносяться */
.pill { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.row-head .pill, .scard-head .pill, .line-head .pill { flex: 0 0 auto; white-space: nowrap; }

/* картка товару */
h1.item-title { margin: 0 0 8px; }
.item-spec { margin: 0 0 8px; }
.item-meta { margin: 8px 0 16px; gap: 8px; }
.item-meta .tag { display: inline-flex; align-items: center; min-height: 24px; }
main > .grid > .col > :first-child, main > .grid > .col > .card:first-child { margin-top: 0; }
.acts2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.acts2 > form { margin: 0; }
.acts2 .btn, .acts2 summary.btn { width: 100%; max-width: none; }
.btn.outline { background: var(--card2); border: 1px solid var(--line-hi); }
.btn.outline:hover { border-color: #6a6a6a; }
details.move { margin: 0; }
details.move.solo, details.move[open] { grid-column: 1 / -1; }
details.move > summary { list-style: none; display: flex; align-items: center; justify-content: center; color: #fff; }
details.move > summary::-webkit-details-marker { display: none; }
details.move[open] > summary { background: var(--card); }
details.move > form { margin-top: 8px; }

/* швидкі кнопки під заголовком полиці / партії */
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.quick-row .btn { flex: 1 1 160px; width: auto; max-width: none; }
.quick-row .cam-hint { flex: 1 1 100%; margin: 0; }
@media (min-width: 901px) { .quick-row .btn { flex: 0 1 280px; } }
.quick-row:not(:has(> :not([hidden]))) { display: none; }

/* «Розпізнані рядки» */
.lchips { display: flex; flex-wrap: wrap; gap: 8px; }
.lchip { min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-hi);
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  max-width: 100%; overflow-wrap: anywhere; }
.lchip.on { background: #fff; color: #000; border-color: #fff; }
.lchip.junk:not(.on) { text-decoration: line-through; opacity: .6; }
#lines-wrap { margin-top: 16px; }

/* поле, яке програма заповнила сама */
.filled { box-shadow: 0 0 0 2px var(--ok) !important; background: rgba(46, 194, 106, .1) !important;
  transition: box-shadow .3s, background-color .3s; }

/* номенклатура в пошуку */
.g-title { font-weight: 700; font-size: 16px; }
.g-places { margin: 8px 0 0; line-height: 1.5; }
.g-places a { text-decoration: none; color: var(--ok); }
.g-places a:hover { text-decoration: underline; }
details.units { margin-top: 8px; }
.unit-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.unit-list a { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: 10px;
  background: var(--card2); text-decoration: none; }
.unit-list .u-main { font-weight: 700; }

/* заявки: де лежить і вибір серед схожих */
.found-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.found-line a.pill { text-decoration: none; }
.choose { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.choose form { margin: 0; }
.choice { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 44px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-hi); background: var(--card2); color: #fff;
  font: inherit; text-align: left; cursor: pointer; }
.choice:hover { border-color: #fff; }

/* камера (html5-qrcode) */
.cam-reader { width: 100%; max-width: 520px; border-radius: 12px; overflow: hidden; background: #000; }
.cam-reader video { width: 100% !important; border-radius: 12px; }

/* Сервіс → Перевірка бота */
#bot-test { display: flex; flex-direction: column; gap: 8px; }
.qr-mid { display: block; width: 168px; height: 168px; border-radius: 10px; background: #fff; image-rendering: pixelated; flex: 0 0 auto; }
.bt-link { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.bt-link ol.nsteps { flex: 1 1 240px; margin: 0; }
.bt-state { background: var(--card2); border-radius: 10px; padding: 12px 16px; margin-top: 8px; }
.bt-state .label-s { margin: 0 0 4px; }
.bt-state p { margin: 0 0 4px; overflow-wrap: anywhere; }
.bt-state.flash { outline: 2px solid var(--ok); }
.bt-acts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
.bt-acts form { margin: 0; }
.bt-acts .btn { width: 100%; max-width: none; white-space: normal; line-height: 1.3; padding: 8px 16px; }
@media (min-width: 900px) { .bt-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bt-more { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: start; }
.bt-more form { margin: 0; }
.bt-more .btn.small { width: 100%; max-width: none; white-space: normal; }
@media (min-width: 700px) { .bt-more { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#bot-test details.howto .qr-mid { margin: 12px 0 0; }
.bt-more summary.btn { width: 100%; max-width: none; }

/* 23.11: бейдж «Треба зробити» на вкладці «Резерви» */
nav.tabs a, nav.bottom a { position: relative; }
.todo-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; line-height: 1; }
.todo-badge[hidden] { display: none; }
nav.tabs .todo-badge { margin-left: 2px; }
nav.bottom .todo-badge { position: absolute; top: 6px; left: calc(50% + 6px); }
/* «Хто я» в шапці */
nav.top a.who { width: auto; min-width: 44px; padding: 0 10px; gap: 8px; }
nav.top a.who.on { color: #fff; background: var(--card); }
.who-name { font-size: 14px; font-weight: 700; color: #fff; max-width: 120px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .who-name { display: none; } }
.who-now { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-chips .chip-btn { padding: 0 20px; font-size: 16px; }
.chip-btn.on { background: #fff; color: #000; }

/* «Треба зробити» */
.todo { margin-bottom: 24px; }
.todo-head { display: flex; align-items: center; gap: 8px; }
.todo-head h2 { margin: 0; flex: 1; }
.todo-empty { margin: 8px 0 0; }
.todo-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-row { display: flex; gap: 16px; align-items: center; background: var(--card2); border-radius: 10px;
  padding: 12px 12px 12px 16px; border-left: 3px solid var(--warn); }
.todo-row.tone-red { border-left-color: var(--bad); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--warn); }
.tone-red .todo-label { color: var(--bad); }
.todo-title { overflow-wrap: anywhere; }
.todo-main .muted { overflow-wrap: anywhere; }
.todo-place { font-size: 16px; font-weight: 800; color: #fff; overflow-wrap: anywhere; margin-top: 2px; }
.todo-act { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.todo-act form { margin: 0; }
.todo-act .btn.small { min-width: 120px; width: 100%; }
.todo-act .chip-btn { width: 100%; justify-content: center; }
.btn.danger-fill { background: var(--bad); }
@media (max-width: 600px) {
  .todo-row { flex-direction: column; align-items: stretch; }
  .todo-act { flex-direction: row; }
  .todo-act > * { flex: 1; }
}

/* Червона картка «Не актуально — зняти з полиці» */
.where-big { font-size: 20px; font-weight: 800; line-height: 1.25; margin: 8px 0 4px; overflow-wrap: anywhere; }
.where-big small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.btn.took-off { background: var(--bad); width: 100%; max-width: 400px; }

/* Журнал дій */
.log-table { list-style: none; margin: 0; padding: 0; }
.log-table li { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 16px; padding: 12px 0;
  border-bottom: 1px solid var(--card2); }
.log-table li:last-child { border-bottom: 0; }
.log-when { color: var(--muted); font-size: 13px; }
.log-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.log-what b { overflow-wrap: anywhere; }
.log-what .muted { overflow-wrap: anywhere; }
.log-who { font-weight: 700; }
.log-bot { color: #2DD4BF; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.log-link { display: flex; align-items: center; gap: 16px; text-decoration: none; color: #fff; }
.log-link > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.todo-link { display: flex; justify-content: space-between; align-items: center; gap: 16px; text-decoration: none; color: #fff; }

/* ================= v7 (23.11): кнопки и интервалы =================
   У .btn нет margin нигде. Расстояния — только gap контейнера:
   .stack — 16 px (блоки формы/карточки), .row и .acts — 8 px (кнопки и поля в ряд).
   Высоты кнопок ровно две: .btn — 56 (основная), .btn.small — 44 (маленькая). */
.stack { display: flex; flex-direction: column; gap: 16px; }
/* :is(..., form.inline) поднимает специфичность выше правил вида form.inline / ul.places */
.stack > :is(*, form.inline) { margin-top: 0; margin-bottom: 0; }
.stack > .btn { align-self: flex-start; }
.fields > label:first-child, .fields > .row:first-child label { margin-top: 0; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.acts > * { flex: 1 1 140px; min-width: 0; }
.acts > form { display: flex; }
.acts > form > .btn { flex: 1 1 auto; }
.acts.col > * { flex-basis: 100%; }
.acts > :only-child { flex-grow: 0; flex-basis: 400px; }   /* одна кнопка в ряду — як одиночна, ≤ 400 */   /* столбиком: каждая кнопка на всю ширину */
.acts .btn, .acts summary.btn { width: 100%; max-width: none; }
@media (min-width: 901px) {
  .acts { max-width: 560px; }
  .acts.wide { max-width: none; }
}
/* details: содержимое под заголовком — отступом у содержимого, не у кнопки */
details[open] > summary + * { margin-top: 8px; }
details.fold[open] > summary + * { margin-top: 0; }
.chead > :last-child { margin-bottom: 0; }
.stack > .result:empty { display: none; }
ul.places li:last-child { margin-bottom: 0; }

/* 24.11: «📸 Сфотографувати цінник» — камера з рамкою під цінник */
.cam.ocr { justify-content: flex-start; padding-top: max(16px, env(safe-area-inset-top)); overflow-y: auto; }
.ocr-view { position: relative; width: 100%; max-width: 520px; border-radius: 12px; overflow: hidden; background: #111; }
.ocr-view video { display: block; width: 100%; height: auto; }
.ocr-frame { position: absolute; left: 7.5%; width: 85%; aspect-ratio: 50 / 31; top: 50%; transform: translateY(-50%);
  border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 4000px rgba(0, 0, 0, .45); pointer-events: none; }
.cam.no-cam .ocr-view { display: none; }
.ocr-msg { margin: 0; text-align: center; max-width: 520px; color: #fff; }
.ocr-msg.bad { color: var(--warn); }
.ocr-btns { width: 100%; max-width: 520px; }
.ocr-btns .btn.small { flex-basis: 100%; }
label.btn.ocr-file { display: flex; align-items: center; justify-content: center; cursor: pointer; }
@media (min-width: 700px) { .scan-hero .ocr-btn { grid-column: 2; } }
@media (max-width: 900px) { .quick-row .btn.wide { flex-basis: 100%; } }   /* довга назва — свій рядок на телефоні */

/* Сервіс → Команда для iPhone: посилання для бота + QR */
.sc-share { background: var(--card2); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.sc-share .label-s { margin: 0 0 8px; }
.sc-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.sc-form { flex: 1 1 260px; min-width: 0; }

/* 24.11: кілька товарів у замовленні працівника */
.items-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.items-list { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.item-row { align-items: center; }
.item-row > .chip-btn { flex: 0 0 44px; width: 44px; padding: 0; justify-content: center; }

.del-order { color: var(--bad); align-self: flex-start; }


/* 24.11: сторінка замовлення /reserve/<id> */
.order-page { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.order-page > .col.stack > .card { margin: 0; }
.order-page .sec-h { margin: 0; font-size: 18px; }
.order-page .card.is-current { border-color: #fff; }
.order-page .card.status.st-none { border-left-width: 1px; }
.call-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; max-width: 400px; }
.line-foot { display: flex; gap: 8px; flex-wrap: wrap; }
.raw-msg { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; color: var(--muted);
  background: var(--card2); border-radius: 10px; padding: 12px; margin: 8px 0 0; }
a.card-link { color: inherit; text-decoration: none; }
a.card-link:hover { text-decoration: underline; }
.row.three .btn { white-space: normal; line-height: 1.15; overflow-wrap: anywhere; }
.order-page details.put > summary.btn { display: flex; align-items: center; justify-content: center; max-width: 400px; list-style: none; }
.order-page details.put > summary.btn::-webkit-details-marker { display: none; }

/* 24.11: кілька товарів в одній картці замовлення */
.oline + .oline { border-top: 1px solid var(--card2); padding-top: 16px; }
.oline-name { font-size: 16px; font-weight: 800; }

