/* АСУ «Арсенал» — інтерфейс. Один файл, без зовнішніх залежностей. */
:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --ink: #1d2119;
  --muted: #646b5e;
  --line: #dfe2da;
  --brand: #3d4a2e;
  --brand-ink: #f4f6ef;
  --accent: #6b7f3a;
  --accent-soft: #eef2e2;
  --danger: #a8352b;
  --danger-soft: #fbeceb;
  --warn: #9a6a12;
  --warn-soft: #fbf3df;
  --info: #2c5d8a;
  --info-soft: #e7f0f8;
  --ok: #2f6f3e;
  --ok-soft: #e4f3e7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 25, 15, .06), 0 2px 8px rgba(20, 25, 15, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- шапка */
.topbar { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-size: .8rem; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: #dfe5d3; padding: 8px 9px; white-space: nowrap; border-radius: 7px; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.nav .count { background: #e0b84a; color: #2a2208; border-radius: 9px; padding: 0 6px; font-size: .75rem; font-weight: 700; margin-left: 4px; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: #cfd8c2; }
.userbox form { margin: 0; }
.linkbtn { background: none; border: 0; color: #cfd8c2; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.quickfind { display: flex; }
.quickfind input[type=search] { width: 170px; border-radius: 7px; border: 0; padding: 7px 10px; font-size: .9rem; background: rgba(255,255,255,.12); color: #fff; }
.quickfind input::placeholder { color: #c3ccb5; }

/* ---------- каркас */
.container { max-width: 1240px; margin: 0 auto; padding: 22px 16px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.tight { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; } }

/* ---------- кнопки і форми */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-size: .93rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #c4c9bb; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #5b6d30; border-color: #5b6d30; }
.btn-danger { color: var(--danger); border-color: #e6c2be; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cdd2c5; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9c79a; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.errorlist { color: var(--danger); margin: 4px 0 0; padding-left: 18px; font-size: .85rem; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- повідомлення */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border: 1px solid; }
.messages .success { background: var(--ok-soft); border-color: #bfdcc5; color: var(--ok); }
.messages .error { background: var(--danger-soft); border-color: #ecc7c3; color: var(--danger); }
.messages .info, .messages .warning { background: var(--warn-soft); border-color: #ecdcae; color: var(--warn); }

/* ---------- таблиці */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbf8; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #eceee8; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf7; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #fafbf8; }

/* ---------- статуси */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.st-in_stock { background: var(--accent-soft); color: #4b5a22; border-color: #d7e0bd; }
.st-issued { background: var(--info-soft); color: var(--info); border-color: #c9dbeb; }
.st-returning { background: var(--warn-soft); color: var(--warn); border-color: #ecdcae; }
.st-broken { background: #fdeee2; color: #a2531c; border-color: #f0d0b6; }
.st-lost { background: var(--danger-soft); color: var(--danger); border-color: #ecc7c3; }
.st-written_off { background: #ececec; color: #555; border-color: #dadada; }
.st-new { background: var(--warn-soft); color: var(--warn); }
.st-accepted { background: var(--ok-soft); color: var(--ok); }
.st-rejected { background: #ececec; color: #555; }
.pending { color: var(--warn); font-size: .8rem; font-weight: 600; }

/* ---------- позивний над ПІБ */
.person { line-height: 1.15; }
.person .cs { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.person .fn { font-size: .8rem; color: var(--muted); }
.person-hero { text-align: center; padding: 6px 0 2px; }
.person-hero .cs { font-size: 1.9rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.person-hero .fn { color: var(--muted); }

/* ---------- метрики */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .83rem; }

/* ---------- картка предмета */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery a { display: block; }
.gallery img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #eef0ea; display: block; }
.thumb.empty { display: grid; place-items: center; color: #aab0a2; font-size: .7rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .when { color: var(--muted); font-size: .8rem; }
details.action { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fcfcfa; }
details.action summary { cursor: pointer; font-weight: 600; }
details.action[open] summary { margin-bottom: 10px; }

/* ---------- список для вибору (видача) */
.note { padding: 10px 14px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #ecdcae; font-size: .88rem; }
.sticky-panel { position: sticky; top: 72px; }
.mobile-bar { display: none; }
.show-m { display: none; }
.pick { max-height: 520px; overflow-y: auto; }
.pick tr.sel { background: #f1f5e6; }
.pick input[type=checkbox] { width: 18px; height: 18px; }

/* ---------- мобільний вигляд: таблиці → картки */
/* вузькі ноутбуки: меню окремим рядком, без «драбинки» з переносів */
@media (max-width: 1400px) {
  .topbar-inner { row-gap: 0; padding-top: 6px; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-left: -9px; }
  .userbox { margin-left: auto; }
}
@media (max-width: 720px) {
  .topbar-inner { gap: 8px; padding: 8px 12px; }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .quickfind { order: 4; flex: 1 0 100%; }
  .quickfind input[type=search] { width: 100%; }
  .userbox { margin-left: auto; }
  .userbox .role, .userbox .pwd { display: none; }
  .container { padding: 14px 10px 50px; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  table.cards td { border: 0; padding: 3px 0; text-align: left !important; }
  table.cards td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .8rem; }
  table.cards tfoot, table.cards tfoot tr { display: flex; width: 100%; justify-content: space-between; }
  table.cards tfoot td { display: block; width: auto; padding: 10px 12px; border: 0; }
  table.cards tfoot td:empty { display: none; }
  .hide-m { display: none !important; }
  .show-m { display: block; }
  .issue-grid { display: flex; flex-direction: column; }
  .issue-panel { order: -1; }
  .sticky-panel { position: static; }
  .pick { max-height: none; }
  .mobile-bar { display: flex; position: sticky; bottom: 0; z-index: 5; justify-content: space-between; align-items: center;
    gap: 10px; margin: 0 -10px; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 12px rgba(20, 25, 15, .08); }
}

/* ---------- вхід */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #3d4a2e, #232b1a); }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card .brand { color: var(--brand); justify-content: center; margin-bottom: 18px; font-size: 1.05rem; }

/* ---------- сканер QR ---------- */
.scanner { width: min(480px, 96vw); padding: 0; border: none; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.scanner::backdrop { background: rgba(20, 24, 18, .65); }
.scanner-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.scanner-view { position: relative; background: #111; aspect-ratio: 4 / 3; overflow: hidden; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none; }
.scanner-msg { min-height: 1.4em; padding: 8px 14px 0; margin: 0; }
.scanner-manual { display: flex; gap: 8px; padding: 10px 14px 14px; }
.scanner-manual input { flex: 1; }
.linkbtn { background: none; border: none; color: var(--info); cursor: pointer; font: inherit; padding: 4px; }
.scan-btn { white-space: nowrap; }
.quickfind { gap: 6px; }
.quickfind .scan-btn { border: 0; border-radius: 7px; padding: 0 9px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: flex; align-items: center; }
.quickfind .scan-btn:hover { background: rgba(255,255,255,.22); }

/* ---------- інвентаризація ---------- */
.scan-log { list-style: none; margin: 10px 0 0; padding: 0; font-size: .9rem; }
.scan-log li { padding: 6px 10px; border-radius: 6px; margin-top: 4px; }
.scan-log .k-found { background: var(--ok-soft); color: var(--ok); }
.scan-log .k-again { background: #f1f1ee; color: #555; }
.scan-log .k-extra, .scan-log .k-unknown { background: var(--warn-soft); color: var(--warn); }
.scan-log .k-error { background: var(--danger-soft); color: var(--danger); }
tr.row-found td { background: var(--ok-soft); text-decoration: line-through; opacity: .7; }

details.dispute summary { cursor: pointer; }
details.dispute[open] summary { margin-bottom: 4px; }

/* ---------- довідка ---------- */
.userbox .linkbtn { color: #cfd8c2; text-decoration: underline; text-underline-offset: 3px; }
.help-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 20px; padding: 3px 10px 3px 4px; }
.help-link:hover, .help-link.on { background: rgba(255,255,255,.14); text-decoration: none; }
.help-link .q, .help-q-inline { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #e0b84a; color: #2a2208; font-weight: 800; font-size: .8rem; line-height: 1; }
.help-q-inline { width: 17px; height: 17px; font-size: .72rem; vertical-align: 1px; }
@media (max-width: 720px) { .help-link { padding: 3px; border-color: transparent; } .help-link .t { display: none; } .help-link .q { width: 24px; height: 24px; font-size: .9rem; } }

.help-layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 120px; padding: 12px 10px; max-height: calc(100vh - 140px); overflow: auto; font-size: .9rem; }
.help-toc a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--ink, #222); }
.help-toc a:hover { background: #f1f3ee; text-decoration: none; }
.help-toc a.on { background: var(--accent-soft); font-weight: 600; }
.help-toc .toc-h { margin: 12px 8px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.help-role { margin: 0 8px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.help-body { min-width: 0; }
.help-sec { scroll-margin-top: 130px; }
.help-sec h2 { margin-top: 0; }
.help-sec.flash { box-shadow: 0 0 0 3px #e0b84a; transition: box-shadow .3s; }
.role-sec { border-top: 4px solid var(--accent); }
.role-tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #4b5a22; background: var(--accent-soft); border-radius: 20px; padding: 2px 10px; margin-bottom: 6px; }
.steps { padding-left: 22px; }
.steps > li { margin: 7px 0; padding-left: 4px; }
.steps ul { margin: 4px 0; }
.shot { float: right; margin: 0 0 12px 18px; max-width: 52%; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.shot.phone { max-width: 230px; }
.help-sec::after { content: ""; display: block; clear: both; }
.help-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.help-table th, .help-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 12px; }
.flow span { background: var(--accent-soft); border: 1px solid #d7e0bd; border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: .9rem; }
.flow i { font-style: normal; color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: #f1f1ee; font-size: .82rem; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.faq dt { font-weight: 700; margin-top: 12px; }
.faq dd { margin: 3px 0 0; }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .help-toc a { background: #f4f5f1; padding: 4px 9px; }
  .help-toc .toc-h, .help-role { flex: 1 0 100%; margin: 6px 4px 2px; }
  .shot, .shot.phone { float: none; max-width: 100%; margin: 0 0 12px; }
  .shot.phone { max-width: 260px; }
}

/* ---------- привітання ---------- */
.welcome { position: relative; border-left: 4px solid #e0b84a; background: #fffdf5; }
.welcome h2 { margin: 0 0 4px; padding-right: 30px; }
.welcome-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); }
.welcome-steps { padding-left: 22px; margin: 8px 0 14px; }
.welcome-steps li { margin: 5px 0; }

/* ---------- QR номера в картці ---------- */
.qr-card { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.qr-card .qr-cell { display: flex; gap: 12px; align-items: center; }
.qr-card .qr { width: 132px; height: 132px; background: #fff; }
.qr-card p { flex: 1 0 100%; margin: 0; }

/* =====================================================================
   v3 — зручність: іконки, модальні вікна, підказки, анімації, фільтри
   ===================================================================== */
:root { --ease: cubic-bezier(.2,.8,.2,1); --ring: 0 0 0 3px rgba(107,127,58,.28); }
[hidden] { display: none !important; }
.ic { flex: none; display: inline-block; vertical-align: -3px; }
body { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* шапка */
.nav a { display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.nav a .ic { opacity: .85; }
.nav a.active .ic { opacity: 1; }
.brand-mark { color: #fff; }
.quickfind { position: relative; align-items: center; gap: 6px; }
.quickfind .qf-ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: #c3ccb5; pointer-events: none; display: flex; }
.quickfind input[type=search] { padding-left: 32px; width: 250px; transition: width .2s var(--ease), background .15s; }
.quickfind input[type=search]:focus { background: #fff; color: var(--ink); width: 320px; outline: none; }
.quickfind input[type=search]:focus + .scan-btn { opacity: 1; }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; width: min(460px, 92vw); background: #fff; color: var(--ink); border-radius: 12px;
           box-shadow: 0 16px 40px rgba(0,0,0,.22); border: 1px solid var(--line); padding: 6px; z-index: 40; max-height: 70vh; overflow: auto;
           animation: pop .16s var(--ease); }
.sg-h { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 8px 10px 4px; }
.sg-row { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--ink); }
.sg-row .badge, .sg-row .avatar { grid-row: span 2; }
.sg-row:hover, .sg-row.on { background: var(--accent-soft); text-decoration: none; }
.sg-main { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-sub { font-size: .78rem; color: var(--muted); }
.sg-empty { padding: 14px 10px; color: var(--muted); font-size: .9rem; }
.sg-all { width: 100%; border: 0; background: none; padding: 9px 10px; text-align: left; color: var(--info); cursor: pointer; font: inherit; font-size: .88rem; border-top: 1px solid var(--line); margin-top: 4px; }
.userbox { gap: 8px; }
.me { display: flex; align-items: center; gap: 8px; color: #fff; padding: 3px 8px 3px 3px; border-radius: 22px; }
.me:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.me-t { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; font-size: .82rem; letter-spacing: .04em; }
.me-t .role { font-weight: 400; font-size: .72rem; color: #c3ccb5; letter-spacing: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #e0b84a; color: #2a2208; display: inline-grid; place-items: center; font-weight: 800; font-size: .78rem; letter-spacing: .02em; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; background: var(--accent-soft); color: #4b5a22; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; color: #dfe5d3; padding: 6px; border-radius: 8px; display: flex; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { background: rgba(255,255,255,.12); }
.usermenu-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 250px; background: #fff; color: var(--ink); border-radius: 12px;
                box-shadow: 0 16px 40px rgba(0,0,0,.22); border: 1px solid var(--line); padding: 6px; z-index: 50; animation: pop .16s var(--ease); }
.um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-pop a, .usermenu-pop button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink); font: inherit; font-size: .92rem; background: none; border: 0; cursor: pointer; text-align: left; }
.usermenu-pop a:hover, .usermenu-pop button:hover { background: #f2f4ee; text-decoration: none; }
.usermenu-pop form { margin: 0; }
@media (max-width: 1400px) { .me-t { display: none; } }
@media (max-width: 720px) {
  .nav a span:not(.count) { font-size: .88rem; }
  .quickfind input[type=search], .quickfind input[type=search]:focus { width: 100%; }
  .brand-t { display: none; }
  .help-link { display: none; }
}

/* кнопки */
.btn { transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn .ic { margin-left: -2px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #8f2b22; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #eef0ea; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: #eef0ea; color: var(--ink); }
form.is-sending button[type=submit], form.is-sending button:not([type]) { position: relative; color: transparent !important; }
form.is-sending button[type=submit]::after, form.is-sending button:not([type])::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .7s linear infinite; }
form.is-sending .btn:not(.btn-primary)::after { border-color: rgba(0,0,0,.15); border-top-color: var(--accent); }

/* картки, таблиці */
.card { transition: box-shadow .2s, border-color .2s; }
table.cards tbody tr { transition: background .12s; }
table.cards tbody tr:hover { background: #fafbf7; }
tr[data-href] { cursor: pointer; }
.sort-link { color: inherit; white-space: nowrap; }
.sort-link.on { color: var(--accent); }
.sort-link:hover { text-decoration: none; color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; }

/* фільтри-чіпи */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .88rem; white-space: nowrap; transition: all .15s; }
.chip:hover { border-color: #c4c9bb; text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { background: #eef0ea; color: var(--muted); border-radius: 10px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
.chip.on .n { background: rgba(255,255,255,.2); color: #fff; }
.chip.warn .n { background: var(--warn-soft); color: var(--warn); }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 12px; font-size: .85rem; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: #4b5a22; border-radius: 16px; padding: 3px 6px 3px 10px; }
.pill a { color: inherit; display: inline-flex; padding: 2px; border-radius: 50%; }
.pill a:hover { background: rgba(0,0,0,.08); }
.filters-toggle { display: none; }
@media (max-width: 720px) {
  .filters-toggle { display: inline-flex; }
  .filters.collapsible:not(.open) .field:not(.grow) { display: none; }
}

/* модальні вікна */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 70px rgba(0,0,0,.35); color: var(--ink); }
dialog.modal.modal-sm { width: min(420px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(20,24,18,.55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .22s var(--ease); }
dialog.modal[open]::backdrop { animation: fade-in .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.modal-head h3 { margin: 0; font-size: 1.1rem; display: flex; gap: 8px; align-items: center; }
.modal-body { padding: 8px 18px 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 18px; flex-wrap: wrap; }
#confirm-dlg form { padding: 22px 22px 0; text-align: center; }
#confirm-dlg .modal-ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
#confirm-dlg.danger .modal-ic { background: var(--danger-soft); color: var(--danger); }
#confirm-dlg .modal-actions { justify-content: center; padding: 8px 0 22px; }
#confirm-dlg .cd-text { white-space: pre-line; }
.scanner.modal { width: min(480px, 96vw); }

/* спливаючі повідомлення */
.toasts { position: fixed; top: 76px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line);
         box-shadow: 0 10px 30px rgba(0,0,0,.16); transform: translateX(120%); opacity: 0; transition: transform .35s var(--ease), opacity .35s; font-size: .93rem; }
.toast.in { transform: none; opacity: 1; }
.toast.out { transform: translateX(120%); opacity: 0; }
.toast .toast-t { flex: 1; }
.toast .toast-t a { font-weight: 600; }
.toast-ic { display: flex; margin-top: 1px; }
.toast.success { border-left: 4px solid var(--ok); } .toast.success .toast-ic { color: var(--ok); }
.toast.error { border-left: 4px solid var(--danger); } .toast.error .toast-ic { color: var(--danger); }
.toast.warning, .toast.info { border-left: 4px solid #e0b84a; } .toast.warning .toast-ic, .toast.info .toast-ic { color: var(--warn); }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: flex; font-size: 1.1rem; line-height: 1; }
.toast-x:hover { background: #f0f1ed; }
@media (max-width: 720px) { .toasts { top: auto; bottom: 14px; right: 12px; left: 12px; width: auto; } .toast { transform: translateY(140%); } .toast.out { transform: translateY(140%); } }

/* плитки дій, головна */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: var(--shadow);
        transition: transform .15s var(--ease), box-shadow .15s, border-color .15s; position: relative; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20,25,15,.1); border-color: #cfd6c2; text-decoration: none; }
.tile .t-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: #4b5a22; flex: none; }
.tile .t-t { font-weight: 700; }
.tile .t-s { font-size: .82rem; color: var(--muted); }
.tile .t-n { position: absolute; top: 10px; right: 12px; background: #e0b84a; color: #2a2208; border-radius: 10px; padding: 0 8px; font-weight: 800; font-size: .8rem; }
.tile.warn .t-ic { background: var(--warn-soft); color: var(--warn); }
.tile.danger .t-ic { background: var(--danger-soft); color: var(--danger); }
.tile.info .t-ic { background: var(--info-soft); color: var(--info); }
.tile.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.tile.primary .t-ic { background: rgba(255,255,255,.15); color: #fff; }
.tile.primary .t-s { color: #cfd8c2; }
.stat { transition: transform .15s var(--ease); }
.stat .v { animation: count-in .5s var(--ease); }
a.stat { color: inherit; display: block; }
a.stat:hover { transform: translateY(-2px); text-decoration: none; border-color: #cfd6c2; }
.stat.warn .v { color: var(--warn); } .stat.danger .v { color: var(--danger); } .stat.ok .v { color: var(--ok); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list .ti { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: #f1f3ee; color: var(--muted); }
.task-list .ti.warn { background: var(--warn-soft); color: var(--warn); } .task-list .ti.danger { background: var(--danger-soft); color: var(--danger); } .task-list .ti.ok { background: var(--ok-soft); color: var(--ok); }
.task-list .tt { flex: 1; min-width: 0; }
.task-list .tt small { display: block; color: var(--muted); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar { height: 10px; background: #eef0ea; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8ea155); border-radius: 6px; transform-origin: left; animation: grow .8s var(--ease); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .e-ic { width: 64px; height: 64px; border-radius: 50%; background: #eef0ea; display: grid; place-items: center; margin: 0 auto 10px; color: #8a9180; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* кабінет військового */
.cabinet-hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--brand), #56663b); color: #fff; border-radius: 16px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.cabinet-hero .avatar.lg { background: #e0b84a; }
.cabinet-hero .h-name { font-size: 1.5rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.cabinet-hero .h-sub { color: #d6dec9; font-size: .9rem; }
.cabinet-hero .h-stats { margin-left: auto; display: flex; gap: 22px; text-align: right; }
.cabinet-hero .h-stats b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.cabinet-hero .h-stats small { color: #d6dec9; }
@media (max-width: 720px) { .cabinet-hero { flex-wrap: wrap; } .cabinet-hero .h-stats { margin-left: 0; width: 100%; justify-content: space-around; text-align: center; } }
.item-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.icard { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.icard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,25,15,.1); }
.icard .ic-top { display: flex; gap: 12px; padding: 12px; align-items: center; }
.icard .ic-top img, .icard .ic-top .ph { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: #eef0ea; display: grid; place-items: center; color: #8a9180; }
.icard .ic-name { font-weight: 700; line-height: 1.2; }
.icard .ic-num { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.icard .ic-meta { padding: 0 12px 10px; font-size: .82rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icard .ic-actions { display: flex; border-top: 1px solid var(--line); margin-top: auto; }
.icard .ic-actions > * { flex: 1; border: 0; background: none; padding: 10px 6px; font: inherit; font-size: .84rem; color: var(--info); cursor: pointer; display: inline-flex; justify-content: center; gap: 6px; align-items: center; }
.icard .ic-actions > * + * { border-left: 1px solid var(--line); }
.icard .ic-actions > *:hover { background: #f6f8f2; text-decoration: none; }
.icard.pending-c { border-color: #ecdcae; box-shadow: 0 0 0 3px rgba(224,184,74,.18); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; display: flex; gap: 8px; align-items: center; }
.incoming { border: 2px dashed #c9d3ae; background: #fbfcf7; }

/* кількість (+/-) */
.qty-input { display: inline-flex; align-items: center; border: 1px solid #cdd2c5; border-radius: 8px; overflow: hidden; background: #fff; }
.qty-input button { border: 0; background: #f2f4ee; width: 32px; height: 34px; cursor: pointer; font-size: 1.1rem; color: var(--ink); }
.qty-input button:hover { background: #e6eadf; }
.qty-input input { border: 0; width: 64px; text-align: center; padding: 6px 4px; border-radius: 0; }
.seg { display: inline-flex; background: #eef0ea; border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { margin: 0; font-weight: 600; font-size: .88rem; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--ink); }
.seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* анімації */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes count-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-enter > * { animation: rise .35s var(--ease) backwards; }
.page-enter > *:nth-child(2) { animation-delay: .03s; } .page-enter > *:nth-child(3) { animation-delay: .06s; }
.page-enter > *:nth-child(4) { animation-delay: .09s; } .page-enter > *:nth-child(n+5) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .topbar, .toasts, .usermenu, .help-link { display: none !important; } .page-enter > * { animation: none; } }
.selbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; display: flex; gap: 10px; align-items: center;
          background: var(--brand); color: #fff; padding: 10px 12px 10px 18px; border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.3); animation: rise .25s var(--ease); }
.selbar .btn-ghost { color: #fff; } .selbar .btn-ghost:hover { background: rgba(255,255,255,.12); }
.selbar .btn:disabled { opacity: .5; cursor: not-allowed; }
tr.sel td { background: #f1f5e6; }
details.summary-card > summary { list-style: none; } details.summary-card > summary::-webkit-details-marker { display: none; }
details.summary-card > summary::after { content: "▾"; float: right; color: var(--muted); transition: transform .2s; }
details.summary-card:not([open]) > summary::after { transform: rotate(-90deg); }
.action-list { display: grid; gap: 6px; }
.action-list form { margin: 0; }
.action-btn { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; text-align: left; color: var(--ink); transition: all .15s var(--ease); }
.action-btn:hover { border-color: #c4c9bb; background: #fafbf7; transform: translateX(2px); }
.action-btn small { display: block; color: var(--muted); font-size: .8rem; }
.ab-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #f1f3ee; color: var(--muted); flex: none; }
.ab-ic.warn { background: var(--warn-soft); color: var(--warn); } .ab-ic.danger { background: var(--danger-soft); color: var(--danger); } .ab-ic.ok { background: var(--ok-soft); color: var(--ok); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border: 2px dashed #cdd2c5; border-radius: 12px; color: var(--muted); cursor: pointer; text-align: center; font-weight: 500; margin-bottom: 14px; transition: all .15s; }
.dropzone:hover, .dropzone.has { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.person-hero .avatar.lg { margin-bottom: 8px; }
.confirm-card { border-color: #ecdcae; background: #fffaf0; box-shadow: 0 0 0 4px rgba(224,184,74,.14); }
.check-row { font-weight: 400; display: flex; gap: 10px; align-items: center; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.6); cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.transfer-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.transfer-row:last-child { border-bottom: 0; }
.transfer-row form { margin: 0; }
.tr-results { display: grid; gap: 6px; margin: -6px 0 12px; }
.tr-pick { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.tr-pick small { display: block; color: var(--muted); }
.tr-pick.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.tg-connect { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.tg-connect .qr { width: 132px; height: 132px; }
.person-link { display: inline-flex; gap: 10px; align-items: center; color: inherit; }
.person-link:hover { text-decoration: none; } .person-link:hover .cs { color: var(--info); }
.pager { justify-content: center; align-items: center; margin-bottom: 18px; }
.mono .small, .mono .muted { font-family: inherit; letter-spacing: 0; }
.toasts { top: auto; bottom: 18px; }
.toast { transform: translateY(140%); } .toast.out { transform: translateY(140%); }
/* горизонтальне меню без системної смуги прокрутки (Windows) */
.nav { scrollbar-width: none; -ms-overflow-style: none; }
.nav::-webkit-scrollbar { display: none; }
.thumb.sm { width: 34px; height: 34px; border-radius: 6px; flex: none; }
td.name-cell, span.name-cell { vertical-align: middle; }
td.name-cell > .thumb.sm, span.name-cell > .thumb.sm { display: inline-block; vertical-align: middle; margin-right: 10px; }
span.name-cell { display: inline-flex; align-items: center; }
span.name-cell > .thumb.sm { margin-right: 10px; }
.item-main { display: flex; gap: 20px; align-items: flex-start; }
.item-main .kv { flex: 1; min-width: 0; }
.item-hero { flex: none; width: 220px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #f3f5ef; }
.item-hero img { display: block; width: 100%; height: auto; transition: transform .3s var(--ease); }
.item-hero:hover img { transform: scale(1.04); }
@media (max-width: 720px) { .item-main { flex-direction: column; } .item-hero { width: 100%; max-width: 360px; } }

/* ---------------------------------------------------------------- Android-застосунок */
html.in-app .web-only { display: none !important; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:first-child { padding-top: 0; }
.switch { position: relative; width: 50px; height: 30px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cfd4c7; cursor: pointer; transition: background .2s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--info); outline-offset: 2px; }
.app-lock { position: fixed; inset: 0; z-index: 1000; background: #2f3a24; color: #eef0e8; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.app-lock[hidden] { display: none !important; }
.app-lock .mark { width: 76px; height: 76px; border-radius: 20px; background: #6b7f3b; display: flex; align-items: center; justify-content: center;
  font: 800 42px/1 system-ui, sans-serif; color: #fff; position: relative; margin-bottom: 6px; }
.app-lock .mark::after { content: ""; position: absolute; top: 8px; right: 8px; width: 14px; height: 14px; border-radius: 50%; background: #e0b84a; }
.app-lock h2 { margin: 0; font-size: 1.3rem; color: #fff; }
.app-lock p { margin: 0; color: #c5cbb9; max-width: 320px; }
.app-lock .btn-unlock { margin-top: 10px; display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 14px; padding: 15px 26px;
  background: #e0b84a; color: #1f2616; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.app-lock .lock-out { color: #c5cbb9; background: none; border: 0; text-decoration: underline; font-size: .95rem; margin-top: 8px; cursor: pointer; }
.app-update { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--info-soft); border: 1px solid #c9dbea; border-radius: 12px; margin-bottom: 14px; }
.app-update .grow { flex: 1; }
/* Вирізи екрана / системні панелі (застосунок Android, iPhone «на екрані Додому») */
.topbar { padding-top: env(safe-area-inset-top, 0px); }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }
.selbar { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.toasts { top: calc(76px + env(safe-area-inset-top, 0px)); }
/* Блокування застосунку: поки не підтверджено відбиток — вміст не показуємо */
html.app-locked body > *:not(.app-lock) { visibility: hidden; }
.scan-torch.on { background: #e0b84a; color: #1f2616; border-radius: 10px; }
.scanner-head strong { flex: 1; } .scanner-head .icon-btn + .icon-btn { margin-left: 6px; }
