/* Parts & supplies inventory (shared by the offline and online Ticket Desk) */
.inv { padding: 16px; }
.inv[hidden] { display: none !important; }
.inv .muted { color: var(--muted); }
.inv-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.inv-toolbar .grow { flex: 1; }
.inv-search { flex: 1 1 280px; max-width: 460px; font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.inv-cat { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.inv-lowbtn { font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 8px; border: 1px solid #fed7aa; background: #fff7ed; color: #9a3412; cursor: pointer; }
.inv-lowbtn.on { background: #ea580c; border-color: #ea580c; color: #fff; }
.inv-lowcount:not(:empty) { background: #dc2626; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.inv-lowbtn.on .inv-lowcount:not(:empty) { background: #fff; color: #ea580c; }
.inv-summary { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin: 4px 2px 12px; }
.inv-summary b { color: var(--text); }
.inv-summary .warn b { color: #c2410c; }
.inv-summary .bad b { color: #dc2626; }
.inv-list { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.inv-empty { padding: 30px; text-align: center; color: var(--muted); margin: 0; }
.inv-empty p { margin: 4px 0; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); background: #fafafa; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.inv-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.inv-table tbody tr { cursor: pointer; }
.inv-table tbody tr:hover td { background: #f8fafc; }
.inv-table tr.low td { background: #fffbeb; }
.inv-table tr.out td { background: #fef2f2; }
.inv-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-table .ph { width: 52px; }
.inv-table .ph img, .noph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--bg); font-size: 20px; }
.inv-table .pn { font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: nowrap; }
.inv-table .nm small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.qtywrap { display: inline-flex; align-items: center; gap: 6px; }
.qtywrap b { font-size: 17px; min-width: 26px; text-align: right; }
.qtywrap small { color: var(--muted); font-size: 12px; min-width: 30px; text-align: left; }
.qbtn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.qbtn:hover { background: #0f172a; color: #fff; border-color: #0f172a; }
.qbtn:disabled { opacity: .5; }
.flag { display: inline-block; font-style: normal; font-size: 11px; font-weight: 800; text-transform: uppercase; background: #ea580c; color: #fff; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.flag.out { background: #dc2626; }

/* editor */
.inv-overlay { position: fixed; inset: 0; z-index: 55; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.inv-overlay[hidden] { display: none; }
.inv-modal { background: #fff; color: var(--text); border-radius: 14px; width: 100%; max-width: 760px; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.inv-hd { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.inv-hd h3 { margin: 0; flex: 1; font-size: 17px; }
.inv-x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.inv-bd { padding: 16px 18px; overflow-y: auto; }
.inv-bd h4 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.inv-bd section[hidden] { display: none; }
.inv-qtybig { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: #ecfdf5; color: #065f46; border-radius: 10px; padding: 12px 16px; }
.inv-qtybig.low { background: #fff7ed; color: #9a3412; }
.inv-qtybig.out { background: #fef2f2; color: #991b1b; }
.inv-qtybig b { font-size: 32px; line-height: 1; }
.inv-qtybig em { font-style: normal; font-weight: 700; margin-left: auto; }
.inv-adjust { display: grid; grid-template-columns: 130px 80px 1fr 1fr; gap: 8px; margin-top: 10px; }
.inv-adjust .adj-note { grid-column: 1 / 4; }
.inv-adjust select, .inv-adjust input { font: inherit; font-size: 14px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.inv-adjust [hidden] { display: none; }
.inv-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-ph, .inv-addph { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; padding: 0; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.inv-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-addph { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; border-style: dashed; color: var(--muted); }
.inv-addph span { font-size: 11px; font-weight: 600; }
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.inv-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.inv-grid label[hidden] { display: none; }
.inv-grid label small { font-weight: 500; }
.inv-grid .full { grid-column: 1 / -1; }
.inv-grid input, .inv-grid select, .inv-grid textarea { font: inherit; font-size: 15px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
.inv-grid .bad { border-color: #dc2626; }
.inv-margin { margin: 8px 0 0; font-weight: 700; color: #065f46; font-size: 14px; }
.inv-history { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.inv-history li { display: grid; grid-template-columns: 54px 1fr; gap: 0 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.inv-history li:last-child { border-bottom: 0; }
.inv-history .chg { grid-row: span 2; font-weight: 800; font-size: 16px; text-align: right; align-self: center; }
.inv-history .chg.up { color: #059669; } .inv-history .chg.down { color: #dc2626; }
.inv-history .who { color: var(--muted); font-size: 12px; }
.inv-ft { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafafa; }
.inv-ft .grow { flex: 1; }
.inv-ft [hidden] { display: none; }
.inv-viewer { position: fixed; inset: 0; background: rgba(8,10,14,.95); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; z-index: 2; }
.inv-viewer[hidden] { display: none; }
.inv-viewer img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 8px; cursor: pointer; }
.inv-vbar { display: flex; gap: 10px; align-items: center; color: #cbd5e1; font-size: 14px; flex-wrap: wrap; justify-content: center; }
.inv-vbar [hidden] { display: none; }

@media (max-width: 760px) {
  .inv { padding: 10px; }
  .inv-search { max-width: none; }
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody, .inv-table tr, .inv-table td { display: block; }
  .inv-table tr { display: grid; grid-template-columns: 52px 1fr auto; gap: 2px 10px; padding: 10px; border-bottom: 1px solid var(--line); }
  .inv-table td { border: 0; padding: 0; background: none !important; }
  .inv-table .ph { grid-row: span 3; }
  .inv-table .nm { grid-column: 2; }
  .inv-table .qty { grid-column: 3; grid-row: 1 / span 2; }
  .inv-table .pn, .inv-table .ct, .inv-table .lc { grid-column: 2; font-size: 12px; color: var(--muted); }
  .inv-table .ct, .inv-table .pr, .inv-table .cs { display: none; }
  .inv-adjust { grid-template-columns: 1fr 80px; }
  .inv-adjust .adj-reason, .inv-adjust .adj-ticket, .inv-adjust .adj-note { grid-column: 1 / -1; }
  .inv-grid { grid-template-columns: 1fr; }
}
