/* Cavix platform pack — loaded after app CSS */
/* ------------------------------------------------------------------
   Platform pack — phone, tablet, desktop, landscape
   chrome2: header/footer visual weight, Stock label, Today/Dashboard taps
   navfix: Stock rewrite targets 2nd button.ml-tab (not Today)
   empty1: Inventory empty CTAs (starter shelf + CSV)
   ------------------------------------------------------------------ */

@media (hover: none) and (pointer: coarse) {
  .ml-btn,
  .ml-tab,
  .ml-chip,
  .ml-filter-btn,
  .ml-fab,
  .ml-gear-btn,
  .ml-scan-find-btn,
  .ml-save-btn,
  .ml-job-archive-btn,
  .ml-dash-close {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ------------------------------------------------------------------
   HEADER + FOOTER — shop-floor thumbs (phone & tablet)
   ------------------------------------------------------------------ */
@media (max-width: 959px) {
  .ml-header-top {
    gap: 12px !important;
    align-items: center !important;
  }
  .ml-header-top > div:last-child {
    gap: 8px !important;
  }

  .ml-gear-btn {
    width: 76px !important;
    height: 76px !important;
    min-width: 76px !important;
    min-height: 76px !important;
    padding: 0 !important;
    border-radius: 18px !important;
    color: #F8FAFC !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.08) !important;
  }
  .ml-gear-btn svg {
    width: 40px !important;
    height: 40px !important;
    stroke-width: 2.35px !important;
  }
  .ml-gear-btn:active {
    background: rgba(255, 255, 255, 0.2) !important;
  }

  .ml-tabbar {
    padding: 6px 2px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .ml-tab {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    min-height: 88px !important;
    padding: 12px 1px 14px !important;
    gap: 6px !important;
    letter-spacing: 0.01em !important;
    border-radius: 14px !important;
    justify-content: center !important;
  }
  .ml-tab svg {
    width: 34px !important;
    height: 34px !important;
    stroke-width: 2.35px !important;
  }
  .ml-tab-icon-wrap svg {
    width: 34px !important;
    height: 34px !important;
    stroke-width: 2.35px !important;
  }
  .ml-tab.active {
    color: #F2EFE7 !important;
  }
  .ml-tab.active svg {
    color: #C8501E !important;
  }
  .ml-tab-badge {
    font-size: 11px !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 5px !important;
    top: -6px !important;
  }

  /* Inventory = 2nd button.ml-tab (preceded by .ml-sidebar-brand div).
     Old :nth-child(2) wrongly targeted Today after sidebar brand was added. */
  .ml-tabbar-inner > button.ml-tab:nth-of-type(2) > span:last-child {
    font-size: 0 !important;
    line-height: 0 !important;
  }
  .ml-tabbar-inner > button.ml-tab:nth-of-type(2) > span:last-child::after {
    content: "Stock";
    font-size: 12.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    line-height: 1.2;
  }

  /* Dashboard / sheet Close control */
  .ml-dash-close {
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    border-width: 1.5px !important;
    gap: 8px !important;
  }
  .ml-dash-close svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Today attention row Receive / Count buttons */
  .ml-attn-row .ml-job-archive-btn {
    min-height: 52px !important;
    min-width: 108px !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    border-width: 1.5px !important;
    color: #2A2520 !important;
    background: #F2EFE7 !important;
  }
}

/* Phone inventory actions — tall 2-up taps */
@media (max-width: 767px) {
  .ml-search-wrap,
  .ml-controls {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .ml-list {
    padding: 14px 12px 28px !important;
  }

  .ml-card-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin-top: 16px !important;
  }
  .ml-card-actions .ml-btn {
    min-height: 76px !important;
    padding: 18px 10px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em !important;
    border-radius: 14px !important;
    border-width: 2px !important;
    gap: 8px !important;
  }
  .ml-card-actions .ml-btn svg {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
  }
  .ml-card-actions .ml-btn:nth-child(5) {
    grid-column: 1 / -1 !important;
  }

  .ml-chip {
    font-size: 15px !important;
    padding: 12px 18px !important;
    min-height: 48px !important;
    font-weight: 600 !important;
  }

  .ml-select,
  .ml-filter-btn {
    font-size: 16px !important;
    min-height: 52px !important;
  }

  .ml-fab {
    width: 68px !important;
    height: 68px !important;
    right: max(16px, env(safe-area-inset-right)) !important;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .ml-modal {
    padding-bottom: max(28px, env(safe-area-inset-bottom, 0px)) !important;
  }
  .ml-save-btn {
    min-height: 60px !important;
    font-size: 17px !important;
  }
}

@media (min-width: 768px) and (max-width: 959px) {
  .ml-header {
    padding-left: 22px !important;
    padding-right: 22px !important;
  }
  .ml-search-wrap,
  .ml-controls,
  .ml-list {
    padding-left: 22px !important;
    padding-right: 22px !important;
  }
  .ml-list {
    padding-top: 16px !important;
    padding-bottom: 32px !important;
  }
  .ml-list-inventory {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px 14px !important;
    align-items: start !important;
  }
  .ml-list-inventory > .ml-bulk-bar {
    grid-column: 1 / -1 !important;
  }
  .ml-card-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  .ml-card-actions .ml-btn {
    min-height: 68px !important;
    font-size: 16.5px !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
  }
  .ml-card-actions .ml-btn:nth-child(5) {
    grid-column: 1 / -1 !important;
  }
  .ml-card-actions .ml-btn svg {
    width: 22px !important;
    height: 22px !important;
  }
  .ml-fab {
    right: 28px !important;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (min-width: 960px) and (max-width: 1599px) {
  .ml-list-inventory {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px 16px !important;
    align-items: start !important;
  }
  .ml-list-inventory > .ml-bulk-bar {
    grid-column: 1 / -1 !important;
  }
  .ml-list {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .ml-card-actions .ml-btn {
    min-height: 56px !important;
    font-size: 15.5px !important;
  }
  /* Desktop sidebar: do not rewrite Inventory → Stock */
  .ml-tabbar-inner > button.ml-tab:nth-of-type(2) > span:last-child {
    font-size: inherit !important;
    line-height: inherit !important;
  }
  .ml-tabbar-inner > button.ml-tab:nth-of-type(2) > span:last-child::after {
    content: none !important;
  }
}

@media (min-width: 1600px) {
  .ml-list-inventory {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)) !important;
    gap: 10px 16px !important;
  }
  .ml-list-inventory > .ml-bulk-bar {
    grid-column: 1 / -1 !important;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .ml-tab {
    min-height: 64px !important;
    padding: 8px 2px 10px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
  }
  .ml-tab svg,
  .ml-tab-icon-wrap svg {
    width: 22px !important;
    height: 22px !important;
  }
  .ml-gear-btn {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
  }
  .ml-gear-btn svg {
    width: 26px !important;
    height: 26px !important;
  }
  .ml-header {
    padding-bottom: 10px !important;
  }
  .ml-stats {
    display: none !important;
  }
  .ml-fab {
    width: 56px !important;
    height: 56px !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .ml-card-actions .ml-btn {
    min-height: 56px !important;
    font-size: 15px !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  .ml-card-actions .ml-btn:hover {
    filter: brightness(0.97);
  }
  .ml-chip:hover {
    border-color: #2A2520 !important;
  }
  .ml-gear-btn:hover {
    background: rgba(255, 255, 255, 0.14) !important;
  }
}

/* ------------------------------------------------------------------
   empty1 — Inventory empty primary actions
   ------------------------------------------------------------------ */
.ml-empty-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 360px);
  margin: 18px auto 0;
  padding: 0 4px;
  box-sizing: border-box;
}
.ml-empty-ctas .ml-empty-cta-primary,
.ml-empty-ctas .ml-empty-cta-secondary {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  justify-content: center;
}
.ml-empty-cta-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft, #6B645C);
  text-align: center;
  margin-top: 2px;
}
@media (max-width: 767px) {
  .ml-empty-ctas .ml-empty-cta-primary,
  .ml-empty-ctas .ml-empty-cta-secondary {
    min-height: 56px;
    font-size: 16.5px;
  }
}
