* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --primary: #1a56db;
  --primary-hover: #1446b8;
  --border: #dde3ea;
  --danger: #c81e1e;
  --success: #057a55;
  --warning: #c27803;
}

html {
  overflow-x: clip;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
}

body > header {
  background: linear-gradient(135deg, #1a56db, #0e3a8f);
  color: white;
  padding: 1.5rem 2rem;
}

body > header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  opacity: 0.85;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.mode-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.mode-bar {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
}

.mode-bar-three {
  grid-template-columns: repeat(3, 1fr);
}

.mode-bar-four {
  grid-template-columns: repeat(4, 1fr);
}

.mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 52px;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #eef2f7;
  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:hover {
  background: #e8edf5;
  color: var(--text);
}

.mode-tab.active {
  background: white;
  color: var(--primary);
  border-color: #bfdbfe;
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.12);
}

.mode-tab:active {
  transform: scale(0.98);
}

.mode-tab-label {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.mode-tab-desc {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0.85;
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
}

.mode-panel.hidden {
  display: none;
}

main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  overflow-x: clip;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  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;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  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.5rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.combo-panel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.combo-panel-footer {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

button.small {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.combo-options-multi li.combo-option-check {
  padding: 0;
}

.combo-option-check label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  flex-direction: row;
  line-height: 1.35;
}

.combo-option-check label:hover {
  background: #e8f0fe;
}

.combo-option-check input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  min-height: 1.05rem;
  max-width: 1.05rem;
  margin: 0;
  padding: 0;
  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;
}

@media (min-width: 769px) {
  #llmTable {
    min-width: 960px;
  }

  #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.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.combo-options {
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.combo-options li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
}

.combo-options li .item-category {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.1rem;
}

.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.4rem 0.75rem 0.2rem;
  font-size: 0.72rem;
  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;
}

.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) {
  .search-card-body,
  .search-card,
  .lookup-card,
  .warehouse-card,
  .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;
}

.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;
}

.brand-dropdown .combo-trigger {
  min-height: 2.75rem;
}

.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;
}

.brand-panel {
  width: 100%;
}

.brand-options {
  max-height: 300px;
}

.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: all 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;
}

.brand-footer {
  justify-content: space-between;
  align-items: center;
}

.footer-summary {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

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-category {
  font-size: 0.68rem;
  opacity: 0.75;
  font-weight: 400;
}

.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;
}

.brand-option-check .brand-type-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  margin-left: 0;
  font-weight: 600;
  line-height: 1.2;
}

.brand-type-tag.oem {
  background: #def7ec;
  color: #046c4e;
}

.brand-type-tag.aftermarket {
  background: #fef3c7;
  color: #92400e;
}

.brand-type-tag.batteries {
  background: #ede9fe;
  color: #5b21b6;
}

.brand-type-tag.indian {
  background: #ffe4e6;
  color: #9f1239;
}

.brand-type-tag.lubricants {
  background: #e0f2fe;
  color: #075985;
}

.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;
}

.brand-option-check label {
  width: 100%;
}

.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: all 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);
}

.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: all 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: all 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;
}

.lookup-results-compact .lookup-results-meta {
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
}

.lookup-part-summary {
  margin-bottom: 0.5rem;
}

.lookup-summary-compact {
  padding: 0.5rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.lookup-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.lookup-part-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  color: #0f172a;
  min-width: 0;
}

.lookup-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.lookup-chip {
  display: inline-block;
  padding: 0.1rem 0.38rem;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.lookup-chip-pn {
  background: #eef2ff;
  color: #4338ca;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
}

.lookup-chip-alt {
  background: #f8fafc;
  color: var(--muted);
}

.lookup-summary-desc,
.lookup-summary-notes {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
}

#partLookupTable {
  min-width: 620px;
}

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 {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.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.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;
}

.online-catalogue-card {
  border-color: #c7d2fe;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f0f9ff 100%);
}

.online-hint {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.online-search-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.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.65rem;
  padding: 0.55rem 0.7rem;
  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-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: 1rem;
}

.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-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):hover .online-img-hover-preview,
  .online-img-preview-wrap:not(.online-img-preview-wrap-suggest):focus-within .online-img-hover-preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
  }
}

.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: calc(1rem + env(safe-area-inset-bottom));
}

.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: absolute;
  top: -0.7rem;
  right: -0.7rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  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;
  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 - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  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-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-inv-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid transparent;
}

.online-inv-chip-instock {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.online-inv-chip-outstock {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.online-inv-chip-missing {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.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;
}

.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(440px, 58vh);
  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;
}

.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;
}

.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;
}

@media (max-width: 768px) {
  :root {
    --mode-bar-height: 2.85rem;
  }

  body {
    -webkit-tap-highlight-color: transparent;
  }

  body > header {
    padding: 0.4rem 0.75rem;
    padding-top: calc(0.4rem + env(safe-area-inset-top));
  }

  body > header h1 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .subtitle {
    display: none;
  }

  .mode-bar {
    padding: 0.35rem 0.5rem;
    gap: 0.25rem;
  }

  .mode-tab {
    min-height: 0;
    padding: 0.38rem 0.2rem;
    border-radius: 8px;
    gap: 0;
  }

  .mode-tab-label {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
  }

  .mode-tab-desc {
    display: none;
  }

  @media (max-width: 400px) {
    :root {
      --mode-bar-height: 2.65rem;
    }

    .mode-tab-label {
      font-size: 0.66rem;
    }
  }

  main {
    padding: 0.85rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    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,
  .lookup-card .search-card-body,
  .warehouse-card .search-card-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .search-card.collapsed .search-card-body,
  .lookup-card.collapsed .search-card-body,
  .online-catalogue-card.collapsed .search-card-body,
  .warehouse-card.collapsed .search-card-body {
    grid-template-rows: 0fr;
  }

  .search-card-body-inner {
    overflow-x: clip;
    overflow-y: visible;
    min-height: 0;
    width: 100%;
  }

  .search-card.collapsed .search-card-body-inner,
  .lookup-card.collapsed .search-card-body-inner,
  .online-catalogue-card.collapsed .search-card-body-inner,
  .warehouse-card.collapsed .search-card-body-inner {
    overflow: hidden;
  }

  .search-card,
  .lookup-card,
  .warehouse-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);
  }

  .search-card.collapsed .search-collapse-summary.is-visible,
  .lookup-card.collapsed .search-collapse-summary.is-visible,
  .online-catalogue-card.collapsed .search-collapse-summary.is-visible,
  .warehouse-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);
  }

  .search-card.collapsed .search-collapse-toggle:active .search-collapse-chevron,
  .lookup-card.collapsed .search-collapse-toggle:active .search-collapse-chevron,
  .online-catalogue-card.collapsed .search-collapse-toggle:active .search-collapse-chevron,
  .warehouse-card.collapsed .search-collapse-toggle:active .search-collapse-chevron {
    transform: rotate(-90deg) scale(0.92);
  }

  .search-card.collapsed .search-collapse-chevron,
  .lookup-card.collapsed .search-collapse-chevron,
  .online-catalogue-card.collapsed .search-collapse-chevron,
  .warehouse-card.collapsed .search-collapse-chevron {
    transform: rotate(-90deg);
    box-shadow: 0 1px 4px rgba(26, 86, 219, 0.15);
  }

  .online-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 0.75rem 0 0;
    padding: 0.65rem 0 calc(0.65rem + env(safe-area-inset-bottom));
    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);
    backdrop-filter: blur(8px);
  }

  .online-form-actions button {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .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.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 {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-model {
    background: #ecfdf5;
    color: #047857;
    font-weight: 600;
  }

  #onlineVehiclesTable tr.online-vehicle-row .cell-notes {
    flex: 1 1 100%;
    background: transparent;
    padding: 0.15rem 0 0;
    font-size: 0.66rem;
    color: var(--muted);
  }

  .search-card.collapsed,
  .lookup-card.collapsed,
  .online-catalogue-card.collapsed,
  .warehouse-card.collapsed {
    position: sticky;
    top: var(--mode-bar-height, 4.5rem);
    z-index: 30;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    border-color: #dbeafe;
  }

  .search-card.collapsed .search-card-title,
  .lookup-card.collapsed .search-card-title,
  .online-catalogue-card.collapsed .search-card-title,
  .warehouse-card.collapsed .search-card-title {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
  }

  .search-card:not(.collapsed) .search-collapse-summary,
  .lookup-card:not(.collapsed) .search-collapse-summary,
  .warehouse-card:not(.collapsed) .search-collapse-summary {
    pointer-events: none;
  }

  .warehouse-desktop-title {
    display: none !important;
  }

  .warehouse-collapse-row {
    display: block;
    width: 100%;
  }

  .warehouse-collapse-row .search-collapse-toggle {
    width: 100%;
  }

  .warehouse-collapse-row .search-card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .warehouse-header-actions {
    gap: 0.4rem;
  }

  .warehouse-header-actions #warehouseSearchUnmappedBtn:not([hidden]) {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .warehouse-header-actions #warehouseRefreshBtn {
    flex: 0 0 auto;
  }

  .warehouse-card.collapsed .warehouse-card-top {
    gap: 0.35rem;
  }

  .warehouse-card.collapsed .warehouse-action-btn {
    padding: 0.32rem 0.55rem;
    font-size: 0.72rem;
  }

  .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 calc(0.65rem + env(safe-area-inset-bottom));
    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);
    backdrop-filter: blur(8px);
  }

  .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-options li,
  .combo-option-check label {
    min-height: 48px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .combo-option-check input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    min-width: 1.2rem;
    min-height: 1.2rem;
    max-width: 1.2rem;
    margin: 0;
    padding: 0;
  }

  .filter-pill {
    min-height: 36px;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
  }

  .brands-picker {
    padding: 0.85rem;
  }

  .search-footer {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 0.75rem 0 0;
    padding: 0.65rem 0 calc(0.65rem + env(safe-area-inset-bottom));
    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);
    backdrop-filter: blur(8px);
  }

  .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(78vh, 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;
  }

  .combo-dropdown.open .combo-options,
  .combo-dropdown.open .brand-options,
  .combo-panel.combo-panel-portal .combo-options,
  .combo-panel.combo-panel-portal .brand-options {
    flex: 1 1 auto;
    max-height: min(48vh, 380px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .combo-panel-footer {
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  }

  .combo-panel-footer button {
    min-height: 44px;
    min-width: 88px;
  }

  .status {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .results-card {
    padding: 0.85rem 0.75rem;
    overflow-x: clip;
    overflow-y: visible;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  }

  .results-card h2 {
    font-size: 0.95rem;
    gap: 0.35rem;
    margin-bottom: 0;
    padding-bottom: 0.5rem;
    border-bottom: none;
    flex-wrap: wrap;
  }

  .results-card .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    color: var(--muted);
    line-height: 1.3;
    width: 100%;
  }

  .catalogue-result-count {
    font-size: 0.68rem;
    margin-left: 0;
  }

  .results-table-panel {
    margin-top: 0.55rem;
    border-radius: 12px;
    border-color: #e8edf3;
    background: #f1f5f9;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow-x: clip;
    overflow-y: visible;
  }

  .results-table-scroll {
    max-height: none;
    overflow-y: auto;
    overflow-x: clip;
    margin: 0;
    padding: 0.5rem 0.45rem 0.55rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  #llmTable tbody {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }

  #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.2rem 0.35rem;
    margin-bottom: 0.4rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    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: 1fr auto;
    align-items: start;
    gap: 0.45rem 0.55rem;
    margin-bottom: 0;
    padding: 0.75rem 0.7rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
    box-shadow:
      0 2px 10px rgba(15, 23, 42, 0.06),
      0 1px 2px rgba(15, 23, 42, 0.04);
    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: 4px solid var(--success);
  }

  .responsive-table tbody tr.llm-result-row.catalogue-stock-out {
    border-left: 4px solid var(--warning);
  }

  .responsive-table tbody tr.llm-result-row.catalogue-stock-missing {
    border-left: 4px 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.78rem;
    line-height: 1.25;
  }

  .responsive-table td::before {
    display: none;
  }

  .responsive-table td.mobile-hide {
    display: none;
  }

  .responsive-table .badge {
    padding: 0.1rem 0.38rem;
    font-size: 0.62rem;
    line-height: 1.2;
  }

  .catalogue-card-label {
    display: block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.2rem;
    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.22rem 0.55rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #3730a3;
    font-size: 0.68rem;
    border: 1px solid #c7d2fe;
  }

  .catalogue-stock-badge {
    padding: 0.22rem 0.55rem;
    font-size: 0.64rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  /* 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;
  }

  #warehouseTable tr.inventory-row:has(.inventory-parttype-cell.cell-empty) .inventory-part-cell {
    grid-column: 1 / 3;
  }

  #warehouseTable tr.inventory-row:has(.inventory-brand-cell.cell-empty) .inventory-mrp-cell {
    grid-column: 2 / 4;
    justify-self: end;
  }

  #warehouseTable tr.inventory-row:has(.inventory-parttype-cell.cell-empty):has(.inventory-brand-cell.cell-empty) .inventory-part-cell {
    grid-column: 1 / 2;
  }

  #warehouseTable tr.inventory-row:has(.inventory-actions-cell.cell-empty) {
    grid-template-areas:
      "item item item"
      "part parttype stock"
      "brand brand mrp"
      "tags tags tags";
  }

  #llmTable tr.llm-result-row .cell-llm-submodel.cell-empty,
  #llmTable tr.llm-result-row .cell-llm-generation.cell-empty,
  #llmTable tr.llm-result-row .cell-llm-variant.cell-empty,
  #llmTable tr.llm-result-row .cell-llm-actions.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;
  }

  #partLookupTable tr.lookup-result-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    margin-bottom: 0.4rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  #partLookupTable tr.lookup-result-row .cell-brand,
  #partLookupTable tr.lookup-result-row .cell-make,
  #partLookupTable tr.lookup-result-row .cell-model,
  #partLookupTable tr.lookup-result-row .cell-years,
  #partLookupTable tr.lookup-result-row .cell-variant,
  #partLookupTable tr.lookup-result-row .cell-notes {
    flex: 0 0 auto;
    order: 1;
    padding: 0.12rem 0.38rem;
    border-radius: 5px;
    background: #f1f5f9;
    font-size: 0.68rem;
  }

  #partLookupTable tr.lookup-result-row .cell-notes {
    flex: 1 1 100%;
    order: 3;
    background: transparent;
    padding: 0.1rem 0 0;
    font-size: 0.66rem;
    color: var(--muted);
  }

  #partLookupTable tr.lookup-result-row .cell-brand {
    background: #fff7ed;
    color: #c2410c;
    font-weight: 600;
  }

  #partLookupTable tr.lookup-result-row .cell-make {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
  }

  #partLookupTable tr.lookup-result-row .cell-model {
    background: #ecfdf5;
    color: #047857;
    font-weight: 600;
  }

  .lookup-summary-compact {
    padding: 0.45rem 0.5rem;
  }

  .lookup-part-title {
    font-size: 0.78rem;
  }

  #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;
  }

  /* Catalogue result cards */
  #llmTable tr.llm-result-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #llmTable tr.llm-result-row .cell-llm-partno {
    order: 1;
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  }

  #llmTable tr.llm-result-row .catalogue-card-pn {
    display: block;
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-all;
    color: #312e81;
    letter-spacing: 0.03em;
  }

  #llmTable tr.llm-result-row .catalog-only {
    display: inline-flex;
    align-items: center;
    font-size: 0.58rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    font-family: inherit;
  }

  #llmTable tr.llm-result-row .cell-llm-parttype {
    order: 2;
    grid-column: 1;
    max-width: 100%;
    min-width: 0;
    align-self: center;
  }

  #llmTable tr.llm-result-row .cell-llm-brand {
    order: 4;
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
  }

  #llmTable tr.llm-result-row .catalogue-card-brand-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.45rem;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  #llmTable tr.llm-result-row .cell-llm-brand strong {
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
  }

  #llmTable tr.llm-result-row .cell-llm-brand .llm-source-badge {
    margin-left: 0;
    flex-shrink: 0;
  }

  #llmTable tr.llm-result-row .cell-llm-stock {
    order: 3;
    grid-column: 2;
    justify-self: end;
    align-self: center;
    max-width: 100%;
    padding-top: 0;
  }

  .cell-llm-vehicles {
    min-width: 0;
    max-width: 100%;
  }

  #llmTable tr.llm-result-row .cell-llm-vehicles {
    order: 5;
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.5rem 0.55rem 0.35rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px dashed #dbe3ec;
  }

  #llmTable tr.llm-result-row .catalogue-card-vehicles-inner {
    margin-top: 0.1rem;
  }

  #llmTable tr.llm-result-row .vehicle-fitment-list,
  #llmTable tr.llm-result-row .vehicle-fitment-details {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 0.74rem;
    color: #475569;
  }

  #llmTable tr.llm-result-row .vehicle-fitment-list {
    padding-left: 0.95rem;
    margin: 0;
  }

  #llmTable tr.llm-result-row .vehicle-fitment-details summary {
    padding: 0.2rem 0;
    font-size: 0.74rem;
    transition: color 0.18s ease;
  }

  #llmTable tr.llm-result-row .vehicle-fitment-details[open] .vehicle-fitment-list {
    animation: catalogue-expand-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  #llmTable tr.llm-result-row .cell-llm-match {
    order: 6;
    grid-column: 1 / -1;
    font-size: 0.68rem;
    color: var(--muted);
    padding-top: 0.15rem;
    border-top: 1px solid #e8edf3;
  }

  #llmTable tr.llm-result-row .catalogue-card-match {
    display: block;
    font-size: 0.68rem;
    line-height: 1.4;
    max-width: none;
    white-space: normal;
    word-break: break-word;
    color: #64748b;
  }

  .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.4rem 0.45rem;
    gap: 0.15rem 0.3rem;
  }

  .responsive-table tbody tr.llm-result-row {
    padding: 0.65rem 0.6rem;
    gap: 0.4rem 0.45rem;
    border-radius: 12px;
  }

  #llmTable tr.llm-result-row .catalogue-card-pn {
    font-size: 0.88rem;
  }

  #resultsTable tr.inventory-result-row .cell-title strong {
    -webkit-line-clamp: 1;
  }
}

/* Warehouse & catalogue mappings */
.warehouse-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.warehouse-card-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  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.45rem;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}

@media (min-width: 769px) {
  .warehouse-card-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .warehouse-desktop-title {
    display: block;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .warehouse-collapse-row {
    display: none;
  }

  .warehouse-header-actions {
    flex-wrap: wrap;
    width: auto;
    flex-shrink: 0;
  }
}

.warehouse-action-btn {
  white-space: nowrap;
}

.warehouse-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.warehouse-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.warehouse-stat {
  background: linear-gradient(145deg, #f8fafc, #eef2f7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.warehouse-stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.warehouse-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.warehouse-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.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 { grid-column: 1 / -1; background: #fff8eb; border-color: #fcd34d; }

.warehouse-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.warehouse-search {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  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 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.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.25rem;
}

.inventory-table {
  min-width: 980px;
}

.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 {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 700;
}

.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;
}

.inventory-brand-cell {
  font-size: 0.84rem;
  color: #9a3412;
  font-weight: 600;
  white-space: nowrap;
}

#partLookupTable .cell-brand {
  font-weight: 600;
  color: #9a3412;
}

.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: right;
  white-space: nowrap;
  width: 1%;
}

.inventory-actions-cell {
  width: 1%;
  white-space: nowrap;
}

#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-end;
  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-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;
}

.edit-part-panel {
  width: min(400px, 100vw);
}

.edit-part-drawer .side-drawer-header {
  padding: 0.7rem 0.85rem;
}

.edit-part-drawer .side-drawer-title {
  font-size: 0.95rem;
}

.edit-part-drawer .side-drawer-subtitle {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  line-height: 1.35;
}

.edit-part-drawer .side-drawer-close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  font-size: 0.95rem;
  border-radius: 8px;
}

.edit-part-drawer .side-drawer-body {
  padding: 0.7rem 0.85rem 0.75rem;
  gap: 0.55rem;
}

.edit-part-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.edit-part-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.edit-part-drawer .side-drawer-subtitle,
.edit-part-panel .side-drawer-subtitle {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
}

.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: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  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;
}

.edit-part-drawer .side-drawer-footer {
  padding: 0.55rem 0.85rem 0.7rem;
}

.edit-part-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.edit-part-footer .primary-btn,
.edit-part-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) */
body.drawer-open {
  overflow: hidden;
}

.side-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.side-drawer.hidden {
  display: none;
}

.manual-map-drawer {
  z-index: 220;
}

.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;
}

.side-drawer-panel {
  position: relative;
  width: min(480px, 100vw);
  height: 100%;
  max-height: 100dvh;
  background: white;
  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);
}

.manual-map-panel {
  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;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  flex-shrink: 0;
}

.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);
}

.mapping-drawer-title .drawer-part-pn,
.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: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  transition: background 0.2s ease;
}

.side-drawer-close:hover {
  background: #e2e8f0;
}

.side-drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.2rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  -webkit-overflow-scrolling: touch;
}

.mapping-drawer-body {
  gap: 1.25rem;
}

.mapping-drawer-summary {
  display: flex;
  flex-wrap: wrap;
  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-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.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 1fr;
  gap: 0.75rem;
  align-items: start;
}

.manual-map-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.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: inherit;
  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: inherit;
  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);
}

.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.65rem;
  padding: 0.65rem 0.8rem;
  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;
}

.vehicle-ac-label,
.field-ac-label {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.vehicle-ac-meta,
.field-ac-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.vehicle-ac-empty,
.field-ac-empty {
  padding: 0.75rem 0.9rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.vehicle-preview-card {
  border: 1px solid #bfdbfe;
  background: linear-gradient(145deg, #eff6ff, #f8fafc);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.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: inherit;
}

.manual-map-span2 {
  grid-column: 1 / -1;
}

.side-drawer-footer,
.manual-map-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-btn {
  color: #0e7490;
  font-weight: 600;
}

.manual-map-drawer-btn {
  align-self: flex-start;
}

@media (max-width: 768px) {
  .side-drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .manual-map-panel {
    width: 100vw;
  }

  .side-drawer-header {
    padding: 1rem 1rem 0.95rem;
  }

  .side-drawer-body {
    padding: 0.9rem 1rem 1.1rem;
  }

  .side-drawer-footer,
  .manual-map-footer {
    padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
  }

  .side-drawer-footer button,
  .manual-map-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-bar-three,
  .mode-bar-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mode-tab-label {
    font-size: 0.66rem;
  }

  .warehouse-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .warehouse-table-panel .results-table-scroll {
    overflow-x: visible;
  }

  .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: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "item item item"
      "part parttype stock"
      "brand brand mrp"
      "tags tags tags"
      "actions actions actions";
    gap: 0.2rem 0.35rem;
    padding: 0.55rem 0.6rem;
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    align-items: center;
  }

  #warehouseTable.responsive-table tbody td {
    display: block;
    padding: 0;
    border: none;
  }

  #warehouseTable.responsive-table tbody td::before {
    display: none;
  }

  #warehouseTable tr.inventory-row .inventory-item-cell {
    grid-area: item;
  }

  #warehouseTable tr.inventory-row .inventory-part-cell {
    grid-area: part;
    min-width: 0;
  }

  #warehouseTable tr.inventory-row .inventory-parttype-cell {
    grid-area: parttype;
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.25;
    min-width: 0;
  }

  #warehouseTable tr.inventory-row .inventory-brand-cell {
    grid-area: brand;
    font-size: 0.72rem;
    color: #9a3412;
    font-weight: 600;
    line-height: 1.25;
  }

  #warehouseTable tr.inventory-row .inventory-stock-cell {
    grid-area: stock;
    justify-self: center;
  }

  #warehouseTable tr.inventory-row .inventory-mrp-cell {
    grid-area: mrp;
    justify-self: end;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  #warehouseTable tr.inventory-row .inventory-fitments-cell {
    grid-area: tags;
    padding-top: 0.1rem;
  }

  #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-actions-cell {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0.35rem;
    margin-top: 0.15rem;
    border-top: 1px solid #f1f5f9;
    width: 100%;
    align-self: stretch;
  }

  #warehouseTable tr.inventory-row .warehouse-item-name {
    font-size: 0.84rem;
    line-height: 1.3;
  }

  #warehouseTable tr.inventory-row .warehouse-item-code {
    display: inline;
    margin-left: 0.35rem;
    font-size: 0.68rem;
  }

  #warehouseTable tr.inventory-row .part-number {
    font-size: 0.72rem;
    word-break: break-all;
  }

  #warehouseTable tr.inventory-row .inventory-card-tags {
    gap: 0.25rem 0.35rem;
  }

  #warehouseTable tr.inventory-row .table-action-toolbar {
    width: auto;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  #warehouseTable tr.inventory-row .table-action-btn {
    width: 2.15rem;
    height: 2.15rem;
  }

  #warehouseTable tr.inventory-row .inventory-actions-cell {
    overflow: visible;
  }

  #warehouseTable tr.inventory-row .badge,
  #warehouseTable tr.inventory-row .mapping-count-pill {
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
  }

  #warehouseTable tr.inventory-row .source-chip {
    font-size: 0.66rem;
    padding: 0.1rem 0.35rem;
  }

  .mapping-drawer-panel {
    width: 100vw;
  }
}
