/* Stock and Inventory, compact: a slim summary strip, quick filter chips, a tucked-away filters and view box, per-style columns, and level bars.
   Colors come from the app tokens so light and dark both work. Rules start with #app so they win over the older shared sheets. */

#app .ivx-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--km2-border, #dce5e1); border-radius: 10px; overflow: hidden; background: var(--km2-surface, #fff); margin-bottom: 10px; }
#app .ivx-strip > div { padding: 8px 14px; border-right: 1px solid var(--km2-border, #dce5e1); min-width: 0; }
#app .ivx-strip > div:last-child { border-right: 0; }
#app .ivx-strip b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--km2-text, #16231e); }
#app .ivx-strip small { color: var(--km2-muted, #687871); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
#app .ivx-strip .is-warn b { color: var(--km2-warning, #d99118); }
#app .ivx-strip .is-bad b { color: var(--km2-danger, #c34d48); }

#app .ivx-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
#app .ivx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#app .ivx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--km2-border, #dce5e1); background: var(--km2-surface, #fff); color: var(--km2-text, #16231e); font-size: .8rem; cursor: pointer; }
#app .ivx-chip b { font-variant-numeric: tabular-nums; color: var(--km2-muted, #687871); font-weight: 600; }
#app .ivx-chip:hover { border-color: var(--km2-border-strong, #c9d6d1); }
#app .ivx-chip.is-on { background: var(--km2-accent, #147d64); border-color: var(--km2-accent, #147d64); color: #fff; }
#app .ivx-chip.is-on b { color: #fff; }
#app .ivx-search { flex: 1 1 200px; min-width: 150px; max-width: 320px; }

#app .ivx-more { flex: 1 1 100%; border: 1px solid var(--km2-border, #dce5e1); border-radius: 10px; padding: 6px 12px; background: var(--km2-surface, #fff); }
#app .ivx-more summary { cursor: pointer; font-size: .85rem; font-weight: 600; }
#app .ivx-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 12px; margin: 10px 0 4px; align-items: end; }
#app .ivx-form label { display: grid; gap: 3px; font-size: .78rem; color: var(--km2-muted, #687871); }
#app .ivx-style { border-top: 1px solid var(--km2-border, #dce5e1); padding-top: 10px; }
#app .ivx-wide { grid-column: 1 / -1; }
#app .ivx-note { margin: 0; font-size: .8rem; color: var(--km2-muted, #687871); }
#app .ivx-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 12px; }
#app .ivx-checks label { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--km2-text, #16231e); }

#app .ivx-num { text-align: right; font-variant-numeric: tabular-nums; }
#app .ivx-due { display: block; color: var(--km2-muted, #687871); font-size: .7rem; }
#app .ivx-warn { color: var(--km2-warning, #d99118); font-weight: 600; }
#app .ivx-bad { color: var(--km2-danger, #c34d48); font-weight: 600; }
#app .ivx-tag { background: color-mix(in srgb, var(--km2-blue, #2679ed) 14%, transparent); color: var(--km2-blue, #2679ed); }
#app .ivx-lvl { display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--km2-border, #e3ebe7); margin-top: 4px; overflow: hidden; }
#app .ivx-lvl i { display: block; height: 100%; border-radius: 2px; }
#app .ivx-lvl.is-ok i { background: var(--km2-success, #147d64); }
#app .ivx-lvl.is-low i { background: var(--km2-danger, #c34d48); }

@media (max-width: 700px) {
  #app .ivx-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #app .ivx-strip > div:nth-child(2n) { border-right: 0; }
  #app .ivx-search { max-width: none; flex: 1 1 100%; }
}

/* order what is low */
#app .ivx-order { white-space: nowrap; }
#app .rdx-group { border: 1px solid var(--km2-border, #dce5e1); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--km2-surface, #fff); }
#app .rdx-group > header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
#app .rdx-total { font-variant-numeric: tabular-nums; font-weight: 700; }
#app .rdx-tbl { width: 100%; min-width: 0; border-collapse: collapse; font-size: .82rem; }
#app .rdx-tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--km2-muted, #687871); padding: 4px 6px; }
#app .rdx-tbl td { padding: 5px 6px; border-top: 1px solid var(--km2-border, #e3ebe7); }
#app .rdx-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#app .rdx-qty { width: 72px; text-align: right; }
#app .rdx-note { margin: 4px 0 0; color: var(--km2-muted, #687871); font-size: .8rem; }
#app .rdx-tbl .inventory-inline-btn { white-space: nowrap; padding: 3px 8px; }
#app .rdx-tbl td:first-child { overflow-wrap: anywhere; }

/* Inventory header: the import tools sit behind one "Import" button (a small menu). */
#app .inventory-import-actions .inv-import-menu { position: relative; }
#app .inventory-import-actions .inv-import-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
#app .inventory-import-actions .inv-import-menu > summary::-webkit-details-marker { display: none; }
#app .inventory-import-actions .inv-import-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: grid; gap: 2px; width: 260px; padding: 6px; border: 1px solid var(--km2-border-strong, #cbd5e1); border-radius: 10px; background: var(--km2-surface, #fff); box-shadow: 0 12px 30px rgba(0, 0, 0, .18); }
#app .inventory-import-actions .inv-import-row { display: block !important; width: 100%; margin: 0; padding: 9px 10px !important; border: 0 !important; border-radius: 7px; background: transparent !important; color: var(--km2-text, #16231e) !important; font: inherit; font-size: .86rem !important; font-weight: 500 !important; text-align: left; cursor: pointer; box-shadow: none !important; min-height: 0 !important; }
#app .inventory-import-actions .inv-import-row:hover { background: var(--km2-surface-2, #eef5f2) !important; }
#app .inventory-import-actions .inv-import-row input[type=file] { display: none; }
@media (max-width: 560px) { #app .inventory-import-actions .inv-import-panel { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); } }
