/* L4 Облік — стилі застосунку поверх фірмових токенів L4 (brand_tokens.css, з l4-crm).
   Темна тема — єдина. Mobile-first, без CDN. Значення кольорів беруться лише з токенів. */

@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Regular.fc9e4514c99f.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Medium.9788b29373f5.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-SemiBold.b0e2d20bd818.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Bold.091b751f595b.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* похідні ролі (тільки з токенів) */
  --text: var(--fg);
  --primary-dark: var(--primary-strong);
  --primary-soft: var(--primary-weak);
  --success: var(--ok);
  --success-soft: rgba(50, 191, 0, .14);
  --warning: var(--warn);
  --warning-soft: rgba(255, 186, 8, .14);
  --danger: var(--crit);
  --danger-soft: rgba(237, 1, 49, .14);
  --neutral-soft: rgba(151, 166, 186, .16);
  --radius-card: 16px;
  --radius-ctl: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .18);
  --font: "Rethink Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 56px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue-300); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue-200); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; font-weight: 600; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; color: var(--blue-200); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
img { max-width: 100%; }
::selection { background: rgba(39, 125, 255, .35); }

/* ===== Шапка (як у CRM): лого · назва · системи L4 · користувач ===== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar .inner { display: flex; align-items: center; gap: .9rem; padding: .55rem 1rem; max-width: 1280px; margin: 0 auto; min-height: var(--header-h); }
.topbar .brand { display: inline-flex; align-items: center; gap: 1rem; color: var(--fg); white-space: nowrap; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { height: 32px; width: auto; display: block; }
.topbar .brand .product { color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.topbar .l4links { display: none; align-items: center; gap: .15rem; margin-left: .25rem; }
.topbar .l4links a { color: var(--muted); font-size: .82rem; padding: .45rem .6rem; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: .4rem; min-height: 34px; }
.topbar .l4links a img { width: 16px; height: 16px; }
.topbar .l4links a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.topbar .l4links a.active { color: var(--fg); }
.topbar .spacer { flex: 1; }
.topbar .user { position: relative; }
.topbar .user > summary { list-style: none; display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .82rem; padding: .4rem .7rem; border-radius: var(--pill); cursor: pointer; min-height: 36px; max-width: 46vw; }
.topbar .user > summary::-webkit-details-marker { display: none; }
.topbar .user > summary:hover { background: var(--surface-2); color: var(--fg); }
.topbar .user > summary .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user .ico { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; flex: none; }
.topbar .user .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; min-width: 240px; padding: .4rem; box-shadow: var(--shadow); z-index: 60; }
.topbar .user .menu .who { padding: .5rem .7rem .4rem; color: var(--fg); font-weight: 600; font-size: .92rem; }
.topbar .user .menu .role { color: var(--muted); font-size: .8rem; font-weight: 400; display: block; }
.topbar .user .menu a, .topbar .user .menu button { display: flex; width: 100%; text-align: left; color: var(--fg); background: none; border: 0; font: inherit; font-size: .92rem; padding: .6rem .7rem; border-radius: var(--radius-sm); cursor: pointer; min-height: 44px; align-items: center; }
.topbar .user .menu a:hover, .topbar .user .menu button:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.topbar .user .menu .sep { border-top: 1px solid var(--border); margin: .3rem 0; }
.topbar .user .menu .mob-links { display: grid; }
.topbar .menu-btn { display: none; }

/* Навігація розділів обліку — другий рядок шапки */
.appnav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: var(--header-h); z-index: 45; }
.appnav .inner { max-width: 1280px; margin: 0 auto; padding: 0 .5rem; display: flex; gap: .1rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.appnav .inner::-webkit-scrollbar { display: none; }
.appnav a { color: var(--muted); padding: .7rem .8rem; font-weight: 500; font-size: .92rem; white-space: nowrap; border-bottom: 2px solid transparent; min-height: 44px; display: inline-flex; align-items: center; }
.appnav a:hover { color: var(--fg); text-decoration: none; }
.appnav a.active { color: var(--fg); border-bottom-color: var(--primary); }
.mobile-nav { display: none; }

/* Нижня навігація на телефоні */
.bottomnav { display: none; }
@media (max-width: 899px) {
  .appnav { display: none; }
  .topbar .user .menu .mob-links { display: grid; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { color: var(--muted); font-size: .68rem; text-align: center; padding: .45rem .2rem .4rem; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav a .i { font-size: 1.15rem; line-height: 1; }
  .bottomnav a.active .i { filter: drop-shadow(0 0 6px rgba(39,125,255,.5)); }
  .bottomnav details { position: relative; }
  .bottomnav details > summary { list-style: none; color: var(--muted); font-size: .68rem; text-align: center; padding: .45rem .2rem .4rem; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; cursor: pointer; }
  .bottomnav details > summary::-webkit-details-marker { display: none; }
  .bottomnav details > summary .i { font-size: 1.15rem; line-height: 1; }
  .bottomnav details[open] > summary { color: var(--fg); }
  .bottomnav .more { position: absolute; right: .4rem; bottom: calc(100% + 8px); background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; min-width: 220px; padding: .4rem; box-shadow: var(--shadow); }
  .bottomnav .more a { display: flex; flex-direction: row; align-items: center; color: var(--fg); font-size: .95rem; padding: .6rem .8rem; border-radius: var(--radius-sm); min-height: 44px; text-align: left; justify-content: flex-start; }
  .bottomnav .more a.active { color: var(--primary); background: var(--primary-weak); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .footer { display: none; }
}
@media (min-width: 900px) {
  .topbar .l4links { display: flex; }
  .topbar .user .menu .mob-links { display: none; }
}

/* Футер (як у CRM) */
.footer { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); padding: .45rem 1rem; display: flex; justify-content: center; align-items: center; gap: .9rem; color: var(--faint); font-size: .72rem; }
.footer img { height: 18px; width: auto; opacity: .9; }

/* ===== Контейнер ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 1rem; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.page-head h1 { flex: 1 1 auto; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ===== Картки ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem; margin-bottom: .9rem; min-width: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: .9rem; }
.grid > * { min-width: 0; }
@media (min-width: 800px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem .8rem; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ===== Кнопки (≥44 px на дотик) ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: var(--radius-ctl); border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; line-height: 1.2; min-height: 44px; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.btn.secondary { background: var(--primary-weak); color: var(--blue-200); border-color: rgba(39,125,255,.35); }
.btn.secondary:hover { background: rgba(39,125,255,.24); color: #fff; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #06210a; }
.btn.success:hover { background: #2aa600; border-color: #2aa600; color: #06210a; }
.btn.danger { background: var(--crit); border-color: var(--crit); }
.btn.danger:hover { background: #c4002a; border-color: #c4002a; }
.btn.warning { background: var(--warn); border-color: var(--warn); color: #2a1d00; }
.btn.warning:hover { background: #e6a600; border-color: #e6a600; color: #2a1d00; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--fg); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--slate-600); color: var(--fg); }
.btn.sm { padding: .4rem .75rem; font-size: .88rem; min-height: 44px; }
.btn.lg { padding: .8rem 1.25rem; font-size: 1.05rem; min-height: 50px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row.sticky-bottom { position: sticky; bottom: 0; background: var(--bg); padding: .6rem 0; }
@media (min-width: 900px) { .btn.sm { min-height: 36px; } }

/* ===== Форми ===== */
form .field { margin-bottom: .8rem; }
label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .3rem; color: var(--muted); }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-ctl); font: inherit; background: var(--bg); color: var(--fg); min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { background: var(--surface-2); color: var(--fg); }
textarea { min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(39,125,255,.55); outline-offset: 1px; border-color: var(--primary); }
input[type=file] { padding: .45rem .6rem; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: .3rem .7rem; margin-right: .6rem; cursor: pointer; }
.help { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.errorlist { color: var(--crit); margin: .25rem 0 0; padding-left: 1.1rem; font-size: .88rem; }
.form-grid { display: grid; gap: .3rem .9rem; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: span 2; } }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.inline-form .field { margin: 0; flex: 1 1 160px; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--fg); min-height: 44px; }
.checkbox input, input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; min-height: auto; accent-color: var(--primary); }

/* ===== Таблиці ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .8rem; letter-spacing: .02em; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap.compact th, .table-wrap.compact td { padding: .4rem .55rem; }

/* ===== Чипи статусів (семантика CRM: ok / warn / crit / muted) ===== */
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: var(--pill); font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.5; background: var(--neutral-soft); color: var(--muted); border: 1px solid rgba(151,166,186,.3); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok, .badge.in_use, .badge.found, .badge.applied, .badge.active, .badge.used, .badge.paid, .badge.done, .badge.delivered, .badge.closed { background: var(--success-soft); color: var(--ok); border-color: rgba(50,191,0,.35); }
.badge.in_stock, .badge.info, .badge.new { background: var(--primary-weak); color: var(--blue-300); border-color: rgba(39,125,255,.35); }
.badge.reserve, .badge.reserved { background: rgba(152,16,250,.16); color: #C58CFF; border-color: rgba(152,16,250,.4); }
.badge.repair, .badge.warn, .badge.discrepancy, .badge.pending, .badge.partial, .badge.open, .badge.processing, .badge.shipped { background: var(--warning-soft); color: var(--warn); border-color: rgba(255,186,8,.35); }
.badge.written_off, .badge.lost, .badge.danger, .badge.not_found, .badge.failed, .badge.cancelled, .badge.excluded, .badge.returned { background: var(--danger-soft); color: #FF4D6E; border-color: rgba(237,1,49,.4); }
.badge.clarify { background: var(--danger-soft); color: #FF4D6E; border: 1px dashed rgba(237,1,49,.6); }
.badge.muted, .badge.inactive, .badge.archived { background: var(--neutral-soft); color: var(--faint); }

/* ===== Повідомлення ===== */
.messages { margin-bottom: .8rem; }
.msg { padding: .65rem .9rem; border-radius: 12px; margin-bottom: .45rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); }
.msg.success { background: var(--success-soft); color: #8CF26A; border-color: rgba(50,191,0,.35); }
.msg.error { background: var(--danger-soft); color: #FF7A92; border-color: rgba(237,1,49,.4); }
.msg.warning { background: var(--warning-soft); color: #FFD25C; border-color: rgba(255,186,8,.35); }
.msg.info { background: var(--primary-weak); color: var(--blue-200); border-color: rgba(39,125,255,.35); }

/* ===== Фільтри ===== */
.filters { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: .8rem; }
@media (min-width: 700px) { .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.filters .field { margin: 0; }
.filters label { font-size: .78rem; }
.filters input, .filters select { min-height: 42px; padding: .45rem .6rem; }

/* ===== Списки на телефоні (таблиці складаються в картки) ===== */
.list { display: flex; flex-direction: column; gap: .5rem; }
.list-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .8rem .9rem; display: block; color: inherit; }
.list-item:hover { text-decoration: none; border-color: var(--primary); color: inherit; }
.list-item .title { font-weight: 600; color: var(--fg); }
.list-item .sub { color: var(--muted); font-size: .88rem; }
.list-item .row { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }

/* ===== Фото / файли ===== */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.thumbs a { display: block; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.thumbs img { width: 100%; height: 110px; object-fit: cover; display: block; }
.thumbs .doc { padding: .5rem; font-size: .82rem; word-break: break-all; height: 110px; overflow: hidden; color: var(--muted); }

/* ===== Пагінація ===== */
.pagination { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; color: var(--muted); }

/* ===== Стат-плитки ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .8rem .9rem; }
.stat .n { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .84rem; }

/* ===== Друк ===== */
@media print {
  :root { color-scheme: light; }
  .topbar, .appnav, .bottomnav, .footer, .mobile-nav, .actions, .btn, .filters, .pagination, .no-print { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card, .table-wrap, .stat, .list-item { box-shadow: none; border: 1px solid #999; background: #fff; color: #000; }
  .card { border: none; padding: 0; }
  th, td { color: #000; background: #fff; }
  .container { max-width: none; padding: 0; }
  th { position: static; }
  a { color: #000; }
}
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.qr-label { border: 1px dashed #999; padding: 3mm; display: flex; gap: 3mm; align-items: center; break-inside: avoid; background: #fff; color: #000; border-radius: 0; }
.qr-label img { width: 26mm; height: 26mm; }
.qr-label .t { font-size: 11pt; font-weight: 700; }
.qr-label .s { font-size: 8.5pt; color: #333; }

/* ===== Вхід ===== */
.login-box { max-width: 400px; margin: 6vh auto; padding: 1.5rem; }
.login-box .logo { display: block; height: 44px; width: auto; margin: 0 auto 1rem; }
.login-box h1 { text-align: center; font-size: 1.2rem; }
.login-box .sub { text-align: center; }

/* ===== Вкладки / підменю ===== */
.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: .9rem; overflow-x: auto; }
.tabs a { padding: .6rem .8rem; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; margin-bottom: -1px; }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.tabs a.active { color: var(--fg); border-color: var(--primary); }
.tabs .n { color: var(--faint); font-size: .76rem; margin-left: .35rem; font-weight: 400; }
.tabs a.active .n { color: var(--blue-300); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
details summary { cursor: pointer; font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.big-check { font-size: 1.1rem; padding: 1rem; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: .8rem 0 .4rem; }
@media (max-width: 899px) { .sticky-actions, .btn-row.sticky-bottom { bottom: calc(60px + env(safe-area-inset-bottom)); } }

/* Розділ «Майно»: підрозділи секції, масові дії, картка */
.subnav { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .9rem; }
.subnav a { padding: .45rem .9rem; border-radius: var(--pill); border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; }
.subnav a:hover { text-decoration: none; border-color: var(--slate-600); color: var(--fg); }
.subnav a.active { background: var(--primary-weak); color: var(--blue-200); border-color: rgba(39,125,255,.45); }
@media (max-width: 699px) { .desktop-only { display: none !important; } }
@media (min-width: 700px) { .mobile-only { display: none !important; } }
.search-row { display: flex; gap: .5rem; margin-bottom: .6rem; }
.search-row input[type=search] { flex: 1; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; background: var(--primary-weak); border: 1px solid rgba(39,125,255,.35); border-radius: 14px; padding: .55rem .8rem; margin-bottom: .6rem; }
.bulk-bar .count { font-weight: 600; margin-right: .3rem; color: var(--blue-200); }
td.chk, th.chk { width: 2rem; text-align: center; }
td.chk input, .list-item input[type=checkbox] { width: 1.15rem; height: 1.15rem; min-height: auto; }
.list-item.sel { display: flex; gap: .6rem; align-items: flex-start; }
.list-item.sel .body { flex: 1; min-width: 0; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.action-grid .btn, .action-grid form { width: 100%; }
.asset-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .8rem; }
.asset-head .num { font-size: 1.5rem; font-weight: 700; letter-spacing: .3px; }
.asset-head .model { font-size: 1.1rem; color: var(--muted); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.hist li:last-child { border-bottom: none; }
.hist .when { color: var(--muted); font-size: .82rem; }
.hist .arrow { color: var(--faint); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .4rem; margin-top: .5rem; }
.preview-grid img { width: 100%; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumbs .thumb-wrap { position: relative; }
.thumbs .thumb-wrap form { position: absolute; top: 2px; right: 2px; }
.qr-box { text-align: center; }
.qr-box img { width: 160px; height: 160px; background: #fff; padding: 6px; border-radius: 10px; }
.warn-box { background: var(--warning-soft); border: 1px solid rgba(255,186,8,.35); color: #FFD25C; border-radius: 12px; padding: .65rem .9rem; margin-bottom: .8rem; }
.owner-group h3 { display: flex; align-items: center; gap: .5rem; }
.sortlink { color: inherit; }
.sortlink.active { color: var(--blue-300); }
.detail-grid { display: grid; gap: .9rem; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: 2fr 1fr; align-items: start; } }

/* Звірки (apps.inventories) */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.progress > div { height: 100%; background: var(--ok); }
.inv-line.status-found { border-left: 4px solid var(--ok); }
.inv-line.status-not_found { border-left: 4px solid var(--crit); }
.inv-line.status-discrepancy { border-left: 4px solid var(--warn); }
.inv-line.status-pending { border-left: 4px solid var(--border); }
.inv-line .btn.success { min-height: 48px; }
