/* Inventory module: additions on top of app.css (same palette, cards and components as the receipts system). */
.chip.info { background: var(--info-bg); color: var(--info); }
.paid-t { color: var(--paid); }
a.kpi { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kpi b small { font-size: 13px; font-weight: 600; }
.over-t { color: var(--over); }
.list tr.late td { background: color-mix(in srgb, var(--over-bg) 45%, transparent); }

/* thumbnails & names */
.inv-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--line-soft); }
.inv-thumb.ph { display: inline-grid; place-items: center; color: var(--muted); }
.inv-thumb.lg { width: 64px; height: 64px; border-radius: 12px; }
.inv-thumb.lg svg.i { width: 28px; height: 28px; }
.list td.inv-name { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.inv-photo { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; margin: 0 auto; }
.inv-subh { font-size: 14px; margin: 0; padding: 14px 20px 8px; display: flex; gap: 8px; align-items: center; color: var(--fg); }
.inv-detail { min-width: 260px; }

/* item card header + action row */
.inv-head { align-items: center; }
.inv-head-t { display: flex; gap: 14px; align-items: center; min-width: 0; }
.inv-head-t p { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inv-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: -4px 0 18px; }
.inv-actions .btn { padding: 10px 18px; }
.inv-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.inv-status { flex-direction: row; display: flex !important; align-items: center; gap: 8px; margin-inline-start: auto; }
.inv-status select { width: auto; }
.sm-sel { width: auto !important; padding: 4px 8px !important; font-size: 13px; }

/* dashboard */
.inv-tools { display: grid; gap: 8px; }
.inv-tool { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 12px; border: 1px solid var(--line-soft); border-radius: 10px; text-decoration: none; color: var(--fg); border-right: 4px solid var(--paid); }
.inv-tool.st-garage { border-right-color: var(--soon); }
.inv-tool.st-disabled { border-right-color: var(--muted); }
.inv-tool:hover { background: var(--accent-soft); }
.inv-tool > span { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* dialogs */
.inv-qbox { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 13px; color: var(--muted); }
.inv-qbox b { color: var(--fg); font-size: 16px; font-variant-numeric: tabular-nums; }
.inv-qbox .av b { color: var(--paid); }
.inv-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 26px; }
.rc-partial.loss { border-color: var(--over); background: var(--over-bg); }
.inv-dlg.is-tool .k-qty, .inv-dlg.is-qty .k-tool { display: none !important; }
.inv-kind { grid-template-columns: 1fr 1fr; }
.inv-kind legend { grid-column: 1 / -1; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sugg:empty { display: none; }
.sugg button { border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 16px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.sugg button:hover { border-color: var(--accent); color: var(--accent); }
label.f .sugg { font-weight: 600; }
.pick-list { display: grid; gap: 6px; max-height: min(60vh, 520px); overflow: auto; margin-top: 10px; }
.pick-list > button { display: flex; gap: 10px; align-items: center; text-align: right; width: 100%; border: 1px solid var(--line-soft); background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--fg); }
.pick-list > button:hover, .pick-list > button:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.pick-list .t { flex: 1; min-width: 0; display: grid; }
.pick-list .t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list .t small { color: var(--muted); }
.pick-list .q { display: grid; justify-items: center; font-variant-numeric: tabular-nums; }
.pick-list .q small { font-size: 10px; color: var(--muted); }
.inv-errs { margin: 6px 0 0; padding-inline-start: 18px; max-height: 200px; overflow: auto; }

/* tool documents & files */
.inv-docs { display: grid; gap: 8px; }
.inv-doc { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.inv-doc .t { display: grid; gap: 4px; min-width: 0; }
.inv-doc .acts { display: flex; gap: 2px; align-items: center; }
.inv-files { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.inv-files:empty { display: none; }
.inv-file { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; }
.inv-file a { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-file .icon-btn { width: 24px; height: 24px; }
.inv-attach { cursor: pointer; }

/* alerts filter chips */
.inv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.inv-chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 6px 14px; cursor: pointer; font-weight: 600; color: var(--fg); display: inline-flex; gap: 8px; align-items: center; }
.inv-chips button b { background: var(--surface-2); border-radius: 10px; padding: 0 7px; font-size: 12px; }
.inv-chips button.on { background: var(--side); color: #fff; border-color: var(--side); }
.inv-chips button.on b { background: var(--wheat); color: var(--wheat-ink); }
.inv-chips button:disabled { opacity: .45; cursor: default; }

/* settings */
.inv-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 28px; }
.inv-catlist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; }
.inv-catlist li { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px; border-bottom: 1px solid var(--line-soft); min-height: 38px; }
.inv-catlist .acts { display: flex; gap: 2px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.inv-catadd input { flex: 1; }
.inv-mailprev { border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 65vh; background: #f3f5f0; color: #1a2a1f; }

/* order list */
.inv-oq { width: 90px !important; text-align: left; padding: 5px 8px !important; }
.inv-total { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.inv-total b { font-size: 24px; font-variant-numeric: tabular-nums; }

/* phone: bottom action bar for the warehouse manager in the field */
.inv-qbar { display: none; }
@media (max-width: 900px) {
  .inv-qbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 28; inset: auto 0 0 0;
    background: var(--side); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    box-shadow: 0 -4px 18px rgba(0,0,0,.18);
  }
  .inv-qbar button { border: 0; background: none; color: var(--side-fg); display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 12px; font-weight: 700; cursor: pointer; border-radius: 10px; min-height: 52px; }
  .inv-qbar button svg.i { width: 24px; height: 24px; color: var(--wheat); }
  .inv-qbar button:active { background: rgba(255,255,255,.08); }
  body:has(.inv-qbar) main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  body:has(.inv-qbar) .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .inv-status { margin-inline-start: 0; }
}

/* phone: tables become cards */
@media (max-width: 640px) {
  .list.inv-cards thead { display: none; }
  .list.inv-cards, .list.inv-cards tbody { display: block; }
  .list.inv-cards tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .list.inv-cards tbody td { border: 0; padding: 0; min-width: 0 !important; text-align: right !important; white-space: normal; }
  .list.inv-cards tbody td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
  .list.inv-cards tbody td:first-child, .list.inv-cards tbody td.inv-name, .list.inv-cards tbody td.inv-detail, .list.inv-cards tbody td.acts { grid-column: 1 / -1; }
  .list.inv-cards tbody td:first-child::before, .list.inv-cards tbody td.inv-name::before { display: none; }
  .list.inv-cards tbody td.inv-name { display: flex; }
  .list.inv-cards tbody td.acts { display: flex; gap: 8px; justify-content: flex-start; margin-top: 4px; }
  .list.inv-cards tbody td.acts .btn { padding: 8px 14px; font-size: 14px; }
  .list.inv-cards tbody td.empty { grid-column: 1 / -1; }
  .list.inv-cards tfoot { display: block; }
  .list.inv-cards tfoot tr { display: flex; justify-content: space-between; }
  .list.inv-cards tfoot td[colspan] { flex: 1; }
  .alert-table-wrap { max-height: none; }
  .inv-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .inv-actions .btn { justify-content: center; padding: 12px; }
  .inv-actions .inv-status { grid-column: 1 / -1; }
  .inv-head-t .inv-thumb.lg { width: 48px; height: 48px; }
  .inv-kind { grid-template-columns: 1fr; }
  .inv-oq { width: 100% !important; }
  .modal.inv-dlg input, .modal.inv-dlg select { font-size: 16px; } /* no zoom-on-focus on iPhone */
  .toolbar label.f { flex: 1 1 140px; }
  .toolbar select { width: 100%; }
}

/* grid columns must be allowed to shrink, so wide tables scroll inside their card instead of widening the page */
.two-col > *, .stack > * { min-width: 0; }
.stack { grid-template-columns: minmax(0, 1fr); }
.kpi small i { font-style: normal; font-weight: 700; color: var(--over); }
.inv-kpis .kpi b { white-space: nowrap; font-size: clamp(18px, 1.6vw, 24px); }
.list td.inv-wide { min-width: 220px; }
.inv-attach.icon-btn { display: inline-grid; }
/* long dialogs on a phone: the confirm button stays in reach */
@media (max-width: 640px) {
  .modal-back:has(.inv-dlg) { padding-top: max(10px, env(safe-area-inset-top, 0px)); padding-bottom: 0; }
  .modal.inv-dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 10px - env(safe-area-inset-top, 0px)); border-radius: 14px 14px 0 0; }
  .modal.inv-dlg > .modal-b, .modal.inv-dlg > form.modal-b { overflow: auto; flex: 1 1 auto; }
  .modal.inv-dlg > .modal-f { flex: none; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal.inv-dlg > .modal-f .btn { flex: 1; justify-content: center; padding: 12px; font-size: 15px; }
  .sugg button { padding: 6px 12px; font-size: 13px; }
}
@media (max-width: 640px) {
  .list.inv-cards.inv-compact tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .list.inv-cards .m-hide, .list.inv-cards tbody td:empty { display: none; }
}

/* ================= dashboard: the five daily actions come first ================= */
.inv-actions-big { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.inv-actions-big button {
  --c: var(--accent); --cb: var(--accent-soft);
  border: 2px solid transparent; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 12px 18px; cursor: pointer;
  display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--fg); transition: box-shadow .15s, transform .15s, border-color .15s;
}
.inv-actions-big button:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--c); }
.inv-actions-big button:active { transform: none; }
.inv-actions-big .ai { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--cb); color: var(--c); margin-bottom: 4px; }
.inv-actions-big .ai svg.i { width: 32px; height: 32px; stroke-width: 2; }
.inv-actions-big b { font-size: 20px; font-weight: 800; }
.inv-actions-big small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.inv-actions-big .a-issue { --c: var(--wheat-deep); --cb: var(--wheat-soft); }
.inv-actions-big .a-loan { --c: var(--pend); --cb: var(--pend-bg); }
.inv-actions-big .a-return { --c: var(--paid); --cb: var(--paid-bg); }
.inv-actions-big .a-count { --c: var(--info); --cb: var(--info-bg); }
.inv-cnt { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--soon); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.inv-cnt.over { background: var(--over); }
.inv-dash2 { margin-top: 2px; }
@media (max-width: 760px) {
  .inv-actions-big { grid-template-columns: 1fr 1fr; gap: 10px; }
  .inv-actions-big button:last-child { grid-column: 1 / -1; }
  .inv-actions-big button { padding: 16px 10px 14px; }
  .inv-actions-big .ai { width: 54px; height: 54px; }
  .inv-actions-big b { font-size: 18px; }
}

/* ================= inventory area: its own color (water turquoise instead of wheat gold), so it is clear where you are ================= */
.layout.area-inv { --area: #7fd3e0; }
.layout.area-inv .side nav a.on { background: linear-gradient(to left, rgba(127,211,224,.24), rgba(127,211,224,.04)); }
.layout.area-inv .side nav a.on::before { background: var(--area); }
.layout.area-inv .side nav a.on svg.i, .layout.area-inv .side .logo-box span { color: var(--area); }
.layout.area-inv .hero { background-color: #cfe8ee; }
.layout.area-inv .page-head h1 { color: var(--fg); }

/* recent imports + undo (settings) */
.inv-imh-t { margin: 18px 0 8px; font-size: 15px; }
