/* ============================================================================
   ASSEMBLIES PAGE LAYOUT
============================================================================ */
.assemblies-page-wrapper {
  width: 100%;
  max-width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.assemblies-page-container {
  max-width: var(--max-width, 1400px);
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  box-sizing: border-box;
}

/* ============================================================================
   VEHICLE HEADER
============================================================================ */
.vehicle-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 24px 0;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.vehicle-header-icon {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  position: relative;
}

.vehicle-header-icon img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.vehicle-icon-placeholder {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.vehicle-header-brand-model {
  text-align: center;
  width: 100%;
  font-size: 11px;
  line-height: 1.2;
  color: #6b7280;
  margin-top: 4px;
}

.vehicle-brand {
  font-weight: 700;
  color: #374151;
  font-size: 11px;
}

.vehicle-model {
  font-size: 10px;
  color: #9ca3af;
}

.vehicle-header-description {
  flex: 1;
  min-width: 0;
}

.vehicle-description-text {
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  line-height: 1.5;
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.vehicle-header-actions {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.vehicle-header-empty {
  display: none;
  width: 100%;
  gap: 12px;
  align-items: center;
}

.vehicle-header.is-prompt .vehicle-header-empty {
  display: flex;
}

.vehicle-header.is-prompt .vehicle-header-skeleton,
.vehicle-header.is-prompt .vehicle-header-content {
  display: none !important;
}

.vehicle-header-empty-text {
  flex: 1;
  min-width: 0;
}

.vehicle-header-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  display: block;
  line-height: 1.4;
}

.vehicle-header-empty-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.vehicle-details-btn,
.vehicle-change-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid;
  white-space: nowrap;
  user-select: none;
}

.vehicle-details-btn {
  background: #ffffff;
  border-color: #3b82f6;
  color: #3b82f6;
}
.vehicle-details-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.vehicle-change-btn {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}
.vehicle-change-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.vehicle-details-btn svg,
.vehicle-change-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* ============================================================================
   ASSEMBLIES MODAL (namespaced)
============================================================================ */

/* Modal wrapper */
.fe-asm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100000;
}

/* opened by JS */
.fe-asm-modal.open {
  display: flex;
}

/* if aria-hidden stays true, force hide */
.fe-asm-modal[aria-hidden="true"] {
  display: none !important;
}

/* Backdrop */
.fe-asm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}

/* Dialog */
.fe-asm-dialog {
  position: relative;
  z-index: 1;
  width: min(980px, 96vw);
  max-height: min(82vh, 760px);
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.fe-asm-dialog-lg {
  width: min(1100px, 96vw);
}

/* You are using fe-modal-* inside the dialog, so style them scoped */
.fe-asm-modal .fe-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.fe-asm-modal .fe-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.fe-asm-modal .fe-modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 10px;
  color: #374151;
}
.fe-asm-modal .fe-modal-close:hover {
  background: #eef2f7;
}

.fe-asm-modal .fe-modal-body {
  padding: 16px;
  overflow: auto;
}

.fe-asm-modal .fe-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.fe-asm-modal .fe-modal-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-weight: 600;
}
.fe-asm-modal .fe-modal-btn:hover {
  background: #f3f4f6;
}

/* Vehicle details grid */
.fe-vehicle-details-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px 14px;
  padding: 4px;
}

.fe-vehicle-detail-row {
  display: contents;
}

.fe-vehicle-detail-key {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  padding: 8px 10px;
  border-bottom: 1px dashed #e5e7eb;
}

.fe-vehicle-detail-val {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  padding: 8px 10px;
  border-bottom: 1px dashed #e5e7eb;
}

/* ============================================================================
   ASSEMBLIES CONTROLS
============================================================================ */

/* Title + facet dropdowns + Boxes/Tree on one row */
.assemblies-controls {
  position: relative;
  display: block;
  margin-bottom: 24px;
}

.assemblies-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  min-width: 0;
}

.assemblies-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.product-groups-section {
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.product-groups-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  flex-shrink: 0;
}

.view-switcher-section {
  position: static;
  flex-shrink: 0;
  z-index: 10;
}

.assemblies-facet-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.asm-combo {
  position: relative;
  min-width: 180px;
  max-width: 240px;
}

.asm-combo-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 6px 10px 6px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  color: #111827;
}

.asm-combo.open .asm-combo-trigger,
.asm-combo-trigger:hover {
  border-color: #cbd5e1;
}

.asm-combo-value {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asm-combo-value.is-placeholder {
  color: #6b7280;
  font-weight: 500;
}

.asm-combo-caret {
  flex-shrink: 0;
  color: #6b7280;
}

.asm-combo-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(320px, 80vw);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  z-index: 40;
  overflow: hidden;
}

.asm-combo-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.asm-combo-options {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.asm-combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: #111827;
}

.asm-combo-option:hover,
.asm-combo-option.is-selected {
  background: #f3f4f6;
}

.asm-combo-option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.asm-combo-option-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asm-combo-sub {
  font-size: 11px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asm-combo-count {
  flex-shrink: 0;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 2px 7px;
}

.asm-combo-logo {
  width: 28px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.asm-combo-logo-fallback {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.asm-combo-empty {
  padding: 12px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.view-switcher {
  display: flex;
  align-items: center;
}

/* Outer pill */
.view-switcher-track {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  border-radius: 14px;
  background: #eef2f7;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  user-select: none;
}

.view-switcher-track[data-view="tree"] .view-switcher-thumb {
  transform: translateX(100%);
}
.view-switcher-track[data-view="boxes"] .view-switcher-thumb {
  transform: translateX(0%);
}

/* Sliding thumb */
.view-switcher-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 5px);
  border-radius: 14px;
  background: #ffffff;
  transition: transform 180ms ease, width 180ms ease;
  will-change: transform;
}

.view-switcher-track{
  overflow: hidden;           /* hard clip so nothing can go out */
}

.view-switcher-thumb{
  transform: translateX(0%);  /* default */
}

/* Button layout */
.view-switcher-btn {
  position: relative;
  z-index: 2; /* above thumb */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 36px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  color: #6b7280;
  transition: color 160ms ease;
  white-space: nowrap;
}

.view-switcher-btn:hover {
  color: #374151;
}

.view-switcher-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}

/* Active text color (thumb stays white) */
.view-switcher-btn.active {
  color: #111827;
}

/* Optional: subtle press */
.view-switcher-btn:active {
  transform: scale(0.98);
}

/* Mobile spacing tweak */
@media (max-width: 480px) {
  .view-switcher-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* ============================================================================
   PRODUCT GROUPS - SCROLLER (FULL WIDTH + OVERLAY ARROWS)
============================================================================ */

/* wrapper */
.product-group-scroller {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* viewport takes all space */
.product-group-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* scroll container */
#product-group-filters.product-group-filters {
  display: flex;
  align-items: stretch;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 4px 2px 8px;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* firefox hide */
}

/* hide scrollbar (webkit) */
#product-group-filters.product-group-filters::-webkit-scrollbar {
  height: 0px;
}

/* arrows overlay */
.pg-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  transition: all 0.15s ease;
  z-index: 6;
}

.pg-nav-btn:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
}

.pg-nav-btn:disabled {
  opacity: 0.25;
  pointer-events: none;
  box-shadow: none;
}

.pg-nav-left {
  left: -6px;
}

.pg-nav-right {
  right: -6px;
}

/* fade edges */
.product-group-viewport::before,
.product-group-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50px;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.product-group-viewport::before {
  left: 0;
  background: linear-gradient(to right, #f8fafc, transparent);
}

.product-group-viewport::after {
  right: 0;
  background: linear-gradient(to left, #f8fafc, transparent);
}

/* product group button */
.product-group-filter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: normal;
  text-align: center;
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  box-sizing: border-box;
  min-width: 100px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.product-group-filter-btn:hover {
  background: #f3f4f6;
}
.product-group-filter-btn.active {
  background: #ffffff;
  border-color: #f97316;
  color: #f97316;
}
.product-group-filter-btn.active .product-group-icon {
  color: #f97316;
}

.product-group-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: #6b7280;
  transition: color 0.15s ease;
}

.product-group-label {
  font-weight: 600;
  line-height: 1.2;
  word-wrap: break-word;
  max-width: 100%;
}

/* ============================================================================
   ASSEMBLIES HOSTS (Boxes + Tree)
============================================================================ */

/* Root container */
#fe-assemblies-root {
  width: 100%;
  min-width: 0;
}

/* Force only one view visible */
#fe-assemblies-root[data-view="boxes"] #fe-assemblies-tree { display: none !important; }
#fe-assemblies-root[data-view="tree"]  #fe-assemblies-boxes { display: none !important; }

/* IMPORTANT: root wrapper should not be grid */
.assemblies-grid {
  display: block !important;
  width: 100%;
}

/* Boxes host: 4 columns desktop */
#fe-assemblies-boxes.assemblies-boxes-grid {
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  align-items: stretch;
  gap: 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#fe-assemblies-boxes .assembly-card {
  width: 100%;
  min-width: 0;
}

/* 3 columns */
@media (max-width: 1400px) {
  #fe-assemblies-boxes.assemblies-boxes-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 2 columns */
@media (max-width: 1024px) {
  #fe-assemblies-boxes.assemblies-boxes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

/* 1 column */
@media (max-width: 768px) {
  #fe-assemblies-boxes.assemblies-boxes-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Tree host */
#fe-assemblies-tree {
  width: 100%;
  min-width: 0;
}

.assemblies-tree {
  width: 100%;
}

.assemblies-tree-wrap {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.assemblies-tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ============================================================================
   ASSEMBLY CARD
============================================================================ */
.assembly-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  height: 420px;                 /* adjust to taste */
  min-height: 420px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}

.assembly-card:hover {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.assembly-card-header {
  background: #e0f2fe;
  padding: 16px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.assembly-card-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #374151;
}

.assembly-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  flex: 1;
  cursor: pointer;
}

.assembly-card-body {
  flex: 1 1 auto;
  min-height: 0;                 /* CRITICAL for flex children scroll */
  overflow: auto;                /* scroll when long */
  padding: 16px;

  /* nicer scroll behavior */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Optional: subtle scrollbar style (webkit only) */
.assembly-card-body::-webkit-scrollbar {
  width: 10px;
}
.assembly-card-body::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  border: 3px solid #ffffff;
}
.assembly-card-body::-webkit-scrollbar-track {
  background: transparent;
}

.assembly-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assembly-card-empty {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
  text-align: center;
  padding: 16px 0;
}

/* ============================================================================
   ASSEMBLY LINE ITEM (Base)
============================================================================ */
.assembly-line-item {
  position: relative;
  max-width: 100%;
  overflow: hidden; /* prevents hover bg from bleeding outside */
}

.assembly-line-arrow {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: #6b7280;
  margin-right: -4px;
}

.assembly-line-icon {
  display: none !important;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #6b7280;
}

.assembly-line-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;

  border-radius: 8px;
  padding: 1px 8px;
  transition: background 120ms ease, color 120ms ease;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.assembly-line-part-number {
  flex-shrink: 0;
  padding: 4px 8px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.assembly-line-chevron {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  margin-left: auto;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.assembly-line-chevron:hover {
  background: #eff6ff;
  color: var(--primary, #1d4ed8);
}

.assembly-line-chevron svg {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}

/* ============================================================================
   NESTED CHILDREN (CRITICAL FIX)
   Goal:
   - NO pill/white backgrounds inside gray zone
   - hover does NOT spill outside the parent zone
   - child width stays inside zone
============================================================================ */

/* IMPORTANT: the LI must wrap so children UL sits below row, not to the right */
.assembly-line-item {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;          /* CRITICAL */
  padding: 5px;
  border-radius: 10px;
  transition: background 120ms ease, transform 80ms ease;
  box-sizing: border-box;
}

/* Children UL must be full-width and never drift right */
.assembly-line-item > .assembly-children-list {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;

  margin: 10px 0 0 0 !important;  /* NO left margins */
  padding: 10px 0 0 14px !important;

  border-left: 2px solid #e5e7eb;

  background: transparent !important;
  border-radius: 0 !important;
  overflow: hidden; /* clip hover inside */
  box-sizing: border-box;
}

/* Reset nested UL defaults so padding doesn't accumulate */
.assembly-children-list {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  max-width: 100%;
}

/* Child rows MUST stay full width inside zone */
.assembly-children-list > .assembly-line-item {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 8px 8px;
  border-radius: 10px;
  background: transparent !important;
  box-sizing: border-box;
  overflow: hidden;
}

/* Remove any “pill” backgrounds from names inside child zones */
.assembly-children-list .assembly-line-name {
  background: transparent !important;
  padding: 6px 6px;
  border-radius: 8px;
}

/* Hover highlight stays inside zone */
.assembly-children-list > .assembly-line-item:hover {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* Press feedback */
.assembly-children-list > .assembly-line-item:active {
  background: rgba(0, 0, 0, 0.10) !important;
  transform: translateY(1px);
}

/* Deep nesting: same full-width rule, just a softer connector */
.assembly-children-list .assembly-children-list {
  width: 100% !important;
  max-width: 100% !important;
  margin: 10px 0 0 0 !important;
  padding: 10px 0 0 14px !important;
  border-left: 2px solid #eef2f7;
  background: transparent !important;
  overflow: hidden;
  box-sizing: border-box;
}

/* Expanded parent: subtle zone highlight */
.assembly-line-item.expanded {
  background: #f1f5f9;
}

/* ============================================================================
   ROW UX: hover highlight + pressed click feedback
============================================================================ */
.assembly-line-item:hover {
  background: #f3f4f6;
}

.assembly-line-item:active {
  background: #e5e7eb;
  transform: translateY(1px);
}

.assembly-line-item:hover .assembly-line-name {
  background: rgba(255, 255, 255, 0.55);
}

.assembly-line-name:active {
  background: rgba(255, 255, 255, 0.25);
}

.assembly-line-item:hover .assembly-line-arrow {
  color: #475569;
}

.assembly-line-item:hover .assembly-line-chevron {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
}

/* ============================================================================
   NO ASSEMBLIES MESSAGE
============================================================================ */
.no-assemblies-message {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

.no-assemblies-message p {
  font-size: 16px;
  margin: 0;
}

/* ============================================================================
   RESPONSIVE
============================================================================ */
@media (max-width: 768px) {
  .assemblies-page-container {
    padding: 16px 12px;
  }

  .vehicle-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    margin: 16px 0;
  }

  .vehicle-header-content,
  .vehicle-header-empty {
    flex-direction: column;
    gap: 12px;
  }

  .vehicle-header-icon {
    width: 48px;
    height: 48px;
    align-self: flex-start;
  }

  .vehicle-header-description {
    width: 100%;
    order: 2;
    min-width: 0;
  }

  .vehicle-description-text {
    font-size: 14px;
    line-height: 1.4;
  }

  .vehicle-header-actions {
    order: 3;
    width: 100%;
    justify-content: space-between;
    margin-top: 0;
    gap: 8px;
  }

  .vehicle-details-btn,
  .vehicle-change-btn {
    padding: 8px 12px;
    font-size: 13px;
    gap: 6px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .assemblies-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .assemblies-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .assemblies-facet-filters {
    width: 100%;
  }

  .asm-combo {
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .asm-combo-panel {
    width: 100%;
  }

  .product-groups-title{
    margin: 0;
  }

  .view-switcher-section {
    position: static;
    margin-left: auto;
  }

  /* Make product groups fill container; keep arrows visible */
  .product-group-viewport {
    margin: 0 -12px;
    padding: 0 12px;
    width: calc(100% + 24px);
  }

  .product-group-filter-btn {
    width: 85px;
    height: 85px;
    padding: 8px 4px;
    font-size: 10px;
    gap: 6px;
    min-width: 85px;
  }

  .product-group-icon {
    width: 26px;
    height: 26px;
  }

  .product-groups-title {
    font-size: 16px;
    margin: 0 0 12px 0;
  }

  /* modal sizing on mobile */
  .fe-asm-dialog,
  .fe-asm-dialog-lg {
    width: min(96vw, 980px);
    max-height: 86vh;
  }

  .fe-vehicle-details-grid {
    grid-template-columns: 1fr;
  }

  /* Children indentation on mobile */
  .assembly-line-item > .assembly-children-list {
    padding-left: 12px !important;
  }

  .assembly-children-list .assembly-children-list {
    padding-left: 12px !important;
  }
}

@media (max-width: 480px) {
  .assemblies-page-container {
    padding: 12px 8px;
  }

  .vehicle-header {
    padding: 12px;
    gap: 12px;
    margin: 12px 0;
  }

  .vehicle-description-text {
    font-size: 13px;
  }

  .product-group-viewport {
    margin: 0 -8px;
    padding: 0 8px;
    width: calc(100% + 16px);
  }

  .product-group-filter-btn {
    width: 80px;
    height: 80px;
    padding: 6px 3px;
    font-size: 9px;
    gap: 5px;
    min-width: 80px;
  }

  .product-group-icon {
    width: 24px;
    height: 24px;
  }

  .product-group-label {
    font-size: 9px;
    line-height: 1.2;
  }
}

/* ============================================================================
   SKELETON LOADERS
============================================================================ */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton-base {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 4px;
}

.vehicle-header-skeleton {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

@media (max-width: 768px) {
  .vehicle-header-skeleton {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .vehicle-header-skeleton .skeleton-icon {
    width: 48px;
    height: 48px;
    align-self: flex-start;
  }
  .vehicle-header-skeleton .skeleton-text {
    width: 100%;
  }
  .vehicle-header-skeleton .skeleton-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .vehicle-header-skeleton .skeleton-button {
    flex: 1;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .vehicle-header-skeleton {
    gap: 12px;
    padding: 12px;
  }
  .vehicle-header-skeleton .skeleton-icon {
    width: 40px;
    height: 40px;
  }
  .vehicle-header-skeleton .skeleton-button {
    flex: 1;
    height: 36px;
  }
}

.skeleton-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
}

.skeleton-text {
  flex: 1;
  min-width: 0;
}

.skeleton-line {
  height: 20px;
  margin-bottom: 8px;
  border-radius: 6px;
}

.skeleton-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.skeleton-button {
  width: 120px;
  height: 36px;
  border-radius: 8px;
}

.skeleton-icon,
.skeleton-line,
.skeleton-button {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 6px;
}

/* Hide skeletons when content loads */
.vehicle-header-content {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

/* ============================================================================
   FIX: Vehicle search dropdowns inside Assemblies modals
============================================================================ */
#fe-vehicle-change-modal .fe-asm-dialog {
  overflow: visible;
}

#fe-vehicle-change-modal .fe-modal-body,
#fe-vehicle-change-modal .fe-asm-body {
  overflow: visible;
}

#fe-vehicle-change-modal .vehicle-search-card {
  overflow: visible;
}

#fe-vehicle-change-modal .custom-select-dropdown,
#fe-vehicle-change-modal #manufacturer-select-dropdown,
#fe-vehicle-change-modal #model-select-dropdown,
#fe-vehicle-change-modal #engine-select-dropdown {
  position: absolute;
  z-index: 100050;
}

#fe-vehicle-change-modal .custom-select-options,
#fe-vehicle-change-modal #manufacturer-select-options,
#fe-vehicle-change-modal #model-select-options,
#fe-vehicle-change-modal #engine-select-options {
  position: relative;
  z-index: 100051;
}

#fe-vehicle-change-modal #manufacturer-select-wrapper,
#fe-vehicle-change-modal #model-select-wrapper,
#fe-vehicle-change-modal #engine-select-wrapper {
  position: relative;
}

/* ============================================================================
   FORCE STYLE: Assemblies Modals (Header / Title / Close Button)
============================================================================ */
.fe-asm-modal .fe-asm-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 20px !important;
  border-bottom: 1px solid #e5e7eb !important;
  background: #ffffff !important;
}

.fe-asm-modal .fe-asm-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin: 0 !important;
}

.fe-asm-modal .fe-asm-close {
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  border: 1px solid #d1d5db !important;
  background: #ffffff !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  line-height: 1 !important;
}

.fe-asm-modal .fe-asm-close:hover {
  background: #f3f4f6 !important;
  border-color: #9ca3af !important;
}

.fe-asm-modal .fe-asm-close:active {
  transform: scale(0.96) !important;
}

.fe-asm-modal .fe-asm-body {
  padding: 20px !important;
}

.fe-asm-modal .fe-asm-footer {
  padding: 14px 20px !important;
  border-top: 1px solid #e5e7eb !important;
  display: flex !important;
  justify-content: flex-end !important;
  background: #ffffff !important;
}

.fe-asm-modal .fe-asm-btn {
  padding: 8px 14px !important;
  border-radius: 8px !important;
  border: 1px solid #d1d5db !important;
  background: #f9fafb !important;
  cursor: pointer !important;
}

.fe-asm-modal .fe-asm-btn:hover {
  background: #f3f4f6 !important;
}

/* ---------------------------------------------------------------------------
   FINAL OVERRIDE: View toggle MUST win over any display:grid !important rules
--------------------------------------------------------------------------- */
#fe-assemblies-root[data-view="tree"] #fe-assemblies-boxes {
  display: none !important;
}

#fe-assemblies-root[data-view="boxes"] #fe-assemblies-tree {
  display: none !important;
}

/* Also respect hidden attribute no matter what */
#fe-assemblies-boxes[hidden],
#fe-assemblies-tree[hidden] {
  display: none !important;
}