* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Type scale */
  --text-xs: 0.72rem;
  --text-sm: 0.8rem;
  --text-md: 0.9rem;
  --text-lg: 1rem;
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  /* Shared control sizes */
  --control-height: 2.35rem;
  --control-height-sm: 1.7rem;
  --chip-height: 1.7rem;
  --chip-pad-y: 0.22rem;
  --chip-pad-x: 0.55rem;
  --chip-font: var(--text-xs);
  --thumb-size: 3rem;
  --thumb-size-sm: 2.25rem;
  /* Layers */
  --z-sticky: 40;
  --z-dropdown: 200;
  --z-drawer: 1200;
  --z-toast: 1300;
  --z-lightbox: 1400;
  --z-chat: 2400;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /*
   * Locked by JS while the keyboard is closed. iOS sets env(safe-area-inset-bottom)
   * to 0px when the keyboard is open — without a stable value, bottom padding flickers.
   * Fallback to live --safe-bottom before the first measurement.
   */
  --safe-bottom-stable: var(--safe-bottom);
  /* Always-visible bottom insets (min pad + stable home-indicator). */
  --pad-bottom-min: 1rem;
  --pad-bottom-sheet: calc(var(--pad-bottom-min) + var(--safe-bottom-stable));
  --pad-bottom-footer: calc(0.75rem + var(--safe-bottom-stable));
  --pad-bottom-list: calc(1.5rem + var(--safe-bottom-stable));
  --pad-bottom-compact: calc(0.5rem + var(--safe-bottom-stable));
  --mode-bar-height: 3.1rem;
  --mode-bar-sticky-offset: calc(var(--safe-top) + var(--mode-bar-height));
}

html {
  overflow-x: clip;
  /* No font inflation on rotate; no double-tap zoom (pinch-zoom still works). */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

/*
 * iOS Safari zooms the page when focusing a field with font-size < 16px and
 * doesn't zoom back out. Keep editable fields at 16px on touch devices.
 */
@media (hover: none) and (pointer: coarse) {
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='button']):not([type='submit']):not([type='reset']):not([type='file']):not([type='color']),
  select,
  textarea,
  [contenteditable='true'] {
    font-size: 16px !important;
  }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Slim top header: company name only. Mode nav lives in the left sidebar. */
.topbar {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1.25rem;
  min-height: var(--mode-bar-height);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex-shrink: 0;
}

.header-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-logo {
  flex-shrink: 0;
  width: 2.05rem;
  height: 2.05rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.28);
}

.topbar h1 {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  isolation: isolate;
}

/* Kept for stickyModeBar.js; background already covers the notch via padding-top. */
.mode-bar-wrap.is-stuck {
  background: #ffffff;
}

.mode-bar-wrap.is-stuck::before {
  display: none;
}

/* App shell: sidebar (mode nav) + main content. */
.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.app-sidebar {
  flex-shrink: 0;
  width: 205px;
  position: sticky;
  top: var(--mode-bar-sticky-offset);
  padding: 1.1rem 0 1.1rem 1.25rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}

.mode-bar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.mode-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  align-items: center;
  text-align: left;
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mode-tab-icon {
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  opacity: 0.75;
}

.mode-tab-icon svg {
  width: 100%;
  height: 100%;
}

.mode-tab.active .mode-tab-icon {
  opacity: 1;
  color: var(--primary);
}

.mode-tab:hover {
  background: #eef2f8;
  color: var(--text);
}

.mode-tab.active {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}

.mode-tab:active {
  transform: scale(0.98);
}

.mode-tab-label {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-tab-desc {
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  min-width: 0;
}

.mode-panel.hidden {
  display: none;
}

main {
  flex: 1;
  width: 100%;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  overflow-x: clip;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  width: 100%;
  min-width: 0;
}

.form-grid > label,
.lookup-form-grid > label {
  min-width: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: white;
}

input:focus, select:focus {
  outline: 2px solid rgba(26, 86, 219, 0.25);
  border-color: var(--primary);
}

.combo-dropdown-label {
  position: relative;
  overflow: visible;
}

.combo-dropdown {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.combo-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text);
  background: white;
  cursor: pointer;
  text-align: left;
  font-weight: 400;
}

.combo-trigger:hover,
.combo-trigger:focus,
.combo-dropdown.open .combo-trigger {
  outline: 2px solid rgba(26, 86, 219, 0.25);
  border-color: var(--primary);
}

.combo-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-trigger-text.placeholder {
  color: var(--muted);
}

.combo-chevron {
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.combo-dropdown.open .combo-chevron {
  transform: rotate(180deg);
}

.combo-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.combo-search-wrap {
  padding: 0.28rem 0.35rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.combo-panel-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.combo-panel-footer {
  padding: 0.28rem 0.35rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

button.small {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.combo-options-multi li.combo-option-check {
  padding: 0;
}

.combo-option-check label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.combo-option-check label:hover {
  background: #e8f0fe;
}

.combo-option-check input[type="checkbox"] {
  width: 1.05rem !important;
  height: 1.05rem !important;
  min-width: 1.05rem !important;
  max-width: 1.05rem !important;
  min-height: 1.05rem !important;
  margin: 0 0.45rem 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.combo-option-check .option-text {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

tr.group-header td {
  position: sticky;
  top: 2.35rem;
  z-index: 2;
  background: linear-gradient(90deg, #dbeafe, #e8f0fe);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.82rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #bfdbfe;
  box-shadow: 0 1px 0 rgba(26, 86, 219, 0.08);
}

tr.no-match-row td {
  color: var(--muted);
  font-style: italic;
  background: #f8fafc;
  padding: 0.85rem;
}

tr.alternative-header td {
  position: sticky;
  top: 2.35rem;
  z-index: 2;
  background: linear-gradient(90deg, #ffedd5, #fff7ed);
  font-weight: 700;
  color: #c2410c;
  font-size: 0.82rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #fed7aa;
}

tr.alternative-row td {
  background: #fffaf5;
}

tr.alternative-row:hover td {
  background: #fff3e8 !important;
}

.alt-cell {
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 240px;
  color: #334155;
}

.alt-reason {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.cell-muted {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  max-width: 280px;
}

.price-tag {
  display: none;
}

.responsive-table td.mobile-only {
  display: none;
}

@media (min-width: 769px) {
  #llmTable {
    min-width: 1040px;
  }

  #resultsTable {
    min-width: 1080px;
  }

  .data-table td:nth-child(3),
  .data-table td:nth-child(5) {
    min-width: 120px;
  }
}

.combo-search {
  width: 100%;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  min-height: 1.85rem;
}

.combo-options {
  max-height: 240px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.08rem 0;
}

.combo-options li {
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.combo-options li .item-category {
  display: block;
  font-size: 0.64rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0;
}

.combo-options li:hover,
.combo-options li.active {
  background: #e8f0fe;
}

.combo-options li.no-results {
  color: var(--muted);
  cursor: default;
  font-style: italic;
}

.combo-options li.no-results:hover {
  background: transparent;
}

.combo-options .list-group-label {
  padding: 0.22rem 0.5rem 0.1rem;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: default;
  background: #f8fafc;
  position: sticky;
  top: 0;
}

.combo-options .list-group-label:hover {
  background: #f8fafc;
}

.search-card,
.lookup-card,
.form-grid,
.brands-picker,
#searchForm,
.lookup-form {
  max-width: 100%;
  min-width: 0;
}

.search-card-header {
  margin-bottom: 0;
}

.search-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.search-collapse-toggle {
  display: none;
}

.search-card-body-inner {
  overflow: visible;
}

.search-card-body-inner > form {
  margin-top: 1rem;
}

/* Vehicle search + Online — shared compact card padding (incl. iPhone safe layout) */
#searchCard.card,
#onlineCard.card {
  padding: 0.65rem 0.8rem;
}

#searchCard .search-card-body-inner > form,
#onlineCard .search-card-body-inner > form {
  margin-top: 0.25rem;
}

.vehicle-search-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.search-flow {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-flow-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
}

.search-flow-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.search-flow-tab:hover {
  color: var(--text);
}

.search-flow-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.search-flow-tabs--triple .search-flow-tab {
  font-size: 0.72rem;
  padding: 0.42rem 0.55rem;
  min-width: 0;
}

.online-motrparts-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0.75rem;
  align-items: start;
  min-width: 0;
}

.online-motrparts-fields .online-motrparts-vehicle,
.online-motrparts-fields .online-reg-products {
  min-width: 0;
}

.online-motrparts-fields .online-reg-products .combo-field-label {
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .online-motrparts-fields {
    grid-template-columns: 1fr;
  }
}

.online-motrparts-vehicle {
  min-width: 0;
}

.online-motrparts-vehicle .combo-dropdown-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

@media (max-width: 520px) {
  .search-flow-tabs--triple .search-flow-tab {
    font-size: 0.66rem;
    padding: 0.38rem 0.35rem;
  }
}

.search-flow-panel {
  min-width: 0;
}

.recent-searches {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    padding 0.28s ease,
    gap 0.28s ease,
    box-shadow 0.28s ease;
}

.recent-searches[hidden] {
  display: none !important;
}

.recent-searches.is-panel-visible {
  opacity: 1;
  transform: translateY(0);
}

.recent-searches.no-anim,
.recent-searches.no-anim * {
  transition: none !important;
}

.recent-searches-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.1rem;
  cursor: pointer;
  min-width: 0;
  text-align: left;
  transition: color 0.2s ease;
}

.recent-searches-toggle:hover {
  color: var(--primary);
}

.recent-searches-toggle-text {
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 0.2s ease, font-size 0.2s ease;
}

.recent-searches-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 1;
  transform: scale(1);
  max-width: 3rem;
  overflow: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    max-width 0.22s ease,
    margin 0.22s ease,
    padding 0.22s ease;
}

.recent-searches-count.is-hidden {
  opacity: 0;
  transform: scale(0.7);
  max-width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  pointer-events: none;
}

.recent-searches-chevron {
  color: var(--muted);
  font-size: 0.7rem;
  margin-left: auto;
  display: inline-block;
  transition: transform 0.28s ease, color 0.2s ease;
}

.recent-searches.is-collapsed .recent-searches-chevron {
  transform: rotate(-90deg);
}

.recent-searches.is-collapsed {
  padding: 0.35rem 0.5rem;
  gap: 0;
}

.recent-searches.is-collapsed .recent-searches-toggle {
  padding: 0.05rem 0;
}

.recent-searches.is-collapsed .recent-searches-toggle-text {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
}

.recent-searches-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.25rem;
}

.recent-searches-clear {
  font-size: 0.7rem;
  padding: 0.1rem 0;
}

.recent-searches-body {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease;
  min-height: 0;
}

.recent-searches.is-collapsed .recent-searches-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.recent-searches-body-inner {
  overflow: hidden;
  min-height: 0;
}

.recent-searches-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .recent-searches,
  .recent-searches-toggle,
  .recent-searches-toggle-text,
  .recent-searches-count,
  .recent-searches-chevron,
  .recent-searches-body {
    transition: none !important;
    animation: none !important;
  }
}

@keyframes recent-dock-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recent-searches-chip {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  position: relative;
}

.recent-searches-chip--plate {
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #f8faff 0%, #fff 100%);
}

.recent-searches-chip--vehicle {
  border-color: #d1fae5;
  background: linear-gradient(180deg, #f6fffb 0%, #fff 100%);
}

.recent-searches-chip--maruti {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f5f9ff 0%, #fff 100%);
}

.recent-searches-chip-main {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.42rem 0.3rem 0.42rem 0.55rem;
  cursor: pointer;
  min-width: 0;
  text-align: left;
  flex: 1 1 auto;
}

.recent-searches-chip-main:hover {
  background: rgba(15, 23, 42, 0.03);
}

.recent-searches-chip-label {
  font-size: 0.74rem;
  font-weight: 650;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.recent-searches-chip-sub {
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.recent-searches-chip-remove {
  appearance: none;
  border: none;
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.42rem;
  cursor: pointer;
  flex-shrink: 0;
}

.recent-searches-chip-remove:hover {
  color: #b91c1c;
  background: #fef2f2;
}

.chassis-input-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.chassis-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chassis-status {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
}

.chassis-status.is-muted {
  color: var(--muted);
}

.chassis-status.is-loading {
  color: var(--primary);
}

.chassis-status.is-success {
  color: var(--success, #15803d);
  font-weight: 600;
}

.chassis-status.is-error {
  color: var(--danger, #b91c1c);
}

.vehicle-details-card {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 4%, #fff), #fff);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.vehicle-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.vehicle-details-head h3,
.vehicle-details-head h4 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.vehicle-details-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, #fff);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.vehicle-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.85rem;
}

.vehicle-details-item {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.vehicle-details-label {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vehicle-details-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.vehicle-search-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: end;
  padding-top: 0.1rem;
  border-top: none;
}

.vehicle-search-col6 {
  min-width: 0;
}

.vehicle-search-col12 {
  min-width: 0;
  grid-column: 1 / -1;
}

.online-reg-vehicle {
  margin-top: 0.15rem;
  margin-bottom: 0;
}

.online-reg-vehicle[hidden] {
  display: none !important;
}

.online-reg-vehicle-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.online-reg-vehicle-name {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.online-reg-vehicle-name:hover .online-reg-vehicle-summary,
.online-reg-vehicle-name:focus-visible .online-reg-vehicle-summary {
  text-decoration: underline;
}

.online-reg-vehicle-name:focus-visible {
  outline: none;
}

.online-reg-vehicle-summary {
  display: block;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.25;
  color: #15803d;
  word-break: break-word;
}

.online-reg-vehicle-summary.is-placeholder {
  color: #15803d;
  font-weight: 650;
}

.online-reg-vehicle-summary.is-loading {
  color: var(--primary);
}

.online-reg-vehicle.is-confirmed .online-reg-vehicle-summary {
  color: #166534;
}

.online-reg-vehicle.has-variant-fallback.is-confirmed .online-reg-vehicle-summary {
  color: #92400e;
}

.online-reg-vehicle-summary .online-reg-nearest-part {
  color: #b45309;
  font-weight: 600;
}

.online-reg-vehicle.has-variant-fallback.is-confirmed {
  border-left: 3px solid var(--warning);
  padding-left: 0.55rem;
}

.online-reg-change-btn {
  appearance: none;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.online-reg-change-btn:hover {
  color: #0f172a;
}

.online-reg-change-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}

.online-reg-catalog {
  margin-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.online-reg-catalog[hidden] {
  display: none !important;
}

.online-reg-products {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.online-reg-products .combo-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}

.online-reg-products .combo-field-label .req {
  color: #c2410c;
  margin-left: 0.15rem;
}

.online-reg-field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.online-reg-field-label .req {
  color: #c2410c;
}

.online-reg-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.online-vehicle-drawer-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.online-vehicle-drawer-media {
  width: 88px;
  height: 66px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
}

.online-vehicle-drawer-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-vehicle-drawer-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.online-vehicle-drawer-copy strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.online-vehicle-drawer-copy span {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.online-vehicle-ac-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.online-vehicle-ac-stack .manual-map-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.online-vehicle-ac-stack .manual-map-input,
.online-vehicle-ac-stack .chassis-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  /* Explicit size — do not inherit label’s ~0.76rem (iOS zooms inputs < 16px). */
  font-size: 16px;
  line-height: 1.35;
  background: #fff;
}

.online-vehicle-boodmo-block {
  margin: 0;
}

.online-vehicle-drawer-note {
  margin: 0;
  font-size: 0.82rem;
}

.online-vehicle-drawer-note.is-muted {
  color: var(--muted);
}

.online-parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  margin: 0.35rem 0 0.75rem;
}

/* Single lookup result: give the card (and its image) more room. */
.online-parts-grid:has(> .online-part-card:only-child) {
  grid-template-columns: minmax(0, 460px);
}

.online-parts-empty {
  grid-column: 1 / -1;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.online-part-card {
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 14px;
  background: var(--surface, #fff);
  overflow: hidden;
  min-width: 0;
}

.online-part-card-media {
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--bg) 75%, var(--border));
}

.online-part-card-image-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.online-part-card-image-btn img,
.online-part-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.online-part-card-image-btn {
  background: #fff;
}

.online-part-card-image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Main image + side thumbnail strip (hover a thumb to preview it). */
.online-part-card.has-gallery .online-part-card-media {
  position: relative;
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem;
  overflow: hidden;
  box-sizing: border-box;
}

.online-part-card.has-gallery .online-part-card-image-btn {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.online-part-card.has-gallery .online-part-card-image-btn img {
  object-fit: contain;
}

.online-part-card-thumbs {
  flex: 0 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.part-gallery-thumb {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.72;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.part-gallery-thumb img,
.online-part-card-media .part-gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.part-gallery-thumb:hover,
.part-gallery-thumb.is-active {
  opacity: 1;
  border-color: var(--accent);
}

.part-gallery-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.online-part-card-gallery-count {
  display: none;
}

.online-part-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.8rem 0.9rem;
}

.online-part-card-title {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.25;
}

.online-part-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.online-part-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text);
}

.online-part-pill-resolved {
  background: color-mix(in srgb, #15803d 18%, transparent);
  color: #166534;
}

.online-part-card-masked {
  font-size: 0.72rem;
  color: var(--muted);
}

.online-part-card-pn {
  font-size: 0.86rem;
}

.online-part-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.online-part-stock {
  color: #15803d;
  font-weight: 600;
}

@media (max-width: 720px) {
  .online-parts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .online-parts-grid {
    grid-template-columns: 1fr;
  }

  /* Compact horizontal part card — keep square thumb, don't stretch/crop. */
  #onlineResultsSection .online-part-card {
    flex-direction: row;
    align-items: center;
    gap: 0;
    overflow: hidden;
  }

  #onlineResultsSection .online-part-card-media {
    flex: 0 0 6.5rem;
    width: 6.5rem;
    height: 6.5rem;
    aspect-ratio: 1 / 1;
    align-self: center;
    overflow: hidden;
    flex-shrink: 0;
    margin: 0.45rem 0 0.45rem 0.45rem;
    border-radius: 8px;
    background: #f1f5f9;
  }

  #onlineResultsSection .online-part-card-image-btn,
  #onlineResultsSection .online-part-card-image-placeholder {
    width: 100%;
    height: 100%;
  }

  #onlineResultsSection .online-part-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    padding: 0.2rem;
    box-sizing: border-box;
  }

  /* Too narrow for a side strip — show a count; the lightbox has all thumbnails. */
  #onlineResultsSection .online-part-card.has-gallery .online-part-card-media {
    padding: 0;
    gap: 0;
  }

  #onlineResultsSection .online-part-card-thumbs {
    display: none;
  }

  #onlineResultsSection .online-part-card-gallery-count {
    position: absolute;
    right: 0.2rem;
    bottom: 0.2rem;
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    pointer-events: none;
  }

  #onlineResultsSection .online-part-card-body {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.65rem 0.55rem 0.5rem;
    gap: 0.25rem;
  }

  #onlineResultsSection .online-part-card-title {
    font-size: 0.8rem;
  }
}

.vehicle-search-col6 .brands-picker-compact {
  width: 100%;
}

.vehicle-search-actions-row {
  display: flex;
  justify-content: flex-end;
}

.vehicle-search-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr) minmax(0, 0.75fr);
  gap: 0.3rem;
  margin-bottom: 0;
}

.brands-picker-compact .brands-picker-label {
  margin-bottom: 0;
  gap: 0.1rem;
}

.vehicle-search-form label {
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.vehicle-search-form input:not(.combo-search),
.vehicle-search-form select,
.vehicle-search-form .combo-trigger,
.chassis-input {
  padding: 0.42rem 0.55rem;
  font-size: 0.9rem;
  min-height: 2.25rem;
  border-radius: 8px;
}

.vehicle-search-actions {
  margin: 0;
  padding: 0;
  position: static;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.vehicle-search-actions button,
#searchCard .online-form-actions .primary-btn,
#searchCard #onlinePartsSearchBtn {
  min-height: 2.25rem;
  padding: 0.42rem 1.1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.vehicle-search-form .selected-chips {
  margin-top: 0.25rem;
}

.variant-field {
  grid-column: span 1;
}

.variant-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2.25rem;
  align-items: center;
}

.variant-pill {
  appearance: none;
  border: 1px solid var(--border, #d1d5db);
  background: var(--surface, #fff);
  color: var(--text-muted, #4b5563);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.variant-pill:hover {
  border-color: var(--accent, #2563eb);
  color: var(--text, #111827);
}

.variant-pill.active {
  background: var(--accent-soft, #dbeafe);
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

@media (max-width: 900px) {
  .vehicle-details-grid {
    grid-template-columns: 1fr;
  }

  .search-flow-tabs {
    width: 100%;
    align-self: stretch;
  }

  .search-flow-tab {
    flex: 1;
    text-align: center;
  }

  .vehicle-search-grid {
    grid-template-columns: 1fr 1fr;
  }

  .vehicle-search-grid > label:first-child {
    grid-column: 1 / -1;
  }

  .vehicle-search-filters {
    grid-template-columns: 1fr;
  }

  .vehicle-search-actions-row {
    justify-content: stretch;
  }

  .vehicle-search-actions button {
    width: 100%;
    min-height: 2.35rem;
  }

  #searchCard .online-form-actions {
    position: static;
    margin: 0.15rem 0 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  #searchCard .online-form-actions button,
  #searchCard #onlinePartsSearchBtn {
    width: 100%;
    min-height: 2.35rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 520px) {
  .vehicle-search-grid {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }
}

.results-card.results-enter {
  animation: results-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.results-card.results-enter:nth-of-type(2) {
  animation-delay: 0.08s;
}

@keyframes results-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes search-summary-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-card,
  .collapsible-card .search-card-body,
  .search-card-body,
  .search-collapse-chevron,
  .search-card-title,
  .search-collapse-summary,
  .results-card.results-enter,
  #llmTable tr.llm-result-row,
  .vehicle-fitment-details .vehicle-fitment-list,
  .status.status-enter {
    transition: none !important;
    animation: none !important;
  }
}

.brands-picker {
  margin-bottom: 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.vehicle-search-form .brands-picker.brands-picker-compact {
  margin-bottom: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.brands-picker-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.field-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: #8a97a8;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.field-optional-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.selection-badge {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  min-width: 1.5rem;
  text-align: center;
}

.selection-badge.hidden {
  display: none;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.filter-pill {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

button.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
}

button.primary-btn:hover {
  background: var(--primary-hover);
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  min-height: 0;
}

.selected-chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem 0.3rem 0.7rem;
  background: #e8f0fe;
  border: 1px solid #b6ccf5;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #1e429f;
  font-weight: 500;
}

.chip-remove {
  background: none;
  border: none;
  color: #1e429f;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  opacity: 0.7;
}

.chip-remove:hover {
  opacity: 1;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.link-btn:hover {
  text-decoration: underline;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-footer {
  margin-top: 0.25rem;
}

.cache-toolbar-wrap {
  margin-bottom: 0.65rem;
}

.cache-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.cache-toolbar-intro {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-left: 0.35rem;
}

.cache-toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  white-space: nowrap;
}

.cache-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.cache-help-btn:hover,
.cache-help-btn.is-tip-open,
.cache-help-btn[aria-expanded="true"] {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--primary);
}

.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(240px, 72vw);
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 60;
}

.has-tooltip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 60;
}

@media (hover: hover) and (pointer: fine) {
  .has-tooltip:hover::after,
  .has-tooltip:hover::before,
  .has-tooltip:focus-visible::after,
  .has-tooltip:focus-visible::before {
    opacity: 1;
    visibility: visible;
  }
}

.has-tooltip.is-tip-open::after,
.has-tooltip.is-tip-open::before {
  opacity: 1;
  visibility: visible;
}

.cache-chip.has-tooltip::after {
  bottom: calc(100% + 6px);
  max-width: min(200px, 65vw);
}

.cache-clear-btn.has-tooltip::after {
  bottom: calc(100% + 6px);
}

.submodel-more-count.has-tooltip {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

/* CSS ::after tip kept as fallback; body flyout is used so table overflow cannot clip it. */
.submodel-more-count.has-tooltip::after,
.submodel-more-count.has-tooltip::before {
  display: none !important;
}

.submodel-hover-flyout {
  position: fixed;
  z-index: 4700;
  max-width: min(320px, 86vw);
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #1e293b;
  color: #f8fafc;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s ease;
}

.submodel-hover-flyout.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.submodel-hover-flyout-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.submodel-hover-flyout-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.22rem;
}

.submodel-hover-flyout-list li {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.cache-toolbar-hint {
  margin: 0.45rem 0.25rem 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #dbeafe;
  background: #f0f9ff;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #334155;
}

.cache-toolbar-hint strong {
  color: #1e40af;
  font-weight: 700;
}

.cache-toolbar-hint.is-highlight {
  animation: cache-hint-pulse 1.2s ease;
}

@keyframes cache-hint-pulse {
  0%, 100% {
    background: #f0f9ff;
    border-color: #dbeafe;
  }
  40% {
    background: #dbeafe;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  }
}

@media (min-width: 769px) {
  .cache-toolbar-hint {
    display: none;
  }

  .cache-toolbar-hint.is-expanded {
    display: block;
  }
}

.cache-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1 1 auto;
}

.cache-chip {
  cursor: pointer;
  user-select: none;
}

.cache-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cache-chip-face {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cache-chip:hover .cache-chip-face {
  border-color: #93c5fd;
  color: var(--primary);
}

.cache-chip input:focus-visible + .cache-chip-face {
  outline: 2px solid rgba(26, 86, 219, 0.35);
  outline-offset: 1px;
}

.cache-chip input:checked + .cache-chip-face {
  background: linear-gradient(180deg, #dbeafe, #bfdbfe);
  border-color: #60a5fa;
  color: #1e40af;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

.cache-chip-name {
  line-height: 1;
}

.cache-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 0.68rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1.2;
}

.cache-chip input:checked + .cache-chip-face .cache-chip-count {
  background: rgba(30, 64, 175, 0.15);
  color: #1e3a8a;
}

.cache-clear-btn {
  flex-shrink: 0;
  padding: 0.32rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cache-clear-btn:hover:not(:disabled) {
  border-color: #f87171;
  background: #fef2f2;
  color: #b91c1c;
}

.cache-clear-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lookup-card-header {
  margin-bottom: 0;
}

.lookup-results-header h2 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.lookup-hint {
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.lookup-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lookup-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.lookup-form-grid > label {
  min-width: 0;
}

.lookup-brand-field.lookup-brand-required .combo-trigger {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.lookup-brand-field.lookup-brand-required .field-hint {
  color: #b45309;
  font-weight: 600;
}

.lookup-form-actions {
  display: flex;
  align-items: center;
}

.lookup-form button[type="submit"] {
  background: var(--primary);
  color: white;
  min-height: 42px;
}

.lookup-results {
  margin-top: 0.65rem;
}

.results-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.results-card-header h2 {
  margin: 0;
}

.price-cell,
.cell-llm-mrp,
.cell-llm-sales,
.cell-llm-purchase,
.inventory-mrp-cell,
.inventory-sales-cell,
.inventory-purchase-cell {
  font-variant-numeric: tabular-nums;
}

.cell-llm-sales,
.inventory-sales-cell {
  font-weight: 700;
  color: var(--success);
}

.inventory-purchase-cell,
.cell-llm-purchase {
  color: var(--muted);
  font-size: 0.9em;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  margin-left: 0.35rem;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #fff;
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  background: #eef2ff;
  border-color: #818cf8;
}

.copy-btn.is-copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.part-number-with-copy,
.copyable-with-copy {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.2rem;
  max-width: 100%;
}

.part-number-with-copy .part-number,
.part-number-with-copy .catalogue-card-pn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-number-with-copy .copy-btn,
.copyable-with-copy .copy-btn {
  flex-shrink: 0;
}

#llmTable .catalogue-card-pn-wrap {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}

#llmTable .catalogue-card-pn-wrap .catalogue-card-pn {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#llmTable .catalogue-card-pn-wrap .copy-btn {
  flex-shrink: 0;
}

.copyable-with-copy .warehouse-item-name {
  display: inline;
  min-width: 0;
}

.lookup-warehouse-pricing {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.lookup-warehouse-pricing strong {
  color: var(--success);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button[type="submit"], #searchBtn {
  background: var(--primary);
  color: white;
}

button[type="submit"]:hover, #searchBtn:hover {
  background: var(--primary-hover);
}

button.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: wait;
}

button.is-loading:disabled {
  opacity: 1;
}

.btn-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  flex-shrink: 0;
  opacity: 0.85;
}

.cache-entry-remove-btn.is-loading .btn-spinner {
  width: 0.7rem;
  height: 0.7rem;
  border-width: 1.5px;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.disclaimer {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--warning);
}

.status {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.status-message {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.status-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: -0.15rem -0.1rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: 0.72;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.status-close:hover,
.status-close:focus-visible {
  opacity: 1;
  background: rgba(15, 23, 42, 0.08);
}

.status-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.status-close-icon {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
}

.status.status-enter {
  animation: status-enter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes status-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status.info {
  background: #e8f0fe;
  color: #1a56db;
  border: 1px solid #b6ccf5;
}

.status.loading {
  background: #e8f0fe;
  color: #1a56db;
  border: 1px solid #b6ccf5;
}

.status-message .status-spinner,
.status-message .btn-spinner {
  margin-top: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-width: 1.75px;
  flex-shrink: 0;
}

.service-loading-meta,
.service-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--primary);
  font-weight: 600;
}

.service-loading-meta .btn-spinner,
.service-loading-inline .btn-spinner {
  width: 0.78rem;
  height: 0.78rem;
  border-width: 1.75px;
}

.service-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.service-loading .btn-spinner {
  width: 1.05rem;
  height: 1.05rem;
}

.service-loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 6.5rem;
  padding: 1.25rem 1rem;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, #e2e8f0);
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 5%, #fff),
    #fff
  );
}

.results-table-panel.is-loading .results-table-scroll,
#onlineVehiclesTablePanel.is-loading .results-table-scroll,
#onlineVehiclesTablePanel.is-fitments-loading .results-table-scroll {
  min-height: 7.5rem;
}

tr.service-loading-row td,
tr.fitments-loading-row td {
  padding: 1.35rem 1rem;
  text-align: center;
  border-bottom: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 5%, #fff),
    #fff
  );
}

.fitments-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.fitments-loading .btn-spinner {
  width: 1.05rem;
  height: 1.05rem;
}

.fitments-loading-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--primary);
  font-weight: 600;
}

.fitments-loading-meta .btn-spinner {
  width: 0.78rem;
  height: 0.78rem;
  border-width: 1.75px;
}

.status.error {
  background: #fde8e8;
  color: var(--danger);
  border: 1px solid #f8b4b4;
}

.status.success {
  background: #def7ec;
  color: var(--success);
  border: 1px solid #84e1bc;
}

.hidden {
  display: none !important;
}

.meta {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.llm-source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.01em;
}

.llm-source-cached {
  background: #e8f0fe;
  color: #1a56db;
}

.llm-source-live {
  background: #ecfdf5;
  color: #047857;
}

.llm-source-catalogue {
  background: #fef3c7;
  color: #92400e;
}

.llm-source-boodmo {
  background: #ede9fe;
  color: #5b21b6;
}

.llm-source-motrparts {
  background: #dbeafe;
  color: #1e40af;
}

.llm-source-maruti {
  background: #e0f2fe;
  color: #0c4a6e;
}

.online-catalogue-card {
  border-color: var(--border);
  background: var(--card, #fff);
}

.online-hint {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.online-search-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lookup-source-fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.lookup-source-legend {
  padding: 0;
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #4b5563);
}

.lookup-source-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
}

.lookup-source-option {
  position: relative;
  margin: 0;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}

.lookup-source-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  appearance: none;
  pointer-events: none;
}

.lookup-source-card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.lookup-source-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text, #111827);
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lookup-source-desc {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted, #6b7280);
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lookup-source-option:hover .lookup-source-card {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.lookup-source-option input:focus-visible + .lookup-source-card {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.lookup-source-option input:checked + .lookup-source-card {
  border-color: #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.22), 0 4px 12px rgba(37, 99, 235, 0.12);
}

.lookup-source-option input:checked + .lookup-source-card .lookup-source-name {
  color: #1d4ed8;
}

.lookup-source-option input:checked + .lookup-source-card .lookup-source-desc {
  color: #1e40af;
}

@media (max-width: 520px) {
  .lookup-source-group {
    gap: 0.3rem;
  }

  .lookup-source-card {
    min-height: 2.55rem;
    padding: 0.4rem 0.35rem;
    border-radius: 0.65rem;
    align-items: center;
    text-align: center;
  }

  .lookup-source-name {
    font-size: 0.72rem;
  }

  .lookup-source-desc {
    display: none;
  }
}

.online-ac-wrap {
  position: relative;
}

.online-ac-wrap input {
  width: 100%;
}

.online-ac-results {
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  overflow: auto;
  max-height: 400px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.online-ac-results.field-ac-results-portal {
  margin: 0;
}

.online-ac-item.field-ac-item {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.online-ac-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}

.online-ac-item:hover,
.online-ac-item:focus {
  background: #f8fafc;
}

.online-img-preview-wrap {
  position: relative;
  flex-shrink: 0;
}

.online-img-preview-wrap-suggest {
  align-self: flex-start;
}

.online-img-preview-wrap .online-img-preview-btn {
  position: relative;
}

.part-image-count {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 0.05rem 0.28rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.3;
  pointer-events: none;
}

.online-img-preview-btn {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 10px;
  line-height: 0;
  touch-action: manipulation;
}

.online-img-preview-btn .online-part-image,
.online-img-preview-btn .online-ac-thumb {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.online-img-preview-btn:hover .online-part-image,
.online-img-preview-btn:hover .online-ac-thumb,
.online-img-preview-btn:focus-visible .online-part-image,
.online-img-preview-btn:focus-visible .online-ac-thumb {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  border-color: #cbd5e1;
}

.online-img-preview-btn:focus-visible {
  outline: 2px solid rgba(26, 86, 219, 0.45);
  outline-offset: 2px;
}

.online-ac-thumb {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  display: block;
}

.online-ac-thumb-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
}

.online-ac-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.online-ac-label,
.online-ac-item .field-ac-label {
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--text);
  text-align: left;
  width: 100%;
}

.online-ac-meta,
.online-ac-item .field-ac-meta {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: left;
  white-space: normal;
}

.online-lookup-hint {
  margin: 0;
  line-height: 1.45;
}

.online-lookup-hint-warn {
  color: #b45309;
}

.online-lookup-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.online-engine-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.online-engine-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.online-engine-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.online-engine-pill {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.online-engine-pill:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.online-engine-pill.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  color: #1e40af;
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.12);
}

.online-engine-pill.online-engine-unconfigured:not(.active) {
  opacity: 0.65;
  border-style: dashed;
}

.online-engine-hint {
  margin: 0;
}

.online-query-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.online-form-actions {
  display: flex;
}

.online-form-actions button {
  min-height: 44px;
}

.online-results {
  margin-top: 0.75rem;
}

.online-results-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.online-results-header h2 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.online-results-meta {
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.online-part-summary {
  margin-bottom: 0.65rem;
}

.online-summary-card {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.online-summary-card-with-image {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.online-summary-body {
  flex: 1;
  min-width: 0;
}

.online-part-image {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  display: block;
}

.online-img-hover-preview {
  position: absolute;
  left: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  z-index: 1400;
  width: min(15rem, 42vw);
  padding: 0.55rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.22s ease,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.22s ease;
}

.online-img-hover-preview img {
  width: 100%;
  height: auto;
  max-height: 15rem;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.online-img-preview-wrap:not(.online-img-preview-wrap-suggest) .online-img-hover-preview {
  left: calc(100% + 0.55rem);
}

@media (hover: hover) and (pointer: fine) {
  .online-img-preview-wrap:not(.online-img-preview-wrap-suggest):not(.online-img-preview-wrap-table):hover .online-img-hover-preview,
  .online-img-preview-wrap:not(.online-img-preview-wrap-suggest):not(.online-img-preview-wrap-table):focus-within .online-img-hover-preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
  }
}

/* Body-level flyout — avoids clipping inside overflow:auto table panels */
.part-image-hover-flyout {
  position: fixed;
  z-index: 4600;
  width: min(15rem, 42vw);
  padding: 0.55rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition:
    opacity 0.18s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.18s ease;
}

.part-image-hover-flyout.is-open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.part-image-hover-flyout img {
  width: 100%;
  height: auto;
  max-height: 15rem;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  background: #f8fafc;
}

.online-img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  padding-bottom: var(--pad-bottom-sheet);
}

.online-img-lightbox.hidden {
  display: none;
}

body.online-img-lightbox-open {
  overflow: hidden;
}

.online-img-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.online-img-lightbox.is-open .online-img-lightbox-backdrop {
  opacity: 1;
}

.online-img-lightbox-close {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  font-weight: 400;
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0;
  transform: scale(0.88);
  transition:
    opacity 0.22s ease 0.08s,
    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.online-img-lightbox.is-open .online-img-lightbox-close {
  opacity: 1;
  transform: scale(1);
}

.online-img-lightbox-close-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.online-img-lightbox-close:hover {
  background: white;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.24);
  transform: scale(1.05);
}

.online-img-lightbox.is-open .online-img-lightbox-close:hover {
  transform: scale(1.05);
}

.online-img-lightbox-frame {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(92vw, 28rem);
  max-height: calc(100vh - 3rem - var(--safe-top) - var(--safe-bottom-stable));
  padding: 0.85rem;
  padding-top: 1rem;
  border-radius: 14px;
  background: white;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: visible;
  opacity: 0;
  transform: scale(0.94) translateY(12px);
  transition:
    opacity 0.28s ease,
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.online-img-lightbox.is-open .online-img-lightbox-frame {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.online-img-lightbox-img {
  width: 100%;
  max-height: min(70vh, 24rem);
  object-fit: contain;
  border-radius: 10px;
  background: #f8fafc;
  opacity: 0;
  transition: opacity 0.24s ease 0.06s;
}

.online-img-lightbox.is-open .online-img-lightbox-img {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .online-img-preview-btn .online-part-image,
  .online-img-preview-btn .online-ac-thumb,
  .online-img-hover-preview,
  .online-img-lightbox-backdrop,
  .online-img-lightbox-close,
  .online-img-lightbox-frame,
  .online-img-lightbox-img {
    transition: none !important;
  }

  .online-img-lightbox-frame {
    transform: none;
  }

  .online-img-lightbox.is-open .online-img-lightbox-frame,
  .online-img-lightbox.is-open .online-img-lightbox-backdrop,
  .online-img-lightbox.is-open .online-img-lightbox-close,
  .online-img-lightbox.is-open .online-img-lightbox-img {
    opacity: 1;
    transform: none;
  }
}

.online-img-lightbox.has-gallery .online-img-lightbox-frame {
  width: min(94vw, 34rem);
}

.online-img-lightbox-stage {
  position: relative;
  display: flex;
  min-height: 0;
}

.online-img-lightbox-nav,
.online-img-lightbox-counter,
.online-img-lightbox-thumbs {
  display: none;
}

.online-img-lightbox.has-gallery .online-img-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  transform: translateY(-50%);
}

.online-img-lightbox-nav svg {
  width: 1.1rem;
  height: 1.1rem;
}

.online-img-lightbox-prev {
  left: 0.4rem;
}

.online-img-lightbox-next {
  right: 0.4rem;
}

.online-img-lightbox.has-gallery .online-img-lightbox-counter {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
}

.online-img-lightbox.has-gallery .online-img-lightbox-thumbs {
  display: flex;
  gap: 0.4rem;
  padding: 0.1rem 0.05rem 0.2rem;
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.online-img-lightbox-thumbs .part-gallery-thumb {
  width: 3.25rem;
  flex: 0 0 3.25rem;
}

.online-img-lightbox-caption {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #475569;
  text-align: center;
}

.online-img-lightbox-caption.hidden {
  display: none;
}

.online-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.online-part-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.online-summary-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.online-summary-link {
  margin-top: 0.45rem;
}

.online-product-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.online-product-link:hover {
  text-decoration: underline;
}

#onlineVehiclesTable {
  min-width: 620px;
}

@media (max-width: 768px) {
  #onlineVehiclesTable {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }
}

.catalogue-card-label {
  display: none;
}

.catalogue-result-count {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.vehicle-fitment-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #4b5563);
}

.vehicle-fitment-list li + li {
  margin-top: 0.2rem;
}

.vehicle-fitment-details {
  font-size: 0.82rem;
}

.vehicle-fitment-details summary {
  cursor: pointer;
  color: var(--primary, #2563eb);
  font-weight: 500;
}

.vehicle-fitment-details[open] summary {
  margin-bottom: 0.35rem;
}

.cell-vehicles,
.cell-llm-vehicles {
  min-width: 10rem;
  max-width: 18rem;
}

.cache-entry-remove-btn {
  display: inline-flex;
  align-items: center;
  margin-left: 0.45rem;
  padding: 0.16rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  vertical-align: middle;
}

.cache-entry-remove-btn:hover {
  border-color: #f87171;
  color: #dc2626;
  background: #fef2f2;
}

.results-card {
  overflow: hidden;
}

.results-card h2 {
  padding-bottom: 0.15rem;
  border-bottom: 2px solid #e8f0fe;
}

.results-table-panel {
  margin-top: 0.85rem;
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(16, 42, 88, 0.05),
    0 4px 14px rgba(16, 42, 88, 0.04);
  overflow: hidden;
}

.results-table-scroll {
  max-height: min(720px, 72vh);
  overflow: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #9eb3cb #edf2f7;
}

.results-table-scroll:focus-visible {
  outline: 2px solid rgba(26, 86, 219, 0.35);
  outline-offset: -2px;
}

.results-table-scroll::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.results-table-scroll::-webkit-scrollbar-track {
  background: #edf2f7;
}

.results-table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #b8c7d9, #9eb3cb);
  border-radius: 8px;
  border: 2px solid #edf2f7;
}

.results-table-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #9eb3cb, #7f97b0);
}

.results-table-scroll::-webkit-scrollbar-corner {
  background: #edf2f7;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #e8eef4;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #f8fafc 0%, #eef3f9 100%);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5c6f;
  white-space: nowrap;
  box-shadow: 0 1px 0 #d7e2ef;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr.data-row:nth-child(even) td {
  background: #fafbfd;
}

.data-table tbody tr.data-row:hover td {
  background: #eef4ff;
}

.data-table tbody tr.data-row {
  transition: background 0.15s ease;
}

.data-table td strong,
.data-table .part-number {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.84rem;
  color: #1e3a5f;
  font-weight: 700;
}

.part-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  display: block;
}

.online-img-preview-btn .part-thumb {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.online-img-preview-btn:hover .part-thumb,
.online-img-preview-btn:focus-visible .part-thumb {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  border-color: #cbd5e1;
}

.online-img-preview-wrap-table {
  display: inline-block;
  vertical-align: middle;
}

.cell-llm-image,
.inventory-image-cell {
  width: 64px;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-success {
  background: #def7ec;
  color: #046c4e;
  border: 1px solid #84e1bc;
}

.badge-danger {
  background: #fde8e8;
  color: #9b1c1c;
  border: 1px solid #f8b4b4;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.catalogue-stock-badge.stock-badge-missing {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}

.catalogue-stock-badge.stock-badge-out {
  min-width: 2rem;
  text-align: center;
}

.catalogue-stock-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: middle;
}

.part-card-stock-inline .catalogue-stock-chip {
  margin-top: 0;
  margin-left: 0.15rem;
}

.catalogue-stock-chip-in {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.catalogue-stock-chip-out {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
  font-size: 0.58rem;
  letter-spacing: 0.03em;
}

.catalogue-stock-chip-missing {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  font-size: 0.58rem;
  letter-spacing: 0.03em;
}

#llmTable tr.llm-result-row .cell-llm-stock .catalogue-stock-chip,
#llmTable tr.llm-result-row .part-card-stock-inline .catalogue-stock-chip {
  font-size: 0.68rem;
  padding: 0.15rem 0.55rem;
}

#llmTable tbody tr.llm-result-row.catalogue-stock-in {
  border-left: 3px solid var(--success);
}

#llmTable tbody tr.llm-result-row.catalogue-stock-out {
  border-left: 3px solid var(--warning);
}

#llmTable tbody tr.llm-result-row.catalogue-stock-missing {
  border-left: 3px solid #cbd5e1;
}

.stock-zero {
  color: var(--danger);
  font-weight: 700;
}

.stock-ok {
  color: var(--success);
  font-weight: 600;
}

.catalog-only {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.confidence-high { color: var(--success); font-weight: 600; }
.confidence-medium { color: var(--warning); font-weight: 600; }
.confidence-low { color: var(--danger); font-weight: 600; }

.match-type {
  font-size: 0.78rem;
  color: var(--muted);
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1100;
}

body.panel-open {
  overflow: hidden;
}

/* Combo overlay must not block drawer/lightbox taps (especially under iOS notch). */
body.drawer-open #panelOverlay,
body.online-img-lightbox-open #panelOverlay {
  display: none !important;
}

@media (max-width: 768px) {
  :root {
    --mode-bar-height: 2.85rem;
    --mode-bar-sticky-offset: calc(var(--safe-top) + var(--mode-bar-height));
  }

  body {
    -webkit-tap-highlight-color: transparent;
  }

  .topbar {
    padding: 0.3rem 0.6rem;
    padding-left: calc(0.6rem + env(safe-area-inset-left, 0px));
    padding-right: calc(0.6rem + env(safe-area-inset-right, 0px));
    gap: 0.5rem;
  }

  .header-logo {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 0.72rem;
  }

  .topbar h1 {
    font-size: 0.9rem;
  }

  /* Sidebar becomes a fixed bottom tab bar on mobile. */
  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    padding: 0;
    z-index: 45;
    flex-direction: column-reverse;
    gap: 0;
    max-height: min(72vh, 30rem);
    background: transparent;
  }

  .mode-bar {
    flex-direction: row;
    gap: 0.15rem;
    padding: 0.3rem 0.5rem;
    padding-bottom: calc(0.3rem + var(--safe-bottom-stable));
    padding-left: calc(0.5rem + var(--safe-left));
    padding-right: calc(0.5rem + var(--safe-right));
    border: none;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .app-sidebar .recent-searches {
    margin: 0;
    border: none;
    border-radius: 14px 14px 0 0;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 -8px 22px rgba(15, 23, 42, 0.1);
    background: #ffffff;
    padding: 0.4rem 0.75rem 0.5rem;
    gap: 0.35rem;
    max-height: min(46vh, 17rem);
  }

  .app-sidebar .recent-searches-toggle {
    justify-content: center;
    gap: 0.35rem;
    padding: 0.2rem 0.25rem;
    min-height: 1.7rem;
    -webkit-tap-highlight-color: transparent;
  }

  .app-sidebar .recent-searches-toggle-text {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #334155;
  }

  .app-sidebar .recent-searches-count {
    min-width: 1.2rem;
    height: 1.2rem;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
  }

  .app-sidebar .recent-searches-chevron {
    display: inline;
    margin-left: 0;
  }

  .app-sidebar .recent-searches-toolbar {
    margin: 0 0 0.3rem;
    padding: 0 0.1rem;
  }

  .app-sidebar .recent-searches-clear {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    min-height: 1.5rem;
  }

  .app-sidebar .recent-searches-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.05rem 0.1rem 0.3rem;
    scroll-snap-type: x proximity;
  }

  .app-sidebar .recent-searches-list::-webkit-scrollbar {
    display: none;
  }

  .app-sidebar .recent-searches-chip {
    flex: 0 0 auto;
    width: auto;
    max-width: 13.5rem;
    min-height: 2.55rem;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    scroll-snap-align: start;
  }

  .app-sidebar .recent-searches-chip-main {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.08rem;
    padding: 0.45rem 0.7rem;
  }

  .app-sidebar .recent-searches-chip-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .app-sidebar .recent-searches-chip-sub {
    font-size: 0.66rem;
    max-width: 11.5rem;
  }

  .app-sidebar .recent-searches-chip-remove {
    display: none;
  }

  .app-sidebar .recent-searches.is-collapsed {
    padding: 0.22rem 0.75rem 0.28rem;
    box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08);
    max-height: none;
  }

  .app-sidebar .recent-searches.is-collapsed .recent-searches-toggle {
    min-height: 1.45rem;
    padding: 0.1rem 0;
  }

  .app-sidebar .recent-searches.is-collapsed .recent-searches-toggle-text {
    font-size: 0.68rem;
    font-weight: 650;
    color: #64748b;
  }

  .app-sidebar .recent-searches.is-panel-visible {
    animation: recent-dock-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .mode-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.3rem 0.25rem;
  }

  .mode-tab-icon {
    width: 1.2rem;
    height: 1.2rem;
  }

  .mode-tab-label {
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .mode-tab-desc {
    display: none;
  }

  @media (max-width: 400px) {
    :root {
      --mode-bar-height: 2.85rem;
      --mode-bar-sticky-offset: calc(var(--safe-top) + var(--mode-bar-height));
    }
  }

  main {
    padding: 0.85rem;
    padding-left: calc(0.85rem + var(--safe-left));
    padding-right: calc(0.85rem + var(--safe-right));
    /* --mobile-bottom-dock = measured tab bar + recent-searches strip (incl. home-indicator inset). */
    padding-bottom: calc(var(--mobile-bottom-dock, calc(6rem + var(--safe-bottom-stable))) + 1.25rem);
    gap: 1rem;
  }

  #status {
    margin-bottom: 0.15rem;
  }

  .card {
    padding: 1rem;
    border-radius: 12px;
  }

  .card h2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 1rem;
  }

  .search-card-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .collapsible-card.collapsed .search-card-body {
    grid-template-rows: 0fr;
  }

  .search-card-body-inner {
    overflow-x: clip;
    overflow-y: visible;
    min-height: 0;
    width: 100%;
  }

  .collapsible-card.collapsed .search-card-body-inner {
    overflow: hidden;
  }

  .collapsible-card {
    transition:
      padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      border-color 0.35s ease;
    overflow: hidden;
  }

  .search-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  .search-card-heading {
    flex: 1;
    min-width: 0;
  }

  .search-card-title {
    display: block;
    font-size: 0.95rem;
    line-height: 1.2;
    transition:
      font-size 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      color 0.35s ease,
      font-weight 0.35s ease;
  }

  .search-collapse-summary {
    display: block;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition:
      max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.32s ease,
      margin-top 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .collapsible-card.collapsed .search-collapse-summary.is-visible {
    max-height: 1.4rem;
    opacity: 1;
    margin-top: 0.2rem;
    animation: search-summary-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .search-collapse-chevron {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 0.85rem;
    transition:
      transform 0.42s cubic-bezier(0.34, 1.2, 0.64, 1),
      background 0.2s ease,
      box-shadow 0.2s ease;
  }

  .search-collapse-toggle:active .search-collapse-chevron {
    background: #dbeafe;
    transform: scale(0.92);
  }

  .collapsible-card.collapsed .search-collapse-toggle:active .search-collapse-chevron {
    transform: rotate(-90deg) scale(0.92);
  }

  .collapsible-card.collapsed .search-collapse-chevron {
    transform: rotate(-90deg);
    box-shadow: 0 1px 4px rgba(26, 86, 219, 0.15);
  }

  .online-form-actions {
    position: static;
    z-index: auto;
    margin: 0.2rem 0 0;
    padding: 0;
    background: none;
    border-top: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .online-form-actions button {
    width: 100%;
    min-height: 2.35rem;
    font-size: 0.9rem;
    padding: 0.42rem 1.1rem;
  }

  #onlineSearchFlow,
  #onlineLookupForm,
  .online-search-stack,
  .lookup-source-fieldset,
  .search-flow-panel {
    min-width: 0;
    max-width: 100%;
  }

  /* Match vehicle search density — compact source chips, not tall cards. */
  #onlineCard.card {
    padding: 0.55rem 0.7rem;
  }

  #onlineCard .search-card-title {
    font-size: 0.95rem;
  }

  #onlineCard .search-flow {
    gap: 0.3rem;
  }

  #onlineCard .search-flow-tabs {
    gap: 0.2rem;
    padding: 0.15rem;
  }

  #onlineCard .search-flow-tab {
    font-size: 0.78rem;
    padding: 0.42rem 0.85rem;
  }

  #onlineCard .online-search-stack,
  #onlineCard .online-motrparts-stack {
    gap: 0.28rem;
  }

  #onlineCard .lookup-source-legend,
  #onlineCard .online-query-label,
  #onlineCard .combo-dropdown-label,
  #onlineCard .combo-field-label {
    gap: 0.2rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    font-weight: 600;
  }

  #onlineCard .lookup-source-legend {
    margin: 0 0 0.2rem;
  }

  #onlineCard .lookup-source-group {
    gap: 0.25rem;
  }

  #onlineCard .lookup-source-card {
    min-height: 2.1rem;
    padding: 0.35rem 0.4rem;
    border-radius: 8px;
    align-items: center;
    text-align: center;
    gap: 0;
    box-shadow: none;
  }

  #onlineCard .lookup-source-name {
    font-size: 0.72rem;
    font-weight: 650;
  }

  #onlineCard .lookup-source-desc {
    display: none;
  }

  #onlineCard .lookup-source-option:hover .lookup-source-card {
    transform: none;
  }

  #onlineCard .lookup-source-option input:checked + .lookup-source-card {
    box-shadow: none;
    background: #eff6ff;
  }

  #onlineCard .online-query-label input,
  #onlineCard .combo-trigger,
  #onlineCard .online-ac-wrap input {
    padding: 0.42rem 0.55rem;
    font-size: 0.9rem;
    min-height: 2.25rem;
    border-radius: 8px;
  }

  #onlineCard .online-lookup-hint,
  #onlineCard .chassis-status {
    margin: 0.1rem 0 0;
    font-size: 0.72rem;
    line-height: 1.3;
  }

  #onlineCard .online-form-actions.search-footer {
    margin-top: 0.75rem;
    padding: 0;
    border: none;
    border-top: none;
    box-shadow: none;
    background: none;
  }

  #onlineCard .online-motrparts-fields {
    gap: 0.28rem;
  }

  #searchCard .vehicle-search-filters,
  #onlineCard .vehicle-search-filters {
    border-top: none;
  }

  /* Keep collapse animation consistent with vehicle search (no overflow hacks). */
  .online-catalogue-card:not(.collapsed) {
    overflow: hidden;
  }

  .online-catalogue-card:not(.collapsed) .search-card-body {
    display: grid;
    overflow: hidden;
  }

  .online-catalogue-card:not(.collapsed) .search-card-body-inner {
    overflow-x: clip;
    overflow-y: visible;
    min-height: 0;
  }

  .search-flow-tabs--triple {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  .search-flow-tabs--triple .search-flow-tab {
    line-height: 1.15;
    white-space: normal;
    hyphens: auto;
  }

  .online-ac-item {
    min-height: 48px;
    align-items: flex-start;
  }

  .online-ac-thumb {
    width: 2.75rem;
    height: 2.75rem;
  }

  .online-part-image {
    width: 4.5rem;
    height: 4.5rem;
  }

  .online-summary-card-with-image {
    gap: 0.7rem;
  }

  .online-img-lightbox-frame {
    width: min(94vw, 24rem);
    padding: 0.7rem;
  }

  .online-img-lightbox-img {
    max-height: min(62vh, 20rem);
  }

  .online-engine-pill {
    min-height: 48px;
    font-size: 0.85rem;
  }

  .online-summary-card {
    padding: 0.6rem 0.7rem;
  }

  .online-part-title {
    font-size: 0.88rem;
  }

  #onlineVehiclesTable tr.online-vehicle-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    margin-bottom: 0.45rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  }

  #onlineVehiclesTable tr.fitments-loading-row,
  #onlineVehiclesTable tr.service-loading-row,
  #llmTable tr.service-loading-row,
  #warehouseTable tr.service-loading-row {
    display: block;
    margin-bottom: 0.45rem;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
  }

  #onlineVehiclesTable tr.fitments-loading-row td,
  #onlineVehiclesTable tr.service-loading-row td,
  #llmTable tr.service-loading-row td,
  #warehouseTable tr.service-loading-row td {
    display: block;
    width: 100%;
    padding: 1.1rem 0.85rem;
    background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--primary) 5%, #fff),
      #fff
    );
  }

  #onlineVehiclesTable tr.online-vehicle-row td {
    flex: 0 0 auto;
    padding: 0.12rem 0.38rem;
    border-radius: 5px;
    background: #f1f5f9;
    font-size: 0.68rem;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-make {
    order: 1;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-years,
  #onlineVehiclesTable tr.online-vehicle-row .cell-variant,
  #onlineVehiclesTable tr.online-vehicle-row .cell-action {
    order: 1;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-model {
    order: 2;
    flex: 1 1 100%;
    background: transparent;
    padding: 0.15rem 0 0;
    font-size: 0.78rem;
    color: #047857;
    font-weight: 700;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-notes {
    display: none;
  }

  .collapsible-card.collapsed {
    padding: 0.55rem 0.75rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    border-color: #dbeafe;
    will-change: auto;
    background: #fff;
  }

  /* Form-only cards (results are siblings) — stick the whole card. */
  .collapsible-card.collapsed:not(.collapsible-card--nested-results) {
    position: sticky;
    top: var(--mode-bar-sticky-offset, calc(var(--safe-top) + var(--mode-bar-height, 4.5rem)));
    z-index: 30;
  }

  /* Cards that nest results — stick header chrome only (avoids overlap/flicker).
     Outer shell fades out (transparent border, not border:none) so the
     border-color transition doesn't flash black like Vehicle Search stays smooth.
     Use #id so this beats `#onlineCard.card { padding: … }`. */
  .collapsible-card--nested-results,
  #onlineCard.collapsible-card--nested-results,
  #warehouseCard.collapsible-card--nested-results {
    transition:
      padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      border-color 0.35s ease,
      background-color 0.35s ease;
  }

  .collapsible-card--nested-results.collapsed,
  #onlineCard.collapsible-card--nested-results.collapsed,
  #warehouseCard.collapsible-card--nested-results.collapsed {
    position: static;
    overflow: visible;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
  }

  .collapsible-card--nested-results > .collapsible-sticky,
  #onlineCard.collapsible-card--nested-results > .collapsible-sticky,
  #warehouseCard.collapsible-card--nested-results > .collapsible-sticky {
    transition:
      padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      margin 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.42s cubic-bezier(0.4, 0, 0.2, 1),
      border-color 0.35s ease,
      background-color 0.35s ease,
      border-radius 0.35s ease;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
  }

  .collapsible-card--nested-results.collapsed > .collapsible-sticky,
  #onlineCard.collapsible-card--nested-results.collapsed > .collapsible-sticky,
  #warehouseCard.collapsible-card--nested-results.collapsed > .collapsible-sticky {
    position: sticky;
    top: var(--mode-bar-sticky-offset, calc(var(--safe-top) + var(--mode-bar-height, 4.5rem)));
    z-index: 30;
    margin: 0;
    padding: 0.55rem 0.75rem;
    background: #fff;
    border-color: #dbeafe;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  }

  /* Match vehicle search: results sit flush under the sticky bar (panel gap handles spacing). */
  #onlineCard.collapsed > .online-results {
    margin-top: 0.55rem;
  }

  /* Results enter animation translates the card and fights sticky/scroll height sync. */
  .results-card.results-enter,
  .results-card.results-enter:nth-of-type(2) {
    animation: none;
  }

  .collapsible-card.collapsed .search-card-title {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
  }

  .collapsible-card:not(.collapsed) .search-collapse-summary {
    pointer-events: none;
  }

  .warehouse-collapse-row {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .warehouse-collapse-row .search-collapse-toggle {
    width: 100%;
  }

  .warehouse-card-top {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
  }

  .warehouse-header-actions {
    width: auto;
    flex-shrink: 0;
    gap: 0.35rem;
  }

  .warehouse-header-actions #warehouseSearchUnmappedBtn:not([hidden]),
  .warehouse-header-actions #warehouseRefreshBtn {
    flex: 0 0 auto;
  }

  .warehouse-card.collapsed .warehouse-card-top {
    gap: 0.35rem;
  }

  .warehouse-card.collapsed .warehouse-action-btn.icon-btn {
    width: 2rem;
    height: 2rem;
  }

  .warehouse-search {
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0.35rem 0.65rem;
    font-size: 16px;
  }

  .search-card-body-inner > form {
    margin-top: 0.85rem;
  }

  .meta {
    display: block;
    line-height: 1.4;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .lookup-form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .lookup-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 0.75rem 0 0;
    padding: 0.65rem 0 var(--pad-bottom-footer);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #ffffff 40%);
    border-top: 2px solid #cbd5e1;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  }

  .lookup-form-actions button {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .lookup-card .lookup-results {
    margin-top: 0.75rem;
  }

  label {
    font-size: 0.82rem;
  }

  input,
  select,
  .combo-search {
    font-size: 16px;
    min-height: 48px;
    padding: 0.7rem 0.75rem;
  }

  .combo-trigger {
    min-height: 48px;
    padding: 0.7rem 0.75rem;
    font-size: 16px;
  }

  .combo-panel .combo-search {
    font-size: 16px;
    min-height: 2rem;
    padding: 0.3rem 0.45rem;
  }

  .combo-options li,
  .combo-option-check label {
    min-height: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .combo-option-check label {
    flex-direction: row !important;
    gap: 0.45rem;
  }

  .combo-option-check input[type="checkbox"] {
    width: 1.05rem !important;
    height: 1.05rem !important;
    min-width: 1.05rem !important;
    min-height: 1.05rem !important;
    max-width: 1.05rem !important;
    margin: 0 0.45rem 0 0 !important;
    padding: 0 !important;
  }

  .filter-pill {
    min-height: 36px;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
  }

  .brands-picker:not(.brands-picker-compact) {
    padding: 0.85rem;
  }

  .vehicle-search-form .brands-picker.brands-picker-compact {
    padding: 0;
    border: none;
    background: none;
  }

  .search-footer {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 0.75rem 0 0;
    padding: 0.65rem 0 var(--pad-bottom-footer);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #ffffff 40%);
    border-top: 2px solid #cbd5e1;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  }

  /* Vehicle Search + Online: no sticky footer chrome / divider above buttons. */
  #searchCard .search-footer,
  #searchCard .vehicle-search-actions,
  #searchCard .online-form-actions,
  #onlineCard .search-footer,
  #onlineCard .online-form-actions {
    position: static;
    margin: 0.75rem 0 0;
    padding: 0;
    background: none;
    border: none;
    border-top: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  #searchCard .vehicle-search-filters {
    border-top: none;
  }

  [data-flow-panel="vehicle"] .vehicle-search-actions-row {
    margin-top: 0.75rem;
  }

  .vehicle-search-form input:not(.combo-search),
  .vehicle-search-form select,
  .vehicle-search-form .combo-trigger {
    min-height: 44px;
    padding: 0.55rem 0.65rem;
  }

  .brands-picker {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .selected-chips {
    max-width: 100%;
  }

  .chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cache-toolbar-wrap {
    margin-bottom: 0.55rem;
  }

  .form-actions {
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    border-top: none;
    backdrop-filter: none;
    gap: 0.65rem;
  }

  .form-actions {
    width: 100%;
    min-width: 0;
  }

  .form-actions button {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    font-size: 1rem;
  }

  .cache-toolbar {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    border: 1px solid #94a3b8;
    border-top: 2px solid #64748b;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    background: #f8fafc;
  }

  .cache-toolbar-intro {
    flex: 1 1 100%;
    padding-left: 0.1rem;
  }

  .cache-toolbar-label {
    font-size: 0.68rem;
  }

  .cache-help-btn {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.78rem;
  }

  .has-tooltip::after {
    bottom: auto;
    top: calc(100% + 8px);
    font-size: 0.7rem;
    z-index: 80;
  }

  .has-tooltip::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: #1e293b;
  }

  .cache-toolbar-wrap {
    overflow: visible;
  }

  .cache-chips {
    flex: 1 1 auto;
  }

  .cache-chip-face {
    padding: 0.32rem 0.5rem;
    font-size: 0.74rem;
  }

  .cache-clear-btn {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
  }

  .cache-toolbar-hint {
    display: block !important;
    font-size: 0.68rem;
    margin-top: 0.4rem;
    padding: 0.45rem 0.55rem;
    line-height: 1.35;
    position: relative;
    z-index: 50;
  }

  .cache-help-btn.has-tooltip::after,
  .cache-help-btn.has-tooltip::before {
    display: none;
  }

  .cache-chip.has-tooltip::after,
  .cache-chip.has-tooltip::before,
  .cache-clear-btn.has-tooltip::after,
  .cache-clear-btn.has-tooltip::before {
    display: none;
  }

  .combo-dropdown.open .combo-panel,
  .combo-panel.combo-panel-portal:not(.hidden) {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1200;
    max-height: min(78dvh, 560px);
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    animation: sheet-up 0.22s ease-out;
    overflow: hidden;
    /* Always-visible home-indicator / edge pad (stable across keyboard open/close). */
    padding-bottom: var(--pad-bottom-sheet);
    box-sizing: border-box;
  }

  .combo-dropdown.open .combo-search-wrap,
  .combo-panel.combo-panel-portal .combo-search-wrap,
  .combo-dropdown.open .combo-panel-footer,
  .combo-panel.combo-panel-portal .combo-panel-footer {
    flex: 0 0 auto;
  }

  .combo-dropdown.open .combo-options,
  .combo-panel.combo-panel-portal .combo-options {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 0.75rem;
    scroll-padding-bottom: 0.75rem;
  }

  .combo-panel-footer {
    padding: 0.75rem 1rem;
  }

  .combo-panel-footer button {
    min-height: 44px;
    min-width: 88px;
  }

  .status {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .results-card {
    padding: 0.5rem 0.45rem;
    overflow-x: clip;
    overflow-y: visible;
    border-radius: 11px;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.05);
    /* Keep results clear of sticky collapsed search when page scrolls. */
    scroll-margin-top: calc(var(--mode-bar-sticky-offset, 3rem) + 3.25rem);
  }

  .results-card h2 {
    font-size: 0.86rem;
    gap: 0.25rem;
    margin-bottom: 0;
    padding-bottom: 0.3rem;
    border-bottom: none;
    flex-wrap: wrap;
  }

  .results-card .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.64rem;
    color: var(--muted);
    line-height: 1.25;
    width: 100%;
  }

  .catalogue-result-count {
    font-size: 0.64rem;
    margin-left: 0;
  }

  .results-table-panel {
    margin-top: 0.3rem;
    border-radius: 9px;
    border-color: #e8edf3;
    background: #f1f5f9;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    /* Isolate layout so inner scroll doesn't fight page scroll. */
    contain: layout;
  }

  .results-table-scroll,
  .mobile-results-scroll {
    /* Fallback before JS measures; JS sets chrome-aware max-height. */
    max-height: calc(100dvh - var(--mode-bar-sticky-offset, 3rem) - 5.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    margin: 0;
    padding: 0.28rem 0.3rem;
    padding-bottom: var(--pad-bottom-list);
    width: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: var(--pad-bottom-list);
  }

  .mobile-results-scroll[data-mobile-dynamic-height='1'] {
    overscroll-behavior-y: contain;
  }

  .online-results {
    scroll-margin-top: calc(var(--mode-bar-sticky-offset, 3rem) + 3.25rem);
    margin-top: 0.55rem;
    padding: 0.55rem 0.55rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.05);
    overflow-x: clip;
    overflow-y: visible;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .online-results-header h2 {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
  }

  .online-results-meta {
    margin-bottom: 0.45rem;
    font-size: 0.72rem;
  }

  /* Shared scroll for part card + fitments — avoid two competing max-heights. */
  #onlineResultsScroll.mobile-results-scroll {
    max-height: calc(100dvh - var(--mode-bar-sticky-offset, 3rem) - 5.5rem);
    padding: 0;
    padding-bottom: var(--pad-bottom-list);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    scroll-padding-bottom: var(--pad-bottom-list);
  }

  #onlineResultsSection #onlinePartsGrid {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 0.45rem;
    gap: 0.55rem;
  }

  #onlineResultsSection .online-part-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #onlineResultsSection .results-table-panel {
    margin-top: 0;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    /* Must not clip — outer #onlineResultsScroll is the only scroller. */
    overflow: visible;
    contain: none;
  }

  #onlineResultsSection .results-table-scroll {
    max-height: none;
    height: auto;
    overflow: visible;
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #onlineVehiclesTable tbody {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
  }

  #onlineVehiclesTable tr.online-vehicle-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    padding: 0.5rem 0.55rem;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-model {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-action {
    margin-left: auto;
    max-width: 100%;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-action .link-btn {
    white-space: nowrap;
    font-size: 0.72rem;
  }

  .warehouse-table-panel {
    overflow: hidden;
    contain: layout;
  }

  #llmTable tbody {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
  }

  #llmTable {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .responsive-table {
    border: none;
  }

  .responsive-table thead {
    display: none;
  }

  tr.group-header td,
  tr.alternative-header td {
    position: static;
    box-shadow: none;
  }

  .responsive-table tbody tr.group-header,
  .responsive-table tbody tr.alternative-header,
  .responsive-table tbody tr.no-match-row {
    display: block;
    margin: 0.35rem 0 0.25rem;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .responsive-table tbody tr.group-header td,
  .responsive-table tbody tr.alternative-header td,
  .responsive-table tbody tr.no-match-row td {
    display: block;
    padding: 0.3rem 0.45rem;
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .responsive-table tbody tr.group-header td {
    background: #e8f0fe;
    color: var(--primary);
  }

  .responsive-table tbody tr.alternative-header td {
    background: #ffedd5;
    color: #c2410c;
  }

  .responsive-table tbody tr.no-match-row td {
    background: #f8fafc;
    font-style: italic;
    color: var(--muted);
  }

  .responsive-table tbody tr.inventory-result-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem 0.42rem;
    margin-bottom: 0.5rem;
    padding: 0.52rem 0.58rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .responsive-table tbody tr.llm-result-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.16rem 0.32rem;
    margin-bottom: 0;
    padding: 0.38rem 0.42rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    align-items: start;
    transition:
      transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.22s ease,
      border-color 0.22s ease;
    animation: catalogue-card-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--card-delay, 0s);
  }

  .responsive-table tbody tr.llm-result-row:active {
    transform: scale(0.985);
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
  }

  .responsive-table tbody tr.llm-result-row.catalogue-stock-in {
    border-left: 3px solid var(--success);
  }

  .responsive-table tbody tr.llm-result-row.catalogue-stock-out {
    border-left: 3px solid var(--warning);
  }

  .responsive-table tbody tr.llm-result-row.catalogue-stock-missing {
    border-left: 3px solid #cbd5e1;
  }

  .responsive-table tbody tr.alternative-row {
    border-color: #fed7aa;
    background: linear-gradient(180deg, #fffaf5, #fff);
  }

  .responsive-table td {
    display: block;
    padding: 0;
    border: none;
    text-align: left;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .responsive-table td::before {
    display: none;
  }

  .responsive-table td.mobile-hide {
    display: none !important;
  }

  .responsive-table .badge {
    padding: 0.06rem 0.3rem;
    font-size: 0.58rem;
    line-height: 1.15;
  }

  .catalogue-card-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.12rem;
    line-height: 1.2;
  }

  .mobile-chip {
    display: inline-block;
    max-width: 100%;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
  }

  .catalogue-chip-type {
    padding: 0.1rem 0.38rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #3730a3;
    font-size: 0.6rem;
    border: 1px solid #c7d2fe;
  }

  .catalogue-stock-badge {
    padding: 0.1rem 0.34rem;
    font-size: 0.56rem;
    box-shadow: none;
  }

  /* Inventory result cards */
  #resultsTable tr.inventory-result-row .cell-title {
    flex: 1 1 calc(100% - 5.5rem);
    min-width: 0;
    order: 1;
    font-size: 0.8rem;
    line-height: 1.2;
  }

  #resultsTable tr.inventory-result-row .cell-title strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.8rem;
    color: #0f172a;
  }

  #resultsTable tr.inventory-result-row .cell-stock {
    flex: 0 0 auto;
    order: 2;
    margin-left: auto;
  }

  #resultsTable tr.inventory-result-row .cell-part-type,
  #resultsTable tr.inventory-result-row .cell-partno,
  #resultsTable tr.inventory-result-row .cell-sales,
  #resultsTable tr.inventory-result-row .cell-purchase,
  #resultsTable tr.inventory-result-row .cell-score {
    flex: 0 0 auto;
    order: 3;
    padding: 0.12rem 0.38rem;
    border-radius: 5px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.68rem;
  }

  .responsive-table td.cell-empty {
    display: none !important;
  }

  #onlineVehiclesTable.responsive-table td.cell-empty {
    display: none !important;
  }

  #warehouseTable.responsive-table td.cell-empty {
    display: none !important;
  }

  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-empty {
    display: none !important;
  }

  #resultsTable tr.inventory-result-row .cell-partno .part-number {
    font-size: 0.68rem;
    color: #1e3a5f;
  }

  #resultsTable tr.inventory-result-row .cell-sales strong {
    font-family: inherit;
    font-size: 0.68rem;
    color: #047857;
  }

  #resultsTable tr.inventory-result-row .cell-purchase {
    background: #eff6ff;
    color: #1e40af;
  }

  #resultsTable tr.inventory-result-row .price-tag {
    display: inline;
    font-weight: 700;
    opacity: 0.85;
    margin-right: 0.1rem;
  }

  #resultsTable tr.inventory-result-row .cell-reason {
    flex: 1 1 100%;
    order: 4;
    font-size: 0.66rem;
    color: var(--muted);
    padding-top: 0.1rem;
    border-top: 1px dashed #e2e8f0;
    margin-top: 0.1rem;
  }

  /* Shared part cards (Vehicle Search + Inventory) */
  .part-card-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .responsive-table tbody tr.part-card-row > td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .part-card-row .part-card-image .catalogue-card-label {
    display: none;
  }

  .part-card-row .part-card-image .part-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
  }

  .part-card-row .part-card-item .warehouse-item-name {
    display: block;
    font-size: 0.78rem;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .part-card-row .catalogue-card-label {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 0.04rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    line-height: 1.05;
  }

  .part-card-row .part-card-partno {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
  }

  .part-card-row .part-card-partno .catalogue-card-label {
    display: inline;
    width: auto;
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .part-card-row .part-card-pn-wrap,
  .part-card-row .catalogue-card-pn-wrap {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.12rem 0.22rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  /* Ellipsis — never create an inner scrollbar on part numbers */
  .part-card-row .part-card-pn,
  .part-card-row .catalogue-card-pn,
  .part-card-row .part-card-partno .part-number {
    display: inline-block;
    width: auto;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
    letter-spacing: 0.02em;
    font-weight: 700;
  }

  .part-card-row .part-card-pn-wrap .copy-btn,
  .part-card-row .copy-btn {
    flex-shrink: 0;
  }

  .part-card-row .card-metric-value:not(.fitment-count) {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 0.68rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
  }

  /* Catalogue / Vehicle Search result cards — match Inventory mobile layout */
  #llmTable tr.llm-result-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #llmTable.responsive-table tbody tr.llm-result-row > td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }

  #llmTable tr.llm-result-row .cell-llm-image {
    order: 0;
    grid-column: 1 / 2;
    align-self: start;
  }

  #llmTable tr.llm-result-row .cell-llm-image .catalogue-card-label {
    display: none;
  }

  #llmTable tr.llm-result-row .cell-llm-image .part-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
  }

  #llmTable tr.llm-result-row .cell-llm-item {
    grid-column: 2 / -1;
    order: 1;
    margin-bottom: 0;
  }

  #llmTable tr.llm-result-row .cell-llm-item .warehouse-item-name {
    display: block;
    font-size: 0.78rem;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  #llmTable tr.llm-result-row .cell-llm-partno {
    order: 2;
    grid-column: span 2;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
  }

  #llmTable tr.llm-result-row .catalogue-card-label {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 0.04rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    line-height: 1.05;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn-wrap {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.12rem 0.22rem;
    max-width: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn {
    display: inline-block;
    width: auto;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
    letter-spacing: 0.02em;
    font-weight: 700;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn::-webkit-scrollbar {
    display: none;
  }

  #llmTable tr.llm-result-row .cell-llm-partno .catalogue-card-label {
    display: inline;
    width: auto;
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn-wrap .copy-btn,
  #llmTable tr.llm-result-row .copy-btn {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.58rem;
    margin-left: 0;
  }

  #llmTable tr.llm-result-row .cell-llm-parttype {
    order: 3;
    color: #475569;
  }

  /* Must beat `#llmTable.responsive-table … > td { display: flex }` or brand + Catalogue chip leak in. */
  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-llm-brand,
  #llmTable.responsive-table tbody tr.llm-result-row > td.mobile-hide {
    display: none;
  }

  #llmTable tr.llm-result-row .cell-llm-brand-inventory {
    order: 4;
    color: #9a3412;
    font-weight: 600;
    text-align: left;
  }

  #llmTable tr.llm-result-row:has(.cell-llm-brand-inventory.cell-empty) .cell-llm-parttype,
  #llmTable tr.llm-result-row:has(.cell-llm-parttype.cell-empty) .cell-llm-brand-inventory {
    grid-column: span 2;
  }

  #llmTable tr.llm-result-row:has(.cell-llm-mrp.cell-empty):has(.cell-llm-sales.cell-empty):has(.cell-llm-purchase.cell-empty)
    .cell-llm-stock,
  #llmTable tr.llm-result-row:has(.cell-llm-mrp.cell-empty):has(.cell-llm-sales.cell-empty):has(.cell-llm-purchase.cell-empty)
    .cell-llm-vehicles {
    grid-column: span 2;
  }

  #llmTable tr.llm-result-row .cell-llm-brand-inventory .card-metric-value strong {
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    color: #9a3412;
    word-break: break-word;
  }

  #llmTable tr.llm-result-row .llm-metrics-break {
    grid-column: 1 / -1;
    order: 5;
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
    visibility: hidden;
    pointer-events: none;
  }

  #llmTable tr.llm-result-row .cell-llm-stock {
    order: 6;
    position: relative;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
  }

  #llmTable tr.llm-result-row .cell-llm-stock::before {
    content: '';
    position: absolute;
    top: 0;
    left: -0.42rem;
    right: -0.42rem;
    border-top: 1px solid #f1f5f9;
  }

  #llmTable tr.llm-result-row .cell-llm-vehicles {
    order: 7;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
    grid-column: auto;
    width: auto;
    max-width: 100%;
    border: none;
    background: transparent;
  }

  #llmTable tr.llm-result-row .cell-llm-mrp {
    order: 8;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
  }

  #llmTable tr.llm-result-row .cell-llm-sales {
    order: 9;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
    color: var(--success);
    font-weight: 700;
  }

  #llmTable tr.llm-result-row .cell-llm-purchase {
    order: 10;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
    color: #334155;
  }

  #llmTable tr.llm-result-row .cell-llm-stock,
  #llmTable tr.llm-result-row .cell-llm-vehicles,
  #llmTable tr.llm-result-row .cell-llm-mrp,
  #llmTable tr.llm-result-row .cell-llm-sales,
  #llmTable tr.llm-result-row .cell-llm-purchase {
    align-self: start;
    border: none;
    background: transparent;
    white-space: normal;
    font-size: inherit;
    font-weight: 600;
    color: inherit;
  }

  #llmTable tr.llm-result-row .card-metric-value:not(.fitment-count) {
    display: block;
    width: 100%;
    font-size: 0.68rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }

  #llmTable tr.llm-result-row .cell-llm-stock .badge,
  #llmTable tr.llm-result-row .catalogue-stock-badge {
    margin-top: 0;
  }

  #llmTable tr.llm-result-row .cell-llm-vehicles .fitment-count,
  #llmTable tr.llm-result-row .cell-llm-vehicles .llm-fitments-count-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 1.75rem;
    max-width: 100%;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
  }

  #llmTable tr.llm-result-row .cell-llm-vehicles .fitment-count-has {
    background: #dbeafe;
    color: #1e40af;
  }

  /* Desktop-only columns — same specificity as the card flex rule so they stay hidden. */
  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-llm-generation,
  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-llm-variant,
  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-llm-match,
  #llmTable.responsive-table tbody tr.llm-result-row > td.cell-llm-actions {
    display: none;
  }

  #llmTable tr.llm-result-row .catalogue-card-match {
    font-size: 0.68rem;
  }

  .responsive-table td.mobile-only {
    display: block;
  }

  .disclaimer {
    font-size: 0.72rem;
    line-height: 1.35;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes catalogue-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes catalogue-expand-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 380px) {
  .chip {
    font-size: 0.76rem;
  }

  .responsive-table tbody tr.inventory-result-row {
    padding: 0.48rem 0.52rem;
    gap: 0.22rem 0.36rem;
  }

  .responsive-table tbody tr.llm-result-row {
    padding: 0.34rem 0.38rem;
    gap: 0.14rem 0.28rem;
    border-radius: 10px;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn {
    font-size: 0.66rem;
  }

  #resultsTable tr.inventory-result-row .cell-title strong {
    -webkit-line-clamp: 1;
  }
}

/* Warehouse & catalogue mappings */
.warehouse-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
}

.warehouse-overview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.warehouse-overview-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.warehouse-card-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  width: 100%;
}

.warehouse-collapse-row {
  margin-bottom: 0;
  min-width: 0;
}

.warehouse-card .search-card-body {
  margin-top: 0;
}

.warehouse-header-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

.warehouse-toolbar-primary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

@media (min-width: 769px) {
  /* Flatten wrappers so search + actions share one row */
  .warehouse-card > .warehouse-card-top,
  .warehouse-card > .search-card-body,
  .warehouse-card > .search-card-body > .warehouse-overview,
  .warehouse-card .warehouse-toolbar,
  .warehouse-card .warehouse-toolbar-primary {
    display: contents;
  }

  .warehouse-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'stats stats'
      'search actions'
      'filters filters'
      'table table'
      'empty empty';
    column-gap: 0.45rem;
    row-gap: 0.45rem;
    align-items: center;
  }

  .warehouse-collapse-row {
    display: none;
  }

  .warehouse-overview-top {
    grid-area: stats;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.75rem;
    min-width: 0;
  }

  .warehouse-search {
    grid-area: search;
    width: 100%;
    min-width: 0;
  }

  .warehouse-header-actions {
    grid-area: actions;
    width: auto;
    flex-wrap: nowrap;
  }

  .warehouse-filter-row {
    grid-area: filters;
    min-width: 0;
  }

  .warehouse-table-panel {
    grid-area: table;
    min-width: 0;
  }

  .warehouse-empty {
    grid-area: empty;
  }

  .warehouse-meta {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
  }
}

.warehouse-action-btn {
  white-space: nowrap;
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
}

.warehouse-action-btn.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  flex: 0 0 auto;
  color: var(--muted);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.warehouse-action-btn.icon-btn[hidden] {
  display: none !important;
}

.warehouse-action-btn.icon-btn:hover,
.warehouse-action-btn.icon-btn:focus-visible {
  border-color: #bfdbfe;
  background: #eef4ff;
  color: var(--primary);
  outline: none;
  box-shadow: 0 1px 4px rgba(26, 86, 219, 0.08);
}

.warehouse-action-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.warehouse-action-btn.icon-btn.is-loading .btn-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border-width: 2px;
}

.warehouse-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}

.warehouse-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
}

.warehouse-stat {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.22rem 0.55rem 0.22rem 0.45rem;
  cursor: default;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.warehouse-stat::before {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-total::before { background: #64748b; }
.stat-stock::before { background: var(--success); }
.stat-mapped::before { background: var(--primary); }
.stat-unmapped::before { background: var(--warning); }

.warehouse-stat:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.warehouse-stat-value {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.warehouse-stat-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.warehouse-stat-label::before {
  content: '·';
  margin: 0 0.2rem 0 0.05rem;
  color: #cbd5e1;
  font-weight: 400;
}

.stat-muted .warehouse-stat-label::before {
  content: none;
  margin: 0;
}

.stat-stock .warehouse-stat-value { color: var(--success); }
.stat-mapped .warehouse-stat-value { color: var(--primary); }
.stat-unmapped .warehouse-stat-value { color: var(--warning); }
.stat-muted {
  border-radius: 8px;
  background: #fffbeb;
  border-color: #fde68a;
  padding: 0.28rem 0.55rem;
}
.stat-muted::before { display: none; }
.stat-muted .warehouse-stat-label {
  font-size: 0.7rem;
  color: #92400e;
}

.warehouse-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.warehouse-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.warehouse-filters {
  /* Let pills share the same flex line as Part types (wrap only when needed). */
  display: contents;
}

.warehouse-part-type-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  max-width: max-content;
  min-width: 0;
}

.warehouse-part-type-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 999px;
  gap: 0.2rem;
  max-width: min(14rem, 70vw);
  box-sizing: border-box;
}

.warehouse-part-type-trigger .combo-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-part-type-trigger .combo-chevron {
  font-size: 0.65rem;
  opacity: 0.75;
}

.warehouse-part-type-trigger.has-selection {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft, #eff6ff);
}

.warehouse-part-type-trigger.has-selection .combo-trigger-text.placeholder {
  color: var(--primary);
}

@media (min-width: 769px) {
  .warehouse-part-type-panel {
    min-width: min(18rem, 88vw);
    max-width: min(22rem, 92vw);
  }

  .warehouse-part-type-panel .combo-options {
    max-height: 14rem;
  }
}

.warehouse-search {
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.25;
  background: #fafbfc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.warehouse-search:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
  background: white;
}

.warehouse-filters .filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.filter-pill {
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-pill:hover {
  border-color: #bfdbfe;
  color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.warehouse-table-panel {
  margin-top: 0;
}

.inventory-table {
  min-width: 980px;
}

#warehouseTable.inventory-table th,
#warehouseTable.inventory-table td {
  text-align: left;
  vertical-align: top;
}

#warehouseTable.inventory-table .card-metric-value,
#warehouseTable.inventory-table .part-number,
#warehouseTable.inventory-table .badge,
#warehouseTable.inventory-table .fitment-count,
#warehouseTable.inventory-table .mapping-count-pill {
  text-align: left;
}

/* Mobile-only grid row break — must not participate in desktop table columns */
@media (min-width: 769px) {
  .part-card-row .part-card-metrics-break,
  #warehouseTable tr.inventory-row .inventory-metrics-break,
  #llmTable tr.llm-result-row .llm-metrics-break {
    display: none;
  }
}

.inventory-parttype-cell {
  font-size: 0.84rem;
  color: #334155;
  font-weight: 500;
  max-width: 11rem;
  line-height: 1.35;
}

.warehouse-item-name {
  display: block;
  font-weight: 600;
  line-height: 1.35;
}

.warehouse-item-code {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.mapping-count-pill,
.fitment-count {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 1.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fitment-count-has,
.mapping-count-pill {
  background: #dbeafe;
  color: #1e40af;
}

.llm-fitments-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

#llmTable .llm-fitments-view-btn.table-action-btn {
  width: 2rem;
  height: 2rem;
}

#llmTable .llm-fitments-count-btn,
#warehouseTable .inventory-fitment-count-btn {
  border: none;
  cursor: pointer;
  font: inherit;
}

#llmTable .llm-fitments-count-btn.is-loading {
  opacity: 0.7;
  min-width: 2rem;
}

#llmTable .llm-fitments-count-btn:hover,
#llmTable .llm-fitments-count-btn:focus-visible,
#warehouseTable .inventory-fitment-count-btn:hover,
#warehouseTable .inventory-fitment-count-btn:focus-visible {
  filter: brightness(0.96);
  outline: none;
}

.source-chip {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
}

.ingest-chip {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

.ingest-success { background: #d1fae5; color: #065f46; }
.ingest-not_found { background: #fef3c7; color: #92400e; }
.ingest-error { background: #fee2e2; color: #991b1b; }

.warehouse-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.warehouse-scroll-sentinel {
  min-height: 2.75rem;
  padding: 0.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.warehouse-scroll-sentinel.is-loading::after {
  content: 'Loading more inventory…';
}

.inventory-brand-cell {
  font-size: 0.84rem;
  color: #9a3412;
  font-weight: 600;
  white-space: nowrap;
}

.inventory-row {
  animation: catalogue-card-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--card-delay, 0s);
}

.inventory-card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.warehouse-actions {
  text-align: left;
  white-space: nowrap;
  width: 1%;
}

.inventory-actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: left;
}

.inventory-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.inventory-row-actions .copy-btn {
  margin-left: 0;
  width: 2rem;
  height: 2rem;
  font-size: 0.72rem;
  border-radius: 8px;
}

#warehouseTable tbody tr.inventory-row td.inventory-actions-cell {
  vertical-align: middle;
}

#warehouseTable tbody tr.inventory-row.data-row:nth-child(even) {
  background: #fafbfd;
}

#warehouseTable tbody tr.inventory-row.data-row:nth-child(even) td,
#warehouseTable tbody tr.inventory-row.data-row:hover td {
  background: transparent;
}

#warehouseTable tbody tr.inventory-row.data-row:hover {
  background: #eef4ff;
}

.inventory-table th:last-child {
  width: 1%;
  white-space: nowrap;
}

.table-action-toolbar {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  gap: 0.35rem;
}

.table-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.table-action-icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

.table-action-btn:hover,
.table-action-btn:focus-visible {
  border-color: #bfdbfe;
  background: #eef4ff;
  color: var(--primary);
  outline: none;
  box-shadow: 0 1px 4px rgba(26, 86, 219, 0.08);
}

.table-action-btn.is-loading {
  gap: 0;
  color: var(--primary);
  border-color: #bfdbfe;
  background: #eef4ff;
}

.table-action-btn.is-loading .btn-spinner {
  width: 0.9rem;
  height: 0.9rem;
}

.table-action-btn-view:hover,
.table-action-btn-view:focus-visible {
  color: #1d4ed8;
}

.table-action-btn-map:hover,
.table-action-btn-map:focus-visible {
  color: #047857;
}

.table-action-btn-catalogue:hover,
.table-action-btn-catalogue:focus-visible {
  color: #b45309;
}

.table-action-btn-update-part-number:hover,
.table-action-btn-update-part-number:focus-visible {
  color: #7c3aed;
}

.side-drawer-panel--sm {
  width: min(400px, 100vw);
}

.side-drawer-panel--md {
  width: min(460px, 100vw);
}

.side-drawer--compact .side-drawer-header {
  padding: 0.7rem 0.85rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top, 0px));
  padding-left: calc(0.85rem + env(safe-area-inset-left, 0px));
  padding-right: calc(0.85rem + env(safe-area-inset-right, 0px));
}

.side-drawer--compact .side-drawer-title {
  font-size: 0.95rem;
}

.side-drawer--compact .side-drawer-subtitle {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
}

.side-drawer--compact .side-drawer-body {
  padding: 0.7rem 0.85rem 0.75rem;
  gap: 0.55rem;
}

.side-drawer-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.edit-part-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.edit-part-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.edit-part-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.edit-part-input:focus {
  outline: none;
  border-color: #93b4f5;
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.12);
}

.edit-part-actions-card {
  margin-top: 0.55rem;
  padding: 0.45rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.edit-part-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.edit-part-action-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
  border: 1px solid #d5dee8;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.edit-part-action-btn:hover {
  border-color: #93b4f5;
  background: #f8fbff;
}

.edit-part-action-btn:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.15);
}

.edit-part-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.edit-part-action-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 6px;
  background: rgba(26, 86, 219, 0.08);
  color: var(--primary);
}

.edit-part-action-btn-catalogue .edit-part-action-icon {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

.edit-part-action-icon svg {
  width: 0.8rem;
  height: 0.8rem;
}

.edit-part-action-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-part-hints {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.edit-part-hints:not(:has(.edit-part-feedback:not([hidden]))) {
  display: none;
}

.edit-part-feedback {
  margin: 0;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  line-height: 1.3;
}

.edit-part-extract-hint.is-success {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
}

.edit-part-extract-hint.is-warning {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.side-drawer--compact .side-drawer-footer {
  padding: 0.55rem 0.85rem 0.7rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.side-drawer--compact .side-drawer-footer .primary-btn,
.side-drawer--compact .side-drawer-footer .secondary {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

@media (max-width: 360px) {
  .edit-part-action-label {
    font-size: 0.68rem;
  }
}

#llmTable tr.llm-result-row .cell-llm-actions {
  white-space: nowrap;
}

/* Side drawers (view mappings + manual map)
   Mobile: position:fixed body lock (top set in sideDrawer.js) stops iOS from
   rubber-banding the page behind and stealing drawer touch scroll. */
body.drawer-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.side-drawer {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  justify-content: flex-end;
  overscroll-behavior: none;
}

.side-drawer.hidden {
  display: none;
}

.side-drawer--raised {
  z-index: 2110;
}

.side-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  animation: drawer-fade-in 0.25s ease;
  touch-action: none;
}

.side-drawer-panel {
  position: relative;
  width: min(480px, 100vw);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  background: #ffffff;
  box-shadow: -10px 0 36px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  animation: drawer-slide-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  isolation: isolate;
  overscroll-behavior: contain;
  /* Explicit: ancestors must not leave an effective touch-action:none. */
  touch-action: manipulation;
}

/* Solid white fill in the notch / status-bar zone (matches stuck mode-bar) */
.side-drawer-panel::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  height: env(safe-area-inset-top, 0px);
  background: #ffffff;
  pointer-events: none;
}

.side-drawer-panel--lg {
  width: min(520px, 100vw);
}

.side-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.1rem 1.2rem;
  padding-top: calc(1.1rem + env(safe-area-inset-top, 0px));
  padding-left: calc(1.2rem + env(safe-area-inset-left, 0px));
  padding-right: calc(1.2rem + env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.side-drawer-header-text {
  flex: 1;
  min-width: 0;
}

.side-drawer-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.35;
  color: var(--text);
}

.side-drawer-title .drawer-part-pn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: #1e40af;
  word-break: break-all;
}

.side-drawer-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.drawer-part-chip {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #dbeafe;
}

.drawer-part-pn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #1e40af;
  word-break: break-all;
}

.drawer-part-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.drawer-part-stock {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.74rem;
  font-weight: 700;
}

.side-drawer-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: none;
  background: #eef2f7;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  transition: background 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.side-drawer-close-icon {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.side-drawer-close:hover {
  background: #e2e8f0;
}

.side-drawer-body {
  flex: 1 1 auto;
  /* Critical for flex children: without this, overflow-y never engages on mobile. */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.2rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* pan-y alone blocks iOS pinch-zoom; allow pinch so users can zoom back out. */
  touch-action: manipulation;
}

.mapping-drawer-body {
  gap: 1.25rem;
}

.mapping-drawer-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.mapping-summary-chip {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 0.82rem;
}

.mapping-summary-chip.in-stock {
  background: #d1fae5;
  color: #065f46;
}

.mapping-summary-chip.out-stock {
  background: #fef3c7;
  color: #92400e;
}

.mapping-drawer-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.mapping-drawer-section-compact {
  margin-bottom: 0.75rem;
}

.mapping-drawer-section-compact h3 {
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
}

.mapping-drawer-ingest-empty {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
}

.ingest-compact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ingest-compact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.2;
}

.ingest-compact-chip strong {
  font-weight: 700;
  text-transform: lowercase;
}

.ingest-compact-when {
  color: var(--muted);
  font-size: 0.68rem;
}

.badge-compact {
  padding: 0.05rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: lowercase;
}

.ingest-log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ingest-log-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.mapping-fitment-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mapping-fitment-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mapping-fitment-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 4px 14px rgba(26, 86, 219, 0.08);
}

.mapping-fitment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mapping-fitment-head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mapping-fitment-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mapping-fitment-delete:hover,
.mapping-fitment-delete:focus-visible {
  color: var(--danger);
  background: #fef2f2;
  border-color: #fecaca;
}

.mapping-fitment-delete:disabled,
.mapping-fitment-delete.is-busy {
  opacity: 0.45;
  cursor: not-allowed;
}

.mapping-fitment-delete-icon {
  width: 1rem;
  height: 1rem;
}

.mapping-fitment-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.mapping-fitment-detail {
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.mapping-fitment-notes {
  font-size: 0.78rem;
  margin-top: 0.35rem;
}

.mapping-drawer-empty {
  color: var(--muted);
  padding: 1rem 0;
}

@keyframes drawer-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes drawer-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Manual map drawer */
.manual-map-part-meta[hidden] {
  display: none !important;
}

.manual-map-body {
  gap: 1rem;
  padding-bottom: 0.5rem;
}

.manual-map-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fafbfc;
}

.manual-map-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.manual-map-hint {
  margin: 0;
}

.manual-map-fields-block {
  gap: 0.75rem !important;
  background: white;
}

.manual-map-fields-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
}

.manual-map-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.manual-map-field:focus-within {
  z-index: 3;
}

.manual-map-field .field-ac-wrap {
  width: 100%;
}

.manual-map-field-full {
  width: 100%;
}

.manual-map-field-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.15rem;
}

.manual-map-field-label label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.manual-map-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.35;
  background: #fafbfc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.manual-map-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
  background: white;
}

.required-tag {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}

.vehicle-ac-wrap,
.field-ac-wrap {
  position: relative;
}

.vehicle-ac-input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.35;
  background: #f8fafc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vehicle-ac-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
  background: white;
}

.vehicle-ac-results,
.field-ac-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  list-style: none;
  z-index: 6;
}

.field-ac-results-portal,
.vehicle-ac-results.field-ac-results-portal {
  position: fixed;
  right: auto;
  margin: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  padding-bottom: var(--pad-bottom-compact);
  scroll-padding-bottom: var(--pad-bottom-compact);
  box-sizing: border-box;
}

.vehicle-ac-results.hidden,
.field-ac-results.hidden {
  display: none;
}

.vehicle-ac-item,
.field-ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.vehicle-ac-item:last-child,
.field-ac-item:last-child {
  border-bottom: none;
}

.vehicle-ac-item:hover,
.vehicle-ac-item:focus,
.field-ac-item:hover,
.field-ac-item:focus {
  background: #eff6ff;
}

.field-ac-create {
  background: #f0fdf4;
}

.field-ac-create:hover {
  background: #dcfce7;
}

.field-ac-create .field-ac-meta {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #bbf7d0;
  color: #166534;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vehicle-ac-label,
.field-ac-label {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.vehicle-ac-meta,
.field-ac-meta {
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
}

.vehicle-ac-empty,
.field-ac-empty {
  padding: 0.5rem 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.vehicle-preview-card {
  border: 1px solid #bfdbfe;
  background: linear-gradient(145deg, #eff6ff, #f8fafc);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.manual-map-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.manual-map-selected-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1d4ed8;
}

.manual-map-selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 11rem;
  overflow: auto;
}

.manual-map-selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dbeafe;
}

.manual-map-selected-label {
  font-size: 0.82rem;
  line-height: 1.35;
  min-width: 0;
}

.manual-map-selected-remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.manual-map-selected-remove:hover {
  background: #dbeafe;
}

.vehicle-ac-item.is-selected {
  background: #eff6ff;
}

.vehicle-ac-item-main {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.vehicle-ac-check {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.vehicle-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.vehicle-preview-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.vehicle-preview-usage {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.vehicle-preview-clear {
  margin-top: 0.45rem;
}

.manual-map-details {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  background: #fafbfc;
}

.manual-map-details summary {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
}

.manual-map-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.manual-map-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.manual-map-grid input {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.35;
}

.manual-map-span2 {
  grid-column: 1 / -1;
}

.side-drawer-status {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  line-height: 1.4;
  background: #f8fafc;
}

.side-drawer-status.hidden {
  display: none;
}

.side-drawer-status-message {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.side-drawer-status-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.side-drawer-status-close:hover,
.side-drawer-status-close:focus-visible {
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.side-drawer-status-close-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.side-drawer-status.error {
  background: #fef2f2;
  border-bottom-color: #fecaca;
  color: #991b1b;
}

.side-drawer-status.success {
  background: #f0fdf4;
  border-bottom-color: #bbf7d0;
  color: #166534;
}

.side-drawer-status.info {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #1e40af;
}

.side-drawer-status.loading {
  background: #f8fafc;
  border-bottom-color: var(--border);
  color: var(--muted);
}

.side-drawer-status.status-enter {
  animation: status-slide-in 0.22s ease-out;
}

.side-drawer-footer {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  flex-shrink: 0;
  padding: 0.85rem 1.2rem 1.1rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, #ffffff);
}

.manual-map-field-hint.is-error {
  color: #b91c1c;
}

.manual-map-input.input-error {
  border-color: #f87171;
  box-shadow: 0 0 0 1px color-mix(in srgb, #f87171 35%, transparent);
}

.manual-map-btn {
  color: #0e7490;
  font-weight: 600;
}

.manual-map-drawer-btn {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .side-drawer-panel {
    width: 100vw;
    max-width: 100vw;
    /* Prefer dynamic viewport so address-bar show/hide does not clip the scroll area. */
    height: 100dvh;
    max-height: 100dvh;
  }

  /* Portaled AC lists sit on body while a drawer is open — keep pinch/scroll usable. */
  body.drawer-open .field-ac-results-portal,
  body.drawer-open .vehicle-ac-results.field-ac-results-portal {
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
  }

  .side-drawer-header {
    padding: 1rem 1rem 0.95rem;
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
  }

  .side-drawer--compact .side-drawer-header {
    padding: 0.85rem 1rem 0.8rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
  }

  .side-drawer-body {
    padding: 0.9rem 1rem 1.1rem;
  }

  /* Mappings / details drawers without a visible footer need home-indicator inset. */
  .side-drawer-panel:not(:has(.side-drawer-footer:not([hidden]))) .side-drawer-body {
    padding-bottom: var(--pad-bottom-sheet);
  }

  .side-drawer-footer {
    padding: 0.75rem 1rem var(--pad-bottom-footer);
    flex-direction: column-reverse;
  }

  .side-drawer-footer button {
    width: 100%;
  }

  .manual-map-grid,
  .manual-map-fields-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .side-drawer-panel {
    border-left: 1px solid var(--border);
  }
}

@media (max-width: 900px) {
  .mode-tab-label {
    font-size: 0.78rem;
  }
}

@media (max-width: 768px) {
  .warehouse-card {
    padding: 0.6rem 0.7rem;
    gap: 0.4rem;
  }

  .warehouse-overview {
    gap: 0.4rem;
  }

  .warehouse-overview-top {
    gap: 0.25rem 0.5rem;
  }

  .warehouse-stat {
    padding: 0.18rem 0.48rem 0.18rem 0.4rem;
  }

  .warehouse-stat-value {
    font-size: 0.78rem;
  }

  .warehouse-stat-label {
    font-size: 0.64rem;
  }

  .warehouse-meta {
    width: 100%;
    font-size: 0.68rem;
  }

  .warehouse-toolbar {
    gap: 0.35rem;
  }

  .warehouse-search {
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 16px;
  }

  .warehouse-filter-row {
    align-items: center;
    gap: 0.28rem;
  }

  .warehouse-part-type-filter .warehouse-part-type-trigger.combo-trigger {
    min-height: 0;
    height: auto;
    padding: 0.28rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.15;
  }

  .warehouse-part-type-trigger .combo-chevron {
    font-size: 0.55rem;
    line-height: 1;
  }

  /* Match vehicle-search part-type bottom sheet on mobile. */
  .warehouse-part-type-panel.combo-panel-portal,
  .warehouse-part-type-filter.open .warehouse-part-type-panel {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .warehouse-part-type-panel.combo-panel-portal .combo-options,
  .warehouse-part-type-filter.open .warehouse-part-type-panel .combo-options {
    max-height: none;
  }

  .warehouse-filters .filter-pill {
    min-height: 0;
    padding: 0.28rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.15;
  }

  .warehouse-table-panel .results-table-scroll,
  .warehouse-table-panel .mobile-results-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0.4rem 0.45rem;
    padding-bottom: var(--pad-bottom-list);
    scroll-padding-bottom: var(--pad-bottom-list);
  }

  #warehouseTable tbody {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
  }

  .inventory-table {
    min-width: 0;
    width: 100%;
  }

  #warehouseTable.responsive-table thead {
    display: none;
  }

  #warehouseTable.responsive-table tbody tr.inventory-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.16rem 0.32rem;
    padding: 0.38rem 0.42rem;
    margin-bottom: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    align-items: start;
  }

  #warehouseTable.responsive-table tbody tr.inventory-row > td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }

  #warehouseTable tr.inventory-row .inventory-image-cell {
    order: 0;
    grid-column: 1 / 2;
    align-self: start;
  }

  #warehouseTable tr.inventory-row .inventory-image-cell .catalogue-card-label {
    display: none;
  }

  #warehouseTable tr.inventory-row .inventory-image-cell .part-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
  }

  #warehouseTable tr.inventory-row .inventory-item-cell {
    grid-column: 2 / -1;
    order: 1;
    margin-bottom: 0;
  }

  #warehouseTable tr.inventory-row .inventory-part-cell {
    order: 2;
    grid-column: span 2;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
  }

  #warehouseTable tr.inventory-row .inventory-parttype-cell {
    order: 3;
    color: #475569;
  }

  #warehouseTable tr.inventory-row .inventory-brand-cell {
    order: 4;
    color: #9a3412;
    font-weight: 600;
  }

  #warehouseTable tr.inventory-row .inventory-metrics-break {
    grid-column: 1 / -1;
    order: 5;
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
    visibility: hidden;
    pointer-events: none;
  }

  #warehouseTable tr.inventory-row .inventory-stock-cell {
    order: 6;
    position: relative;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
  }

  #warehouseTable tr.inventory-row .inventory-stock-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -0.42rem;
    right: -0.42rem;
    border-top: 1px solid #f1f5f9;
  }

  #warehouseTable tr.inventory-row .inventory-fitments-cell {
    order: 7;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
  }

  #warehouseTable tr.inventory-row .inventory-mrp-cell {
    order: 8;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
  }

  #warehouseTable tr.inventory-row .inventory-sales-cell {
    order: 9;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
    color: var(--success);
    font-weight: 700;
  }

  #warehouseTable tr.inventory-row .inventory-purchase-cell {
    order: 10;
    padding-top: 0.28rem;
    margin-top: 0.04rem;
    color: #334155;
  }

  #warehouseTable tr.inventory-row .inventory-stock-cell,
  #warehouseTable tr.inventory-row .inventory-fitments-cell,
  #warehouseTable tr.inventory-row .inventory-mrp-cell,
  #warehouseTable tr.inventory-row .inventory-sales-cell,
  #warehouseTable tr.inventory-row .inventory-purchase-cell {
    align-self: start;
    border: none;
    background: transparent;
    white-space: normal;
    font-size: inherit;
    font-weight: 600;
    color: inherit;
  }

  #warehouseTable tr.inventory-row .inventory-actions-cell {
    grid-column: 1 / -1;
    order: 11;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0.18rem;
    margin-top: 0.06rem;
    border-top: 1px solid #f1f5f9;
    width: 100%;
    align-self: stretch;
    overflow: visible;
  }

  #warehouseTable.responsive-table tbody td {
    padding: 0;
    border: none;
  }

  #warehouseTable.responsive-table tbody td::before {
    display: none;
  }

  #warehouseTable tr.inventory-row .catalogue-card-label {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 0.04rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    line-height: 1.05;
  }

  #warehouseTable tr.inventory-row .card-metric-value:not(.fitment-count),
  #warehouseTable tr.inventory-row .part-number {
    display: block;
    width: 100%;
    font-size: 0.68rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }

  #warehouseTable tr.inventory-row .inventory-part-cell .catalogue-card-label {
    display: inline;
    width: auto;
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  #warehouseTable tr.inventory-row .inventory-part-cell .part-number {
    display: inline-block;
    width: auto;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
  }

  #warehouseTable tr.inventory-row .inventory-part-cell .part-number::-webkit-scrollbar {
    display: none;
  }

  #warehouseTable tr.inventory-row .inventory-stock-cell .badge {
    margin-top: 0;
  }

  /* Keep desktop fitment chip styling on mobile (do not flatten to plain text). */
  #warehouseTable tr.inventory-row .inventory-fitments-cell .fitment-count,
  #warehouseTable tr.inventory-row .inventory-fitments-cell .inventory-fitment-count-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 1.75rem;
    max-width: 100%;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
    word-break: normal;
  }

  #warehouseTable tr.inventory-row .inventory-fitments-cell .fitment-count-has {
    background: #dbeafe;
    color: #1e40af;
  }

  #warehouseTable tbody tr.inventory-row.data-row:hover td {
    background: transparent;
  }

  #warehouseTable tbody tr.inventory-row.data-row:hover {
    background: #f8fbff;
    border-color: #dbeafe;
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.08);
  }

  #warehouseTable tr.inventory-row .inventory-row-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 0.28rem;
  }

  #warehouseTable tr.inventory-row .inventory-row-actions .copy-btn {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.58rem;
    flex-shrink: 0;
  }

  #warehouseTable tr.inventory-row .warehouse-item-name {
    display: block;
    font-size: 0.7rem;
    line-height: 1.25;
    margin-bottom: 0.02rem;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  #warehouseTable tr.inventory-row .warehouse-item-code {
    display: inline;
    margin-left: 0.2rem;
    font-size: 0.56rem;
  }

  #warehouseTable tr.inventory-row .inventory-card-tags {
    gap: 0.16rem 0.24rem;
  }

  #warehouseTable tr.inventory-row .table-action-toolbar {
    width: auto;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.2rem;
  }

  #warehouseTable tr.inventory-row .table-action-btn {
    width: 1.6rem;
    height: 1.6rem;
  }

  #warehouseTable tr.inventory-row .badge,
  #warehouseTable tr.inventory-row .mapping-count-pill {
    font-size: 0.58rem;
    padding: 0.06rem 0.3rem;
  }

  #warehouseTable tr.inventory-row .source-chip {
    font-size: 0.6rem;
    padding: 0.06rem 0.28rem;
  }
}

/* --- UI polish --- */

.empty-search-state {
  padding: 1.5rem 1rem;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.empty-search-title {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.empty-search-reason {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.sheet-match-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.ingest-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: 0.25rem;
}

.ingest-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.ingest-badge.ingest-motrparts {
  background: #e0e7ff;
  color: #3730a3;
}

.ingest-badge.ingest-boodmo {
  background: #fce7f3;
  color: #9d174d;
}

.search-stock-btn {
  font-size: 0.8rem;
  white-space: nowrap;
  font-weight: 600;
}

/* ========== Unified UI polish (controls, empty, feedback, thumbs) ========== */

.filter-pill,
.warehouse-filters .filter-pill,
.warehouse-part-type-trigger.combo-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--chip-height);
  height: var(--chip-height);
  padding: var(--chip-pad-y) var(--chip-pad-x);
  font-size: var(--chip-font);
  font-weight: 600;
  line-height: 1.2;
  border-radius: 999px;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.filter-pill:focus-visible,
.warehouse-part-type-trigger.combo-trigger:focus-visible,
.warehouse-action-btn.icon-btn:focus-visible,
.table-action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2);
  border-color: #93c5fd;
}

.warehouse-search,
.vehicle-search-form input:not(.combo-search),
.vehicle-search-form select,
.vehicle-search-form .combo-trigger:not(.warehouse-part-type-trigger),
.chassis-input {
  min-height: var(--control-height);
}

.warehouse-action-btn.icon-btn {
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  min-height: var(--control-height-sm);
}

.table-action-btn {
  width: 2.1rem;
  height: 2.1rem;
  min-width: 2.1rem;
}

.part-thumb,
.online-part-image {
  width: var(--thumb-size);
  height: var(--thumb-size);
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
}

.status {
  z-index: var(--z-toast);
}

.status.is-loading {
  border-color: #93c5fd;
}

.status.error {
  box-shadow: 0 8px 24px rgba(185, 28, 28, 0.12);
}

.warehouse-empty.empty-search-state {
  margin: var(--space-3) 0;
  padding: var(--space-5) var(--space-4);
}

.warehouse-empty[hidden],
.warehouse-empty.hidden {
  display: none !important;
}

.online-reg-fallback-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  background: #fffbeb;
  color: #b45309;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.online-reg-fallback-info[hidden] {
  display: none !important;
}

.online-reg-fallback-info svg {
  width: 0.85rem;
  height: 0.85rem;
  display: block;
}

.online-reg-fallback-info:hover,
.online-reg-fallback-info:focus-visible {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  outline: none;
}

.online-reg-vehicle.has-variant-fallback {
  border-left: 3px solid #f59e0b;
  padding-left: 0.45rem;
}

.vehicle-search-grid {
  gap: 0.3rem;
}

.vehicle-search-filters {
  gap: 0.3rem;
  padding-top: 0.05rem;
}

[data-flow-panel="vehicle"] .vehicle-search-actions-row {
  margin-top: 0.28rem;
}

.search-flow-panel[data-flow-panel="maruti"] {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Vehicle Search form — denser controls for both Maruti + By vehicle */
#searchCard.card {
  padding: 0.65rem 0.8rem;
}

#searchCard .search-card-title {
  font-size: 0.95rem;
}

#searchCard .search-card-body-inner > form {
  margin-top: 0.25rem;
}

#searchCard .vehicle-search-form {
  gap: 0.3rem;
}

#searchCard .search-flow {
  gap: 0.35rem;
}

#searchCard .search-flow-tabs {
  gap: 0.2rem;
  padding: 0.15rem;
}

#searchCard .search-flow-tab {
  font-size: 0.78rem;
  padding: 0.42rem 0.85rem;
}

#searchCard .chassis-input-label,
#searchCard .vehicle-search-form label,
#searchCard .online-reg-products .combo-field-label {
  gap: 0.2rem;
  font-size: 0.75rem;
}

#searchCard .vehicle-search-form input:not(.combo-search),
#searchCard .vehicle-search-form select,
#searchCard .vehicle-search-form .combo-trigger,
#searchCard .chassis-input {
  padding: 0.42rem 0.55rem;
  font-size: 0.9rem;
  min-height: 2.25rem;
  border-radius: 8px;
}

#searchCard .chassis-status {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
}

#searchCard .online-reg-vehicle {
  margin-top: 0.08rem;
}

#searchCard .online-reg-vehicle-summary {
  font-size: 0.66rem;
}

#searchCard .online-reg-catalog {
  margin-top: 0.3rem;
  gap: 0.35rem;
}

#searchCard .vehicle-search-grid {
  gap: 0.3rem;
}

#searchCard .vehicle-search-filters {
  gap: 0.3rem;
  padding-top: 0.05rem;
}

#searchCard .variant-picker {
  gap: 0.35rem;
  min-height: 2.25rem;
}

#searchCard .variant-pill {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
}

#searchCard .vehicle-search-actions button,
#searchCard .online-form-actions .primary-btn,
#searchCard #onlinePartsSearchBtn {
  min-height: 2.25rem;
  padding: 0.42rem 1.1rem;
  font-size: 0.9rem;
}

#searchCard .online-form-actions.search-footer,
#searchCard .vehicle-search-actions.search-footer {
  margin-top: 0.1rem;
  padding: 0;
  border: none;
  border-top: none;
  box-shadow: none;
  background: none;
}

/* Online card — mirror vehicle search density */
#onlineCard .search-card-title {
  font-size: 0.95rem;
}

#onlineCard .search-flow {
  gap: 0.35rem;
}

#onlineCard .search-flow-tabs {
  gap: 0.2rem;
  padding: 0.15rem;
}

#onlineCard .search-flow-tab {
  font-size: 0.78rem;
  padding: 0.42rem 0.85rem;
}

#onlineCard .online-search-stack,
#onlineCard .online-motrparts-stack {
  gap: 0.3rem;
}

#onlineCard .lookup-source-legend,
#onlineCard .online-query-label,
#onlineCard .combo-dropdown-label,
#onlineCard .combo-field-label {
  gap: 0.2rem;
  font-size: 0.75rem;
}

#onlineCard .lookup-source-legend {
  margin: 0 0 0.22rem;
}

#onlineCard .lookup-source-group {
  gap: 0.3rem;
}

#onlineCard .lookup-source-card {
  min-height: 2.25rem;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  box-shadow: none;
}

#onlineCard .lookup-source-name {
  font-size: 0.78rem;
}

#onlineCard .online-query-label input,
#onlineCard .combo-trigger,
#onlineCard .online-ac-wrap input {
  padding: 0.42rem 0.55rem;
  font-size: 0.9rem;
  min-height: 2.25rem;
  border-radius: 8px;
}

#onlineCard .online-form-actions .primary-btn,
#onlineCard #motrpartsSearchBtn {
  min-height: 2.25rem;
  padding: 0.42rem 1.1rem;
  font-size: 0.9rem;
}

#onlineCard .online-form-actions.search-footer {
  margin-top: 0.75rem;
  padding: 0;
  border: none;
  border-top: none;
  box-shadow: none;
  background: none;
}

.collapsed-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

@media (max-width: 768px) {
  :root {
    --control-height: 2.75rem;
    --chip-height: 1.55rem;
    --chip-pad-y: 0.12rem;
    --chip-pad-x: 0.42rem;
    --chip-font: 0.64rem;
    --thumb-size: var(--thumb-size-sm);
  }

  .filter-pill,
  .warehouse-filters .filter-pill,
  .warehouse-part-type-filter .warehouse-part-type-trigger.combo-trigger {
    min-height: var(--chip-height);
    height: auto;
    padding: var(--chip-pad-y) var(--chip-pad-x);
    font-size: var(--chip-font);
  }

  .warehouse-action-btn.icon-btn {
    width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
  }

  .table-action-btn {
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
  }

  #warehouseTable tr.inventory-row {
    padding: 0.55rem 0.6rem;
    gap: 0.45rem;
  }

  #warehouseTable tr.inventory-row .inventory-image-cell .part-thumb {
    width: var(--thumb-size-sm);
    height: var(--thumb-size-sm);
  }

  .search-footer,
  .online-form-actions {
    z-index: var(--z-sticky);
  }

  .vehicle-search-form {
    gap: 0.28rem;
  }

  .search-flow {
    gap: 0.3rem;
  }

  .vehicle-search-grid {
    gap: 0.28rem;
  }

  [data-flow-panel="vehicle"] .vehicle-search-actions-row {
    margin-top: 0.25rem;
  }

  .search-flow-panel[data-flow-panel="maruti"] {
    gap: 0.22rem;
  }

  #searchCard.card {
    padding: 0.55rem 0.7rem;
  }

  .mode-tab {
    font-size: var(--text-xs);
  }

  .warehouse-desktop-title {
    font-size: var(--text-md);
  }
}

@media (min-width: 769px) {
  .app-sidebar .mode-tab.active {
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .warehouse-filter-row {
    gap: var(--space-2);
  }
}
