* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* атрибут hidden має перемагати будь-який display у класах */
[hidden] { display: none !important; }
:root {
  --bg: #f7f8fa; --card: #fff; --ink: #0f1720; --dim: #6b7885; --line: #e6eaef;
  --acc: #1a56db; --acc-soft: #eaf0fd; --ok: #0f7b47; --warn: #c2410c; --sig: #e08a12;
  --frozen: #0b6f92; --frozen-bg: #e8f4f9;
  --dry: #92400e; --dry-bg: #fdf5ec;
  --side: 244px;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; }

/* ══ ОБОЛОНКА ═══════════════════════════════════════════ */
#shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── бічна навігація ───────────────────────────────────── */
.side { width: var(--side); flex: none; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side-top { display: flex; align-items: center; padding: 18px 18px 14px; }
.logo { font-size: 19px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.x-side { display: none; background: none; border: 0; font-size: 26px; line-height: 1;
  color: var(--dim); cursor: pointer; padding: 0 4px; }
#nav { flex: 1; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px;
  background: none; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
  font: 600 14.5px inherit; color: var(--ink); }
#nav button:hover { background: var(--bg); }
#nav button[aria-current="true"] { background: var(--acc-soft); color: var(--acc); }
#nav svg { flex: none; opacity: .8; }
.side-me { border-top: 1px solid var(--line); padding: 12px 14px; display: flex;
  align-items: center; gap: 10px; }
.side-me .av { width: 36px; height: 36px; border-radius: 11px; background: var(--acc); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13.5px; flex: none; }
.side-me .who2 { flex: 1; min-width: 0; }
.side-me .who2 b { display: block; font-size: 14px; font-weight: 650; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.side-me .who2 span { display: block; font-size: 12px; color: var(--dim); }
.side-me button { background: none; border: 0; padding: 7px; cursor: pointer; color: var(--dim);
  display: flex; border-radius: 8px; }
.side-me button:hover { background: var(--bg); color: var(--warn); }
.side-veil { display: none; }

/* ── шапка ─────────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.93);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding: 12px 24px; display: flex; align-items: center; gap: 12px; min-height: 60px; }
.top h1 { font-size: 19px; margin: 0; font-weight: 700; flex: 1; min-width: 0;
  letter-spacing: -.015em; overflow: hidden; }
.top .sub { display: block; font-size: 12.5px; color: var(--dim); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.back, .burger { background: none; border: 0; padding: 8px; margin: -8px 0 -8px -8px;
  cursor: pointer; color: var(--ink); display: flex; border-radius: 8px; }
.back:hover, .burger:hover { background: var(--bg); }
.burger { display: none; }
.rdy { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700;
  color: var(--ok); letter-spacing: .06em; text-transform: uppercase; flex: none; white-space: nowrap; }
.rdy i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: block; }
.rdy.busy { color: var(--sig); } .rdy.busy i { background: var(--sig); }

.pbar { height: 3px; background: var(--line); }
.pbar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }

.wrap { flex: 1; padding: 22px 24px 30px; max-width: 940px; width: 100%; }

/* ── загальні блоки ────────────────────────────────────── */
.sect { font-size: 12px; font-weight: 700; color: var(--dim); text-transform: uppercase;
  letter-spacing: .06em; margin: 24px 2px 10px; }
.sect:first-child { margin-top: 0; }

.wh { border-radius: 14px; overflow: hidden; margin-bottom: 14px; background: var(--card);
  border: 1px solid var(--line); }
.wh > header { display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.wh.frozen > header { background: var(--frozen-bg); color: var(--frozen); }
.wh.dry > header { background: var(--dry-bg); color: var(--dry); }
.wh > header .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh > header .tmp { font-size: 12px; font-weight: 700; opacity: .75; flex: none; }

.row { display: flex; align-items: center; gap: 15px; padding: 14px 18px;
  border-top: 1px solid var(--line); cursor: pointer; background: var(--card); }
.row:hover { background: #fafbfc; }
.row:active { background: #f2f5f9; }
.row .m { flex: 1; min-width: 0; }
.row .m b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .m span { display: block; font-size: 12.5px; color: var(--dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { font-size: 22px; font-weight: 800; letter-spacing: -.02em; flex: none; text-align: right;
  font-variant-numeric: tabular-nums; }
.row .n u { display: block; font-size: 11px; font-weight: 600; color: var(--dim);
  text-decoration: none; margin-top: 1px; }
.row .chev { color: #c3ccd6; flex: none; }
.row.done { background: #fbfcfd; }
.row.done .m b { color: var(--dim); font-weight: 500; }
.row.done .n { color: var(--ok); font-size: 16px; }

.code { font: 700 12px/1 ui-monospace, "SF Mono", Consolas, monospace; color: var(--dim);
  background: #eff3f7; padding: 5px 8px; border-radius: 7px; flex: none; letter-spacing: .02em; }
.exp { font-size: 11.5px; font-weight: 600; color: var(--dim); }
.exp.soon { color: var(--warn); }

.plate { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; margin-bottom: 14px; }
.plate .cap { padding: 13px 18px 0; font-size: 12px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em; }
.bskt { width: 32px; height: 32px; border-radius: 10px; background: var(--acc); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }

/* картка позиції */
.hero { text-align: center; padding: 26px 18px 20px; }
.hero .n { font-size: 92px; font-weight: 800; line-height: .86; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums; }
.hero .u { font-size: 15px; color: var(--dim); font-weight: 600; margin-top: 10px; }
.hero .where { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  background: var(--acc); color: #fff; padding: 8px 14px; border-radius: 9px;
  font-size: 13px; font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 9px; padding: 15px 18px 18px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 9px; text-align: center; }
.tile .kk { font-size: 10.5px; font-weight: 700; color: var(--dim); letter-spacing: .08em;
  text-transform: uppercase; }
.tile .vv { font-size: 32px; font-weight: 800; line-height: 1.05; margin-top: 3px;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .cc { font-size: 11px; color: var(--dim); margin-top: 3px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

/* ── кнопки ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border: 0; border-radius: 12px; font-size: 16px;
  font-weight: 700; cursor: pointer; background: var(--acc); color: #fff; letter-spacing: -.01em; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.99); filter: brightness(.95); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); filter: none; }
.btn.warn { background: var(--card); color: var(--warn); border: 1.5px solid #f0d5c4; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.acts .btn { flex: 0 0 auto; }

.bar { border-top: 1px solid var(--line); background: var(--card);
  padding: 12px 24px; display: flex; gap: 10px; position: sticky; bottom: 0; z-index: 15; }

.tip { font-size: 13.5px; color: var(--dim); margin-bottom: 16px; line-height: 1.5; max-width: 70ch; }
.empty { text-align: center; color: var(--dim); padding: 70px 20px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 18px; border-top: 1px solid var(--line); }
th { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(8px); bottom: 32px;
  z-index: 60; background: #0f1720; color: #fff; padding: 13px 20px; border-radius: 12px;
  font-size: 15px; font-weight: 600; opacity: 0; transition: all .22s; pointer-events: none;
  max-width: 88%; box-shadow: 0 8px 24px rgba(15,23,32,.22); }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--warn); }

/* ── сканер ────────────────────────────────────────────── */
#scan { position: fixed; inset: 0; background: #000; z-index: 50; display: none; }
#scan video { width: 100%; height: 100%; object-fit: cover; }
#scan .x { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,.55); color: #fff;
  border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 24px; cursor: pointer; }
#scan .fr { position: absolute; left: 10%; right: 10%; top: 40%; height: 120px;
  border: 3px solid rgba(255,255,255,.9); border-radius: 16px; }
#scan .hint { position: absolute; left: 0; right: 0; bottom: 48px; text-align: center;
  color: #fff; font-size: 15px; font-weight: 500; }

/* ══ ВХІД ═══════════════════════════════════════════════ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 28px 16px; background: var(--bg); }
.auth .box { width: min(400px, 100%); display: grid; gap: 18px; }
.auth .brand { text-align: center; display: grid; gap: 6px; }
.auth .brand b { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.auth .brand span { font-size: 13.5px; color: var(--dim); }
.who { display: grid; gap: 8px; }
.who button { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 62px;
  padding: 10px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; cursor: pointer; text-align: left; }
.who button:hover { border-color: #c9d4e0; background: #fcfdfe; }
.who button:active { background: #f2f5f9; }
.who .av { width: 42px; height: 42px; border-radius: 12px; background: var(--acc); color: #fff;
  flex: none; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.who .nm { flex: 1; min-width: 0; }
.who .nm b { display: block; font-size: 15.5px; font-weight: 650; }
.who .nm span { display: block; font-size: 12.5px; color: var(--dim); }
.role-g { font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase;
  letter-spacing: .07em; margin: 12px 4px 2px; }
.role-g:first-child { margin-top: 0; }

.pinhead { text-align: center; display: grid; gap: 4px; }
.pinhead b { font-size: 19px; font-weight: 700; }
.pinhead span { font-size: 13px; color: var(--dim); }
.pinhead span.err { color: var(--warn); font-weight: 600; }
.dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 4px; }
.dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); }
.dots i.on { background: var(--acc); border-color: var(--acc); }
.dots.bad i { border-color: var(--warn); }
.dots.bad i.on { background: var(--warn); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { min-height: 64px; border: 1px solid var(--line); background: var(--card);
  border-radius: 13px; font-size: 25px; font-weight: 700; cursor: pointer; color: var(--ink); }
.pad button:hover { background: #fcfdfe; }
.pad button:active { background: #e9eef5; }
.pad button.fn { font-size: 14.5px; font-weight: 650; color: var(--dim); }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-7px) } 75% { transform: translateX(7px) } }
.shake { animation: shake .3s; }

/* ══ ТЕЛЕФОН І ПЛАНШЕТ ══════════════════════════════════ */
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(15,23,32,.18); }
  .side.open { transform: translateX(0); }
  .x-side { display: block; }
  .burger { display: flex; }
  .side-veil { display: block; position: fixed; inset: 0; background: rgba(15,23,32,.35); z-index: 35; }
  .top { padding: 10px 16px; min-height: 56px; }
  .top h1 { font-size: 18px; }
  .wrap { padding: 16px 16px 24px; }
  .row, .plate .cap, .wh > header, th, td { padding-left: 15px; padding-right: 15px; }
  .bar { position: fixed; left: 0; right: 0; bottom: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.95); backdrop-filter: blur(10px); }
  .bar .btn { flex: 1; min-height: 56px; padding: 0 12px; }
  .bar .btn:first-child { flex: 2; }
  .main { padding-bottom: 84px; }
  .toast { bottom: 96px; }
  .acts { flex-direction: column; }
  .acts .btn { width: 100%; }
  .hero .n { font-size: 82px; }
}
@media (max-width: 380px) {
  .hero .n { font-size: 68px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
}

/* карта складів */
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 9px; padding: 14px 18px 18px; }
.cell { background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.cell:hover { border-color: var(--acc); background: var(--acc-soft); }
.cell b { font: 700 12.5px ui-monospace, Consolas, monospace; letter-spacing: .02em; }
.cell span { font-size: 12px; color: var(--dim); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.cell i { font-style: normal; font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.cell.void { opacity: .55; }
.cell.void i { color: var(--dim); font-weight: 500; }

/* кнопка QR у рядку стелажа */
.qr { display: flex; padding: 8px; margin: -8px 0; border-radius: 8px; color: var(--dim); flex: none; }
.qr:hover { background: var(--acc-soft); color: var(--acc); }

/* посилання, що виглядає кнопкою */
a.btn { text-decoration: none; }

/* форма приймання */
.frm { display: grid; gap: 12px; padding: 14px 18px 18px; }
.frm label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--dim); }
.frm input { font: 600 17px inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; width: 100%; }
.frm input:focus { outline: 2px solid var(--acc); outline-offset: -1px; background: var(--card); }
.lnk { background: none; border: 0; color: var(--acc); font: 600 13.5px inherit; cursor: pointer; padding: 8px; flex: none; }
.lnk:hover { text-decoration: underline; }

/* стан мережі */
.net { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; flex: none;
  padding: 5px 10px; border-radius: 99px; background: #fdf2e6; color: var(--warn); }
.net.sync { background: #eaf0fd; color: var(--acc); }
.net b { font-variant-numeric: tabular-nums; }

/* розкладка по упаковках */
.packs { font-size: 13px; font-weight: 600; color: var(--acc); margin-top: 6px; }
.frm select { font: 600 16px inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; width: 100%; }
