/* Speed Inventory: only what the Speed UI system (public/css/speed-ui.css, added by the server) does not already have.
   Every color is a Suite token; the fallbacks keep the page readable if the system stylesheet is missing. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--su-bg, #f3f6f2); color: var(--su-fg, #16201a); font: 16px/1.5 var(--su-font-ui, system-ui, -apple-system, sans-serif); }
.inv { display: grid; gap: var(--su-space-4, 16px); padding-bottom: 48px; }
.inv-muted { color: var(--su-muted, #5b6a61); margin: 0; font-size: 14px; }
.inv-intro { color: var(--su-fg-2, #3c4a41); margin: 0 0 4px; max-width: 70ch; }

.inv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--su-space-3, 12px); }
.inv-title { min-width: 0; flex: 1 1 420px; }
.inv-sync { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.inv-stats .su-stat-value { font-variant-numeric: tabular-nums; }

.inv-tabs { justify-self: start; }
.inv-tabs [role="tab"] { min-height: 44px; }
/* All five tabs (and the Files count) fit a 360px phone, so no tab hides off the edge. */
@media (max-width: 440px) { .su-tabs.inv-tabs { gap: 0; } .su-tabs.inv-tabs [role="tab"] { padding: 0 8px; } .inv-badge { margin-left: 2px; } }
.inv-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--su-warn-bg, #fff4dc); color: var(--su-warn, #8a5300); font: 700 12px/1 var(--su-font-ui, system-ui); }
.inv-panel { display: grid; gap: var(--su-space-4, 16px); min-width: 0; }

/* Adding stock */
.inv-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.inv-file { position: relative; overflow: hidden; cursor: pointer; }
.inv-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.inv-file:focus-within { box-shadow: 0 0 0 3px var(--su-accent-soft, #edf7f1); }
.inv-more { flex: 1 1 260px; }
.inv-more summary { list-style: none; cursor: pointer; }
.inv-more summary::-webkit-details-marker { display: none; }
.inv-more-body { display: grid; gap: 10px; padding-top: 10px; }
.inv-from-scan { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--su-accent-soft, #edf7f1); border-radius: var(--su-radius, 10px); padding: 10px 12px; margin-top: 12px; }
.inv-from-scan p { margin: 0; }
#stock { margin-top: 10px; }
#stock .err { color: var(--su-bad, #9b1c1c); }

/* Stock table */
.inv-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
@media (max-width: 599px) { .inv-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .inv-search { grid-column: span 2; } }
.inv-table-card { min-width: 0; }
.inv-table td { vertical-align: middle; }
.inv-table td:first-child { min-width: 180px; }
.inv-table .inv-card-name { font-weight: 600; color: var(--su-fg, #16201a); overflow-wrap: break-word; }
.inv-table .inv-card-sub { color: var(--su-muted, #5b6a61); font-size: 13px; }
.inv-table th.ch, .inv-table td.ch { text-align: center; white-space: nowrap; }
.inv-qty { display: inline-flex; align-items: center; gap: 2px; }
.inv-qty button { min-width: 36px; min-height: 36px; border-radius: 8px; border: 1px solid var(--su-line-strong, #c3cfc4); background: var(--su-surface, #fff); color: var(--su-fg, #16201a); font: 600 16px/1 var(--su-font-ui, system-ui); cursor: pointer; }
.inv-qty output { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-chip { display: inline-block; min-width: 28px; padding: 3px 8px; border-radius: 999px; font: 600 13px/1.3 var(--su-font-ui, system-ui); font-variant-numeric: tabular-nums; border: 1px solid var(--su-line, #dbe3db); color: var(--su-muted, #5b6a61); }
.inv-chip.on { background: var(--su-ok-bg, #e8f6ee); border-color: var(--su-ok-line, #b7e0c8); color: var(--su-ok, #1d6b43); }
.inv-chip.due { background: var(--su-warn-bg, #fff4dc); border-color: var(--su-warn-line, #f0d49a); color: var(--su-warn, #8a5300); }
.inv-chip.off { border-style: dashed; }
.inv-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.inv-low td:first-child { box-shadow: inset 3px 0 0 var(--su-warn, #8a5300); }
.inv-out { opacity: .7; }
/* Phones: each card is a block instead of a row of a wide table (no sideways scrolling). The name and details span the top,
   then In stock (with 44px − and + buttons), Market, one labelled chip per store, and the actions. The column titles come
   from each cell's data-label, so nothing is lost when the table header is hidden. */
@media (max-width: 599px) {
  .inv-table-card .su-table-wrap { overflow: visible; border: 0; background: transparent; }
  .inv-table, .inv-table tbody { display: block; width: 100%; }
  .inv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .inv-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px 8px; padding: 12px; margin: 0 0 10px; border: 1px solid var(--su-line, #dbe3db); border-radius: 12px; background: var(--su-surface, #fff); }
  .inv-table tr td, .inv-table tr td.r { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .inv-table td.inv-card { grid-column: 1 / -1; min-width: 0; }
  .inv-table td.inv-instock { grid-column: span 2; }
  .inv-table td.inv-actions { grid-column: 1 / -1; }
  .inv-table td.ch { text-align: left; }
  .inv-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 12px; color: var(--su-muted, #5b6a61); white-space: normal; }
  .inv-table .inv-row-actions { justify-content: flex-start; }
  .inv-row-actions .su-btn { min-height: 44px; }
  .inv-qty button { min-width: 44px; min-height: 44px; }
  .inv-low { border-left: 4px solid var(--su-warn, #8a5300) !important; }
  .inv-low td:first-child { box-shadow: none; }
}

/* Stores */
.inv-channels { display: grid; gap: var(--su-space-4, 16px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.inv-ch { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.inv-ch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.inv-ch-head h3 { margin: 0; font: 400 22px/1.2 var(--su-font-display, Georgia, serif); }
.inv-ch p { margin: 0; }
.inv-ch-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-ch ol { margin: 0; padding-left: 20px; color: var(--su-fg-2, #3c4a41); font-size: 14px; display: grid; gap: 4px; }
.inv-ch form { display: grid; gap: 10px; }
.inv-ch .su-row { margin-top: auto; }

/* Activity */
.inv-events li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.inv-events time { color: var(--su-muted, #5b6a61); font: 400 13px/1.4 var(--su-font-mono, ui-monospace, monospace); white-space: nowrap; }
.inv-events p { margin: 4px 0 0; overflow-wrap: anywhere; }

/* Rules */
.inv-rules { margin: 12px 0 16px; padding-left: 22px; display: grid; gap: 10px; }
.inv-rules li { line-height: 1.45; }
.inv-rules .off { color: var(--su-muted, #5b6a61); text-decoration: line-through; }
.inv-rules button { margin-left: 6px; }
.inv-builder { display: grid; gap: 12px; border-top: 1px solid var(--su-line, #dbe3db); padding-top: 14px; }
.inv-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inv-line .su-select, .inv-line .su-input { width: auto; max-width: 100%; }
.inv-line input[type=number] { width: 110px; }
.inv-line label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-right: 8px; }

/* Files */
.inv-files { display: grid; gap: var(--su-space-4, 16px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.inv-file-card { display: flex; flex-direction: column; gap: 8px; }
.inv-file-card h3 { margin: 0; font: 400 20px/1.2 var(--su-font-display, Georgia, serif); }
.inv-file-card p { margin: 0; }
.inv-file-card .su-row { margin-top: auto; }
.inv-summary { white-space: pre-wrap; background: var(--su-accent-soft, #edf7f1); border-radius: var(--su-radius, 10px); padding: 12px; margin: 8px 0 0; font: 14px/1.5 var(--su-font-mono, ui-monospace, monospace); overflow-wrap: anywhere; }
.inv-changes { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.inv-changes li { border-top: 1px solid var(--su-line, #dbe3db); padding-top: 6px; overflow-wrap: anywhere; }
.inv-changes small { color: var(--su-muted, #5b6a61); display: block; }

.inv-report { margin-bottom: 12px; }
.inv-report-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; cursor: pointer; }
.inv-report-row input { margin-top: 4px; width: 18px; height: 18px; flex: none; }

.inv-watch-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.inv-watch-form input, .inv-watch-form select { font: inherit; min-height: 40px; padding: 6px 10px; border: 1px solid var(--su-line, #ccc); border-radius: 8px; flex: 1 1 140px; min-width: 0; }
.inv-watch-li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

/* Touch screens: the stock steppers are 44px on an iPad too. */
@media (pointer: coarse) {
  .inv-qty button { min-width: 44px; min-height: 44px; }
}
.inv-mail { margin-bottom: 16px; }
.inv-mail-addr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-mail-addr code, .inv-mail code { overflow-wrap: anywhere; font-size: 13px; }
.inv-mail details summary { cursor: pointer; font-weight: 600; }
.inv-mail-pending .su-row { flex-wrap: wrap; }
.inv-mail-pending select { max-width: 100%; min-width: 0; flex: 1 1 220px; }
