/* Inventory category labels and counts stay grouped across screen sizes. */
@media screen {
  body.app-shell[data-nav="inventory"] .inv-bar > .seg {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 4px;
    box-sizing: border-box;
  }

  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a {
    display: grid;
    grid-template-columns: minmax(0, auto) auto;
    grid-template-rows: auto;
    grid-column: auto;
    align-content: center;
    align-items: center;
    justify-content: center;
    justify-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 7px 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a > :is(.seg-short, .seg-full) {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    max-width: 100%;
  }

  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a > .seg-n {
    grid-column: 2;
    grid-row: 1;
    display: block;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--surface-2, #f0ece5);
    color: var(--ink-2, #455761);
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }

  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a:is(.active, [aria-selected="true"]) > .seg-n {
    background: #ffffff26;
    color: #fff;
  }

  /* Existing responsive short and full labels keep their original visibility. */
  body.app-shell[data-nav="inventory"] #inv-chips.chips.tabs,
  body.app-shell[data-nav="inventory"] .fx-group {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
  }

  body.app-shell[data-nav="inventory"] #inv-chips.chips.tabs {
    margin: 10px 0;
    padding: 0;
  }

  body.app-shell[data-nav="inventory"] :is(#inv-chips, .fx-group) > .chip {
    flex: 0 1 auto;
    align-items: center;
    gap: 6px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    height: auto;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  body.app-shell[data-nav="inventory"] :is(#inv-chips, .fx-group) > .chip .n {
    flex: 0 0 auto;
    margin: 0;
    font-size: .92em;
    font-weight: 650;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
  }

  /* Table structure, numeric alignment and mobile visibility remain native. */
  body.app-shell .main .tbl :is(th, td) {
    font-size: 14px;
    line-height: 1.5;
    border-color: var(--line, #ddd6cc);
  }

  body.app-shell .main .tbl th {
    background: var(--surface-2, #f0ece5);
    color: var(--ink-2, #455761);
    font-weight: 650;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    vertical-align: bottom;
  }

  body.app-shell .main .tbl td { font-weight: 500; }
  body.app-shell .cust-table-wrap .tbl th { padding-inline: 10px; }
}

@media screen and (max-width: 600px) {
  body.app-shell[data-nav="inventory"] .inv-bar > .seg { gap: 2px; }
  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 3px;
    min-height: 56px;
    padding: 6px 2px;
    font-size: 13px;
    letter-spacing: -.015em;
  }
  body.app-shell[data-nav="inventory"] .inv-bar > .seg > a > .seg-n {
    grid-column: 1;
    grid-row: 2;
  }
}

@media screen and (max-width: 840px), screen and (pointer: coarse) {
  body.app-shell[data-nav="inventory"] :is(#inv-chips, .fx-group) > .chip { min-height: 44px; }
}

@media screen and (max-width: 840px) {
  /* Full customer names and contact context remain available in card rows. */
  body.app-shell .cust-cards .crow { align-items: flex-start; }
  body.app-shell .cust-cards .crow-main { min-width: 0; gap: 4px; }
  body.app-shell .cust-cards :is(.crow-name, .crow-sub) {
    max-width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }
  body.app-shell .cust-cards .crow-name { font-size: 15px; }
  body.app-shell .cust-cards .crow-sub { font-size: 13.5px; }
  body.app-shell .cust-cards .crow-right {
    align-self: flex-start;
    gap: 6px;
    max-width: 40%;
  }
  body.app-shell .cust-cards :is(.crow-right, .crow-pills) .pill {
    max-width: 100%;
    min-height: 22px;
    height: auto;
    padding-block: 3px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.app-shell .cust-head { flex-wrap: wrap; }
  body.app-shell .cust-head h1 {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }
}
