/* Mobile/tablet inventory: shared controls, readable stock rows, no hidden
 * horizontal spreadsheet. Desktop keeps the existing inventory views. */
#inventory .ic-heading,
#inventory .inventory-compact,
#inventory .ic-filter-toggle { display: none; }

@media (max-width: 1200px) {
  body:not(.auth-locked) #page-inventory #inventory.panel { min-width: 0; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  #page-inventory #inventoryKpiGrid,
  #page-inventory #inventoryResultMeta,
  #page-inventory #inventoryList,
  #page-inventory #assetList,
  #page-inventory #assetDetail,
  #page-inventory #consumableAssets,
  #page-inventory .inventory-manage-head { display: none !important; }
  #page-inventory #inventory .inventory-subview:not(.is-active) { display: none !important; }
  #page-inventory #inventory .ic-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
  #page-inventory #inventoryCompactTitle { margin: 4px 0 0; font-size: 28px; letter-spacing: -.8px; line-height: 1.25; color: #14213a; }
  #page-inventory #inventoryCompactAdd { flex: none; height: 44px; padding: 0 14px; font-size: 14px; font-weight: 700; color: #fff; background: #245ce4; border-radius: 12px; white-space: nowrap; border: 0; }
  #page-inventory #inventory .inventory-tabs { display: flex !important; width: 100%; max-width: none !important; box-sizing: border-box; gap: 8px !important; margin: 0 0 16px !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  #page-inventory #inventory .inventory-tab { flex: 1 1 0; min-width: 0 !important; min-height: 44px !important; padding: 8px 6px !important; border: 1px solid #d3dcea !important; border-radius: 10px !important; color: #475569 !important; background: #fff !important; font-size: 14px; font-weight: 650; white-space: nowrap; box-shadow: none !important; }
  #page-inventory #inventory .inventory-tab.is-active { color: #fff !important; border-color: #245ce4 !important; background: #245ce4 !important; box-shadow: none !important; }
  #page-inventory #inventory .inventory-tab::after { display: none !important; }

  #page-inventory #inventory .ic-filterbar { display: grid !important; grid-template-columns: minmax(0,1fr) auto !important; gap: 10px !important; width: 100%; min-width: 0; padding: 0 !important; margin: 0 0 16px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  #page-inventory #inventory .ic-filterbar[hidden] { display: none !important; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box { grid-column: 1 !important; grid-row: 1; display: flex !important; align-items: center; min-width: 0 !important; max-width: none !important; width: 100% !important; height: 48px !important; padding: 0 10px !important; gap: 6px; border: 1px solid #d7e0ec !important; border-radius: 11px !important; background: #fff !important; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box::before,
  #page-inventory #inventory .ic-filterbar .inventory-search-box::after { display: none !important; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box:focus-within { outline: 2px solid #245ce4; outline-offset: 2px; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box input { flex: 1 !important; min-width: 0 !important; width: 100% !important; height: 44px !important; padding: 0 !important; font-size: 15px !important; border: 0 !important; outline: none; box-shadow: none !important; background: transparent !important; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box input::placeholder { font-size: 13px !important; }
  #page-inventory #inventory .ic-filterbar .inventory-search-box .icon-button { position: relative !important; inset: auto !important; transform: none !important; flex: 0 0 32px !important; width: 32px !important; min-width: 32px !important; height: 44px !important; min-height: 44px !important; border: 0 !important; background: transparent !important; }
  #page-inventory #inventory .ic-filter-toggle { display: inline-flex !important; grid-column: 2; grid-row: 1; align-items: center; justify-content: center; height: 48px !important; width: auto !important; min-width: 64px; padding: 0 12px; border: 1px solid #d7e0ec; border-radius: 11px; color: #334155; background: #fff; white-space: nowrap !important; flex-shrink: 0; font-size: 14px; }
  #page-inventory #inventory .ic-filter-toggle[aria-expanded="true"] { border-color: #245ce4; background: #eff5ff; color: #245ce4; }
  #page-inventory #inventory .ic-filterbar > select,
  #page-inventory #inventory .ic-filterbar > .ghost-button,
  #page-inventory #inventory .ic-filterbar > .primary-button { display: none !important; }
  #page-inventory #inventory .ic-filterbar.ic-filters-open > select,
  #page-inventory #inventory .ic-filterbar.ic-filters-open > .ghost-button { display: block !important; grid-column: 1 / -1; width: 100% !important; min-width: 0 !important; min-height: 44px; font-size: 14px; border-radius: 10px; }
  #page-inventory #inventory .inventory-compact { display: block; min-width: 0; }
  #page-inventory .ic-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }
  #page-inventory .ic-metric { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid #dfe6ef; border-radius: 12px; background: #fff; }
  #page-inventory .ic-metric > span { font-size: 12px; color: #64748b; }
  #page-inventory .ic-metric > strong { font-size: 21px; font-weight: 750; color: #24354f; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  #page-inventory .ic-metric.is-available { border-color: #cfe4da; background: #f1f9f5; }
  #page-inventory .ic-metric.is-available > strong { color: #18704c; }
  #page-inventory .ic-chips { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 8px; }
  #page-inventory .ic-chips button { flex: 0 0 auto; min-height: 42px; padding: 8px 14px; border: 1px solid #dbe2ec; border-radius: 22px; font-size: 13px; font-weight: 600; white-space: nowrap; color: #475569; background: #fff; }
  #page-inventory .ic-chips button[aria-pressed="true"] { background: #172b4d; border-color: #172b4d; color: #fff; }
  #page-inventory .ic-list-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  #page-inventory #inventoryCompactCount { font-size: 13px; color: #64748b; }
  #page-inventory #inventoryCompactSort { width: auto; max-width: 100%; min-height: 42px; padding: 6px 10px; font-size: 13px; color: #334155; border: 1px solid #dbe2ec; border-radius: 9px; background: #fff; }
  #page-inventory .ic-table-head,
  #page-inventory .ic-row { display: grid; grid-template-columns: minmax(0,1fr) repeat(3,72px) 44px; gap: 12px; align-items: center; }
  #page-inventory .ic-table-head { padding: 10px 16px; color: #64748b; font-size: 12px; text-align: right; }
  #page-inventory .ic-table-head > span:first-child { text-align: left; }
  #page-inventory .ic-list { border: 1px solid #dbe3ed; border-radius: 14px; background: #fff; overflow: hidden; }
  #page-inventory #inventoryCompactRows .ic-row { min-width: 0; width: 100%; height: auto; margin: 0; padding: 18px 16px; border: 0; border-bottom: 1px solid #e8edf3; border-radius: 0; background: #fff; text-align: left; white-space: normal; color: #172b4d; box-shadow: none; }
  #page-inventory #inventoryCompactRows .ic-row:last-child { border-bottom: 0; }
  #page-inventory #inventoryCompactRows .ic-row:hover { background: #f8fbff; }
  #page-inventory #inventoryCompactRows .ic-row:focus-visible { outline: 3px solid #245ce4; outline-offset: -3px; }
  #page-inventory .ic-item { display: flex; flex-direction: column; min-width: 0; gap: 4px; overflow-wrap: anywhere; }
  #page-inventory .ic-name { font-size: 17px; font-weight: 750; line-height: 1.5; letter-spacing: -.3px; }
  #page-inventory .ic-code { font-size: 12px; color: #64748b; line-height: 1.5; }
  #page-inventory .ic-description { font-size: 13px; color: #475569; line-height: 1.5; }
  #page-inventory .ic-quantities { display: contents; }
  #page-inventory .ic-quantity { min-width: 0; text-align: right; overflow-wrap: anywhere; }
  #page-inventory .ic-quantity-label { display: none; }
  #page-inventory .ic-quantity strong { color: #334155; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
  #page-inventory .ic-quantity strong small { font-size: 11px; font-weight: 500; margin-left: 3px; }
  #page-inventory .ic-available strong { color: #18704c; font-size: 22px; }
  #page-inventory .is-unavailable .ic-available strong { color: #a04a35; }
  #page-inventory .ic-open { font-size: 12px; color: #64748b; white-space: nowrap; text-align: right; }
  #page-inventory .ic-row-note { grid-column: 1 / -1; font-size: 12px; color: #80532c; line-height: 1.5; }
  #page-inventory .ic-pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding: 20px 0 28px; }
  #page-inventory .ic-pager button,
  #page-inventory .ic-pager select { min-height: 44px; width: auto; padding: 8px 12px; border: 1px solid #dbe2ec; border-radius: 9px; background: #fff; color: #334155; font-size: 13px; white-space: nowrap; }
  #page-inventory .ic-pager > span { color: #64748b; font-size: 13px; }
  #page-inventory .ic-pager button:disabled { opacity: .4; cursor: default; }
  #page-inventory .ic-empty { text-align: center; padding: 40px 16px; color: #64748b; }
  #page-inventory .ic-empty strong { font-size: 17px; color: #334155; }
  #page-inventory .ic-empty p { font-size: 14px; line-height: 1.7; }
  #page-inventory .ic-empty button { min-height: 44px; padding: 8px 14px; border-radius: 9px; background: #eff5ff; color: #245ce4; }


}

/* Inventory details share one information structure at every viewport size. */
#modal-asset-quickview[open],
#modal-asset-detail[open] {
  display: flex !important; flex-direction: column; gap: 0 !important;
  width: min(680px,calc(100vw - 24px)) !important; max-width: calc(100vw - 24px) !important;
  height: auto !important; max-height: min(900px,calc(100dvh - 32px)) !important;
  padding: 0 !important; border: 1px solid #dce3ec; border-radius: 16px !important; overflow: hidden !important;
  background: #fff;
}
#modal-asset-quickview .modal-header,
#modal-asset-detail .modal-header { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 16px 20px !important; margin: 0 !important; border-bottom: 1px solid #e4e9f0; }
#modal-asset-detail .modal-header > div { flex: 1; min-width: 0; }
#modal-asset-detail #assetDetailModalTitle { line-height: 1.5 !important; }
#modal-asset-detail #assetDetailModalBody { background: #fff !important; }
#modal-asset-detail .asset-detail-modal-actions { box-shadow: none !important; }
#modal-asset-quickview #assetQuickViewTitle,
#modal-asset-detail #assetDetailModalTitle { flex: 1; min-width: 0; margin: 0; font-size: 20px !important; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; color: #18283f; }
#modal-asset-quickview .close-modal,
#modal-asset-detail .close-modal { flex: 0 0 44px; width: 44px; height: 44px; }
#modal-asset-quickview #assetQuickViewBody,
#modal-asset-detail #assetDetailModalBody { display: block; flex: 1 1 auto; min-height: 0; max-height: none !important; overflow-y: auto !important; overflow-x: hidden; overscroll-behavior: contain; padding: 18px 20px !important; margin: 0 !important; }
#modal-asset-quickview .modal-actions,
#modal-asset-detail .modal-actions { position: static !important; flex: 0 0 auto; display: flex !important; flex-wrap: wrap; gap: 8px !important; padding: 14px 20px !important; margin: 0 !important; border-top: 1px solid #e4e9f0; background: #fff; }
#modal-asset-quickview .modal-actions button,
#modal-asset-detail .modal-actions button { flex: 1 1 80px; min-width: 0 !important; min-height: 44px !important; padding: 10px !important; font-size: 14px; white-space: nowrap; }
.inventory-detail { min-width: 0; color: #18283f; text-align: left; font-size: 14px; line-height: 1.6; }
.inventory-detail .id-title { margin: 0 0 4px; font-size: 22px; overflow-wrap: anywhere; }
.inventory-detail .id-meta { margin: 0 0 16px; color: #64748b; font-size: 13px; overflow-wrap: anywhere; }
.inventory-detail .id-stock { border: 1px solid #dce5ed; border-radius: 12px; overflow: hidden; }
.inventory-detail .id-available { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px; background: #eff8f3; color: #176244; }
.inventory-detail .id-available > span { font-size: 14px; font-weight: 700; }
.inventory-detail .id-available > strong { font-size: 30px; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.inventory-detail .id-available.is-empty { background: #fff5ef; color: #994626; }
.inventory-detail .id-stock-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px 12px; padding: 16px; background: #fff; }
.inventory-detail .id-metric { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inventory-detail .id-metric > span { color: #64748b; font-size: 12px; }
.inventory-detail .id-metric > strong { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inventory-detail .id-section { margin: 0; padding: 20px 0; border-bottom: 1px solid #e6ebf1; }
.inventory-detail .id-section h4 { margin: 0 0 12px; font-size: 14px; font-weight: 750; color: #26364d; }
.inventory-detail .id-fields { margin: 0; }
.inventory-detail .id-field { display: grid; grid-template-columns: 80px minmax(0,1fr); gap: 12px; padding: 5px 0; }
.inventory-detail .id-field dt { color: #64748b; font-size: 13px; }
.inventory-detail .id-field dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.inventory-detail .id-muted { margin: 0; font-size: 13px; color: #748196; }
.inventory-detail .id-memo { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.inventory-detail .id-history-entry { padding: 12px 0; border-bottom: 1px solid #edf0f5; }
.inventory-detail .id-history-entry:last-child { border: 0; padding-bottom: 0; }
.inventory-detail .id-history-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.inventory-detail .id-client { min-width: 0; padding: 0; min-height: 44px; border: 0; background: none; color: #2459ab; font-size: 14px; font-weight: 650; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.inventory-detail .id-history-head > strong { flex-shrink: 0; font-size: 14px; padding-top: 10px; }
.inventory-detail .id-history-dates { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: #475569; }
.inventory-detail .id-history-status { display: inline-block; margin-top: 8px; padding: 2px 8px; background: #f0f3f7; border-radius: 4px; font-size: 12px; color: #475569; }
.inventory-detail .id-history-place { margin: 6px 0 0; font-size: 13px; color: #64748b; overflow-wrap: anywhere; }
.inventory-detail .id-history-more { width: 100%; min-height: 44px; margin-top: 14px; border: 1px solid #dae2ed; border-radius: 8px; color: #345078; background: #fff; font-size: 14px; }
.inventory-detail .id-audit { padding-top: 16px; font-size: 12px; color: #64748b; }
#modal-asset-quickview .ic-management { margin-top: 12px; }
#modal-asset-quickview .ic-management summary { min-height: 44px; padding: 12px 0; color: #64748b; font-size: 13px; cursor: pointer; }
#modal-asset-quickview .ic-management-actions { display: flex; gap: 12px; }
#modal-asset-quickview .ic-management-actions button { flex: 1; min-height: 44px; font-size: 14px; }

@media (max-width: 768px) {
  #page-inventory #inventory .ic-filterbar .inventory-search-box input { font-size: 16px !important; }
  #page-inventory #inventoryCompactTitle { font-size: 25px; }
  #page-inventory .ic-table-head { display: none; }
  #page-inventory #inventoryCompactRows .ic-row { grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 18px 16px; }
  #page-inventory .ic-item { grid-column: 1 / -1; }
  #page-inventory .ic-name { font-size: 18px; }
  #page-inventory .ic-quantities { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding: 12px; border-radius: 10px; background: #f6f8fb; }
  #page-inventory .ic-quantity { text-align: left; }
  #page-inventory .ic-quantity-label { display: block; font-size: 12px; color: #64748b; margin-bottom: 4px; }
  #page-inventory .ic-quantity strong { font-size: 20px; }
  #page-inventory .ic-available strong { font-size: 24px; }
  #page-inventory .ic-open { grid-column: 2; grid-row: 3; }
  #page-inventory .ic-row-note { grid-column: 1; grid-row: 3; }
}
