/**
 * Kho hàng — visual quality (#188 follow-up)
 * Scope: search affordance, overview metric density, desktop shell spacing, sidebar foot clock
 */

/* —— Search: icon + placeholder (parity with topbar search) —— */
body.use-new-ui.route-inventory .kho-sync-search-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
}

body.use-new-ui.route-inventory .kho-sync-search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

body.use-new-ui.route-inventory .kho-sync-search-wrap .kho-sync-search {
  width: 100%;
  min-width: 0;
  padding-left: 34px !important;
  padding-right: 12px !important;
}

body.use-new-ui.route-inventory .kho-sync-search-wrap--plain::before {
  content: "▾";
  font-size: 11px;
  opacity: 0.55;
  left: 11px;
}

body.use-new-ui.route-inventory .inv-product-toolbar .kho-sync-search-wrap,
body.use-new-ui.route-inventory .inv-batch-desk-toolbar .kho-sync-search-wrap {
  flex: 1 1 200px;
  max-width: min(360px, 100%);
}

body.use-new-ui.route-inventory .inv-batch-desk-toolbar .kho-sync-search-wrap--plain {
  flex: 0 1 140px;
  max-width: 180px;
}

@media (max-width: 900px) {
  body.use-new-ui.route-inventory .inv-mo-stock-toolbar--compact .inv-mo-stock-search-wrap,
  body.use-new-ui.route-inventory .inv-prod-mo-toolbar--compact .inv-prod-mo-search-wrap {
    grid-column: 1 / -1;
    width: 100%;
  }

  body.use-new-ui.route-inventory .inv-prod-mo-toolbar--compact .inv-prod-mo-search-wrap .inv-prod-mo-search {
    min-height: 40px !important;
    font-size: 15px !important;
  }
}

/* —— Overview: Quay nhanh metric —— */
@media (min-width: 769px) {
  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item--fast-turn {
    flex: 1 1 148px;
    min-width: 128px;
    max-width: 220px;
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item--fast-turn .inventory-metric-v {
    font-size: clamp(16px, 1vw, 20px);
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item--fast-turn .inventory-metric-sub {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-strip-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item {
    flex: 1 1 0;
    min-width: 96px;
    max-width: none;
  }

  /* Desktop: tighter gap under topbar */
  body.use-new-ui.route-inventory .app-content-shell {
    padding-top: 8px;
    padding-bottom: 24px;
  }

  body.use-new-ui.route-inventory .inventory-module--kho-sync > .inventory-tabs {
    margin-top: 0;
    margin-bottom: 6px !important;
  }

  body.use-new-ui.route-inventory .inventory-page .inventory-tabs {
    margin-bottom: 6px !important;
  }

  /* Sản phẩm tab — compact stack under route tabs */
  body.use-new-ui.route-inventory .inventory-page .inv-prod-segments-wrap {
    margin-bottom: 6px;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar {
    margin-top: 0;
    margin-bottom: 8px;
    gap: 8px;
  }

  body.use-new-ui.route-inventory .inventory-page .product-center-table--inv-intel {
    margin-top: 0;
  }
}

@media (min-width: 769px) and (max-width: 1320px) {
  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-k {
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-v {
    font-size: clamp(15px, 1.05vw, 18px);
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item {
    padding: 7px 10px;
    min-width: 88px;
  }

  body.use-new-ui.route-inventory .inv-overview-desk .inventory-metric-item--fast-turn {
    min-width: 112px;
    max-width: 200px;
  }
}

/* —— Sidebar command card: prevent foot clock clip —— */
body.use-new-ui .sidebar .sidebar-command-card {
  overflow: visible;
}

body.use-new-ui .sidebar .sidebar-command-foot {
  min-width: 0;
  overflow: visible;
}

body.use-new-ui .sidebar .sidebar-command-foot-time,
body.use-new-ui .sidebar #sidebarClockTokyo {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
