/* ==========================================================================
   INCREMENTAL Knowledge Engine — Main Stylesheet
   Brand: #2D3A36 primary, #E73A1E red, #46B170 green, #00A5BA teal
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --primary: #2D3A36;
  --red: #E73A1E;
  --green: #46B170;
  --teal: #00A5BA;
  --dark-green: #3D6E4F;
  --gray: #848484;
  --gray-dark: #383838;
  --light: #f5f5f4;
  --white: #fff;
  --border: #e0e0e0;
  --border-light: #f0f0f0;

  /* Spacing (4px scale) */
  --sp-1: 0.25rem;   /* 4px */
  --sp-2: 0.5rem;    /* 8px */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.25rem;   /* 20px */
  --sp-6: 1.5rem;    /* 24px */
  --sp-8: 2rem;      /* 32px */

  /* Border radius */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-pill: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --max-width: 1200px;
  --sidebar-width: 240px;
  --header-height: auto;
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #333;
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

small, .text-sm {
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   4. HEADER (sticky)
   -------------------------------------------------------------------------- */
.header {
  background: var(--primary);
  color: var(--white);
  padding: var(--sp-4) var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  height: 36px;
}

.header-tagline {
  opacity: 0.65;
  margin-top: var(--sp-1);
  font-weight: 300;
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   5. NAVIGATION (sticky below header)
   -------------------------------------------------------------------------- */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0; /* will stack below header via JS offset or combined sticky */
  z-index: 99;
}

.nav a {
  font-weight: 600;
  color: var(--primary);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius);
  font-size: 0.83rem;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.nav a:hover,
.nav a.active {
  background: #e8f0ec;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   6. SEARCH BAR
   -------------------------------------------------------------------------- */
.search-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-6);
  display: flex;
  justify-content: center;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: 0.4;
}

.search-box input {
  width: 100%;
  padding: 0.45rem 0.8rem 0.45rem 2rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--teal);
}

/* Search dropdown */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 100;
}

.search-dropdown.open {
  display: block;
}

.search-dropdown .search-category-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  padding: 0.4rem 0.7rem 0.15rem;
  background: var(--light);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.kb-active {
  background: var(--light);
}

.search-result-item img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. BREADCRUMBS
   -------------------------------------------------------------------------- */
.breadcrumb-bar {
  padding: var(--sp-2) var(--sp-6);
  font-size: 0.82rem;
  color: var(--gray);
}

.breadcrumb-bar:empty {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--teal);
  font-size: 0.82rem;
}

.breadcrumb .sep::after {
  content: "\203A";
  margin: 0 0.15rem;
  color: var(--gray);
}

/* --------------------------------------------------------------------------
   8. MAIN CONTENT & VIEWS
   -------------------------------------------------------------------------- */
main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-6);
}

.view {
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.view.active {
  display: block;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   9. CATALOG LAYOUT (sidebar + grid)
   -------------------------------------------------------------------------- */
.catalog-layout {
  display: flex;
  gap: var(--sp-6);
}

.filters-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  align-self: flex-start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.catalog-main {
  flex: 1;
  min-width: 0;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.catalog-count {
  color: var(--gray);
  font-size: 0.83rem;
}

/* Active filters bar */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
  align-items: center;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.active-filter-tag:hover {
  background: var(--dark-green);
}

.active-filter-tag .remove::after {
  content: "\00d7";
  margin-left: 0.2rem;
}

.btn-clear-filters {
  font-size: 0.72rem;
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
  padding: 0.15rem 0.3rem;
}

/* Mobile filters button + modal */
.filters-toggle {
  display: none;
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  text-align: center;
}

.filters-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: 30%;
  background: var(--white);
  z-index: 200;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  padding: var(--sp-6);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.filters-modal.open {
  display: block;
  transform: translateY(0);
}

.filters-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.filters-modal-backdrop.open {
  display: block;
}

.filters-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}

.filters-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-dark);
}

/* --------------------------------------------------------------------------
   10. GRID SYSTEM
   -------------------------------------------------------------------------- */
.grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: var(--sp-4);
}

/* --------------------------------------------------------------------------
   11. PRODUCT CARD
   -------------------------------------------------------------------------- */
.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-normal);
  background: var(--white);
}

.product-card:hover {
  box-shadow: var(--shadow-md);
}

.product-card-img {
  aspect-ratio: 3 / 2;
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card-img img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.product-card-img .placeholder {
  font-size: 2.5rem;
  opacity: 0.2;
}

.product-card-body {
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.product-card-body h3 {
  font-size: 0.92rem;
  color: var(--primary);
  cursor: pointer;
  line-height: 1.3;
}

.product-card-body h3:hover {
  text-decoration: underline;
}

.product-card-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.88rem;
}

.product-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
  padding-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   12. BADGES
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.63rem;
  font-weight: 600;
  padding: 0.13rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.badge-brand {
  background: #e0f0ff;
  color: #1565c0;
}

.badge-category,
.badge-cat {
  background: #e8f0ec;
  color: var(--primary);
}

.badge-norm {
  background: #e8f5e9;
  color: var(--dark-green);
}

.badge-spec {
  background: #eee;
  color: #555;
}

/* Spec badges (small inline) */
.spec-badge {
  display: inline-block;
  font-size: 0.66rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: #eee;
  color: #555;
  margin: 0.08rem 0.12rem 0 0;
}

/* Color dots */
.color-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #ddd;
  margin-right: 2px;
}

/* --------------------------------------------------------------------------
   13. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition-fast);
  font-family: inherit;
}

.btn:hover {
  background: var(--dark-green);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-buy,
.btn-red {
  background: var(--red);
}

.btn-buy:hover,
.btn-red:hover {
  background: #c62828;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-sm {
  font-size: 0.7rem;
  padding: 0.22rem 0.45rem;
}

/* --------------------------------------------------------------------------
   14. CHIPS / FILTER CHIPS
   -------------------------------------------------------------------------- */
.filter-group {
  margin-bottom: 0.7rem;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.chip {
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid #ccc;
  background: var(--white);
  color: #333;
  cursor: pointer;
  font-size: 0.73rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.active,
.chip.a {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   15. TABLES
   -------------------------------------------------------------------------- */

/* Specs table */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7rem 0;
}

.specs-table th,
.specs-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #e8e8e8;
  font-size: 0.85rem;
}

.specs-table th {
  background: var(--light);
  color: var(--primary);
  width: 40%;
  font-weight: 600;
}

/* Compare table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.compare-table th {
  background: var(--primary);
  color: var(--white);
  padding: 0.45rem;
  font-size: 0.73rem;
  position: sticky;
  top: 0;
}

.compare-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  text-align: center;
}

.compare-table td.row-label {
  background: var(--light);
  font-weight: 600;
  text-align: left;
  color: var(--primary);
  position: sticky;
  left: 0;
  z-index: 1;
}

.compare-table td.diff {
  background: #e8f5e9;
}

/* Comparator checkboxes */
.compare-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.compare-select label {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.compare-select label.checked {
  background: #e8f0ec;
  border-color: var(--teal);
}

/* --------------------------------------------------------------------------
   16. FICHA — Product detail (polished)
   -------------------------------------------------------------------------- */

.ficha-back { display: inline-block; margin-bottom: 24px; font-size: .9rem; color: var(--teal); cursor: pointer; }
.ficha-back:hover { text-decoration: underline; }

.ficha-hero { display: flex; gap: 48px; margin-bottom: 16px; align-items: flex-start; }
.ficha-image { flex: 0 0 380px; aspect-ratio: 1/1; background: var(--light); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ficha-image img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 16px; }
.ficha-info { flex: 1; padding-top: 8px; }
.ficha-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.ficha-title { font-size: 1.75rem; font-weight: 700; color: var(--primary); margin: 0 0 8px; line-height: 1.25; }
.ficha-price { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 12px 0 4px; }
.ficha-price-note { font-size: .82rem; color: var(--gray); }
.ficha-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.btn-buy { display: inline-block; background: var(--red); color: #fff; border: none; padding: 12px 28px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; transition: background .15s; }
.btn-buy:hover { background: #c62828; }

.ficha-section { margin-bottom: 48px; }
.ficha-section h2 { font-size: 1.2rem; color: var(--primary); margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid #e8e8e8; }
.ficha-section h3 { font-size: 1.05rem; color: var(--primary); margin-bottom: 16px; }
.ficha-section .specs-table th, .ficha-section .specs-table td { padding: 12px 16px; font-size: .88rem; }

.ficha-sizes { display: flex; flex-wrap: wrap; gap: 10px; }
.ficha-size { padding: 10px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; font-weight: 500; text-align: center; min-width: 48px; background: #fff; }

.ficha-colors { display: flex; flex-wrap: wrap; gap: 16px; }
.ficha-color { display: flex; align-items: center; gap: 10px; }
.ficha-color-swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.ficha-color-name { font-size: .88rem; }

.ficha-norms-grid { display: flex; flex-direction: column; gap: 20px; }
.ficha-norm-card { padding: 24px; background: var(--light); border-radius: 12px; border-left: 4px solid var(--green); }
.ficha-norm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ficha-norm-header strong { font-size: 1rem; }
.ficha-norm-desc { font-size: .9rem; line-height: 1.7; margin: 0 0 12px; }
.ficha-norm-levels { margin-top: 16px; }
.ficha-norm-levels > strong { font-size: .85rem; color: var(--primary); display: block; margin-bottom: 8px; }
.specs-table-compact th { width: 30%; padding: 8px 12px; font-size: .8rem; }
.specs-table-compact td { padding: 8px 12px; font-size: .8rem; }
.ficha-norm-parts { font-size: .85rem; margin: 8px 0 0 20px; padding: 0; list-style: disc; line-height: 1.7; }
.ficha-norm-applies { font-size: .82rem; color: var(--gray); margin-top: 12px; font-style: italic; }

.ficha-usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ficha-usage-group { background: var(--light); padding: 20px; border-radius: 12px; }
.ficha-usage-label { font-size: .75rem; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.ficha-usage-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ficha-usage-tag { font-size: .85rem; padding: 6px 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }

.ficha-related { margin-top: 56px; padding-top: 40px; border-top: 2px solid #e8e8e8; }
.ficha-related-group { margin-bottom: 40px; }
.ficha-related-group h3 { font-size: 1rem; color: var(--gray-dark); margin-bottom: 20px; }

@media (max-width: 768px) {
  .ficha-hero { flex-direction: column; gap: 24px; }
  .ficha-image { flex: none; width: 100%; max-height: 320px; }
  .ficha-title { font-size: 1.4rem; }
  .ficha-usage { grid-template-columns: 1fr 1fr; }
  .ficha-section { margin-bottom: 36px; }
}
@media (max-width: 480px) {
  .ficha-usage { grid-template-columns: 1fr; }
  .ficha-actions { flex-direction: column; }
}

/* --------------------------------------------------------------------------
   17. FILTER SIDEBAR (Desktop ≥769px)
   -------------------------------------------------------------------------- */
.filter-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  align-self: flex-start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: var(--sp-3);
  border-right: 1px solid var(--border-light);
}

.filter-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 2px solid var(--border);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-left: 0.3rem;
}

.sidebar-clear {
  font-size: 0.7rem;
}

/* Collapsible filter groups inside sidebar */
.filter-sidebar .filter-group {
  margin-bottom: var(--sp-4);
}

.filter-label-toggle {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.filter-toggle-icon {
  font-size: 0.65rem;
  color: var(--gray);
  transition: transform var(--transition-fast);
}

.filter-chips.collapsed {
  display: none;
}

/* --------------------------------------------------------------------------
   18. FILTER DRAWER (Mobile ≤768px)
   -------------------------------------------------------------------------- */
.filter-mobile-toggle {
  display: none;
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  text-align: center;
  font-family: inherit;
}

.filter-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.filter-drawer-backdrop.open {
  display: block;
}

.filter-drawer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--white);
  z-index: 200;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.filter-drawer.open {
  display: flex;
  transform: translateY(0);
}

.filter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-drawer-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.filter-drawer-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-dark);
  line-height: 1;
}

.drawer-clear {
  font-size: 0.72rem;
}

.filter-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-6);
}

.filter-drawer-footer {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-drawer-apply {
  width: 100%;
  padding: var(--sp-3);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   19. RESPONSIVE: sidebar vs drawer
   -------------------------------------------------------------------------- */
@media (min-width: 769px) {
  .filter-sidebar { display: block; }
  .filter-mobile-toggle { display: none !important; }
  .filter-drawer,
  .filter-drawer-backdrop { display: none !important; }
}

@media (max-width: 768px) {
  .filter-sidebar { display: none; }
  .filter-mobile-toggle { display: block; }
  .catalog-layout { flex-direction: column; }
}

/* --------------------------------------------------------------------------
   20. CONFIGURADORES — Wizard style
   -------------------------------------------------------------------------- */

.config-page { max-width: 900px; margin: 0 auto; }
.config-header { margin-bottom: 40px; }
.config-title { font-size: 1.75rem; color: var(--primary); margin: 0 0 8px; }
.config-subtitle { font-size: .95rem; color: var(--gray); margin: 0; }

.config-questions { display: flex; flex-direction: column; gap: 32px; margin-bottom: 48px; }

.config-question { display: flex; gap: 20px; align-items: flex-start; }
.config-q-number {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1rem;
}
.config-q-content { flex: 1; }
.config-q-content h3 { font-size: 1.1rem; color: var(--primary); margin: 4px 0 16px; }
.config-hint { font-size: .8rem; color: var(--gray); margin-top: 10px; line-height: 1.5; }

/* Wizard options */
.wiz-options { display: flex; flex-wrap: wrap; gap: 10px; }
.wiz-options-wide { gap: 12px; }
.wiz-options-compact .wiz-option { min-width: 56px; padding: 10px 16px; }

.wiz-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 20px; border: 2px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer; transition: all .15s; min-width: 100px;
  text-align: center; font-family: inherit; font-size: .88rem; color: var(--text);
}
.wiz-option:hover { border-color: var(--primary); background: #f8f9f8; }
.wiz-option.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.wiz-option.active .wiz-option-icon { filter: none; }
.wiz-option-icon { font-size: 1.5rem; line-height: 1; }
.wiz-option-label { font-weight: 600; font-size: .82rem; }

/* Range slider */
.config-slider { display: flex; align-items: center; gap: 16px; }
.config-range { flex: 1; accent-color: var(--primary); height: 6px; }
.config-slider-value { font-size: 2rem; font-weight: 700; color: var(--primary); min-width: 100px; text-align: right; }
.config-slider-value span { font-size: 2.5rem; }
.config-slider-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--gray); margin-top: 4px; }

/* Results */
.config-results { margin-top: 16px; }
.config-results-header { margin-bottom: 24px; }
.config-results-header h2 { font-size: 1.3rem; color: var(--primary); margin: 0 0 4px; }
.config-results-subtitle { font-size: .88rem; color: var(--gray); margin: 0; }
.config-no-results { padding: 32px; text-align: center; color: var(--gray); background: var(--light); border-radius: 12px; }

/* Recommendation cards */
.rec-list { display: flex; flex-direction: column; gap: 12px; }
.rec-card {
  display: flex; gap: 16px; padding: 20px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; align-items: flex-start;
}
.rec-best { border-left: 4px solid var(--green); }
.rec-rank {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--light); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: var(--gray);
}
.rec-best .rec-rank { background: var(--green); color: #fff; font-size: 1.1rem; }
.rec-img { width: 80px; height: 80px; object-fit: contain; flex-shrink: 0; border-radius: 8px; }
.rec-img-empty { width: 80px; height: 80px; background: var(--light); border-radius: 8px; }
.rec-body { flex: 1; }
.rec-match { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--gray); margin-bottom: 4px; }
.rec-best .rec-match { color: var(--green); }
.rec-name { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.rec-meta { font-size: .82rem; color: var(--gray); margin-bottom: 6px; }
.rec-specs { margin-bottom: 8px; }
.rec-actions { display: flex; gap: 8px; }

/* EPI alert */
.config-epi-alert {
  margin-top: 32px; padding: 24px; background: #fff8e1; border-radius: 12px;
  border-left: 4px solid #f9a825;
}
.config-epi-alert h3 { font-size: 1rem; color: #e65100; margin: 0 0 12px; }
.config-epi-alert ul { margin: 0 0 12px 20px; padding: 0; font-size: .88rem; line-height: 1.7; }
.config-epi-link { font-size: .88rem; color: var(--teal); font-weight: 600; }

/* Kit items */
.kit-list { display: flex; flex-direction: column; gap: 12px; }
.kit-item {
  display: flex; gap: 16px; padding: 20px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; align-items: flex-start;
  border-left: 4px solid var(--gray-light);
}
.kit-required { border-left-color: var(--primary); }
.kit-icon { font-size: 2rem; flex-shrink: 0; width: 40px; text-align: center; }
.kit-img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; border-radius: 8px; }
.kit-img-empty { width: 64px; height: 64px; background: var(--light); border-radius: 8px; }
.kit-body { flex: 1; }
.kit-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--gray); margin-bottom: 2px; }
.kit-required .kit-tag { color: var(--primary); }
.kit-category { font-size: .95rem; font-weight: 700; color: var(--primary); margin: 0 0 2px; }
.kit-product-name { font-size: .85rem; margin-bottom: 4px; }
.kit-specs { margin-bottom: 4px; }
.kit-options-count { font-size: .78rem; color: var(--gray); margin-bottom: 6px; }
.kit-actions { display: flex; gap: 8px; align-items: center; }
.kit-price { font-weight: 700; color: var(--primary); font-size: .95rem; }

.kit-budget {
  margin-top: 20px; padding: 16px 24px; background: var(--light); border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .95rem;
}
.kit-budget strong { font-size: 1.1rem; color: var(--primary); }

.config-back-link { display: inline-block; margin-bottom: 16px; color: var(--teal); cursor: pointer; font-size: .9rem; }
.config-back-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .config-question { flex-direction: column; gap: 12px; }
  .config-q-number { width: 32px; height: 32px; font-size: .85rem; }
  .wiz-option { min-width: 80px; padding: 12px 14px; }
  .config-slider-value { font-size: 1.5rem; }
  .config-slider-value span { font-size: 1.8rem; }
  .rec-card { flex-wrap: wrap; }
  .kit-item { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   21. FLOATING COMPARE BAR
   -------------------------------------------------------------------------- */
.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--white);
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.compare-bar.visible {
  transform: translateY(0);
}

.compare-bar-thumbs {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.compare-bar-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--light);
  overflow: hidden;
  flex-shrink: 0;
}

.compare-bar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.compare-bar-thumb .compare-bar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--gray);
  font-size: .8rem;
}

.compare-bar-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  border: none;
  font-size: .7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-bar-btn {
  white-space: nowrap;
  padding: var(--sp-2) var(--sp-5);
  font-size: .88rem;
}

/* Product card compare icon */
.product-card-img {
  position: relative;
}

.product-card-compare {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: rgba(255,255,255,0.9);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 2;
}

.product-card-compare:hover {
  background: var(--primary);
  color: var(--white);
}

.product-card-compare.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

/* --------------------------------------------------------------------------
   22. ENHANCED COMPARE TABLE
   -------------------------------------------------------------------------- */
.compare-scroll {
  overflow-x: auto;
  margin-top: var(--sp-3);
  -webkit-overflow-scrolling: touch;
}

.compare-table-enhanced {
  min-width: 500px;
}

.compare-table-enhanced th.compare-label-col,
.compare-table-enhanced td.compare-label-col {
  background: var(--light);
  font-weight: 600;
  text-align: left;
  color: var(--primary);
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 130px;
  font-size: .82rem;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
}

.compare-table-enhanced th.compare-label-col {
  background: var(--primary);
  color: var(--white);
}

.compare-col-header {
  text-align: center;
  padding: .7rem .5rem;
  min-width: 150px;
  vertical-align: top;
}

.compare-col-header img {
  display: block;
  margin: 0 auto .4rem;
  height: 60px;
  object-fit: contain;
}

.compare-col-name {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
}

.compare-col-remove {
  display: inline-block;
  margin-top: .3rem;
  background: none;
  border: none;
  color: var(--red);
  font-size: 1rem;
  cursor: pointer;
  opacity: .6;
}

.compare-col-remove:hover {
  opacity: 1;
}

td.compare-best {
  background: #e8f5e9 !important;
  font-weight: 700;
  color: var(--dark-green);
}

/* Quick add labels in comparador */
.compare-quick-label {
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.compare-quick-label.checked {
  background: #e8f0ec;
  border-color: var(--teal);
}

/* --------------------------------------------------------------------------
   23. SEARCH ENHANCEMENTS
   -------------------------------------------------------------------------- */
.search-see-more {
  cursor: pointer;
  padding: .35rem .7rem;
}

.search-see-more:hover {
  background: #e0f7fa;
}

.search-recent-item svg {
  margin-right: .3rem;
}

/* Ensure body has padding for floating bar */
body.has-compare-bar {
  padding-bottom: 72px;
}

/* --------------------------------------------------------------------------
   21. GUIDES — Application guides by sector
   -------------------------------------------------------------------------- */

.guides-page { max-width: 1000px; margin: 0 auto; }
.guides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.guide-card {
  padding: 28px; border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all .2s; background: #fff;
}
.guide-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.guide-card-icon { font-size: 2.5rem; margin-bottom: 12px; }
.guide-card h3 { font-size: 1.1rem; color: var(--primary); margin: 0 0 8px; }
.guide-card p { font-size: .85rem; color: var(--gray); margin: 0 0 16px; line-height: 1.5; }
.guide-card-stats { display: flex; gap: 12px; font-size: .75rem; color: var(--gray); margin-bottom: 16px; }
.guide-card-stats span { background: var(--light); padding: 4px 8px; border-radius: 4px; }
.guide-card-cta { font-size: .85rem; color: var(--teal); font-weight: 600; }

/* Guide detail */
.guide-detail { max-width: 900px; }
.guide-detail-header { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.guide-detail-icon { font-size: 3rem; flex-shrink: 0; }
.guide-detail h1 { font-size: 1.75rem; color: var(--primary); margin: 0 0 4px; }
.guide-description { font-size: .95rem; line-height: 1.7; margin-bottom: 32px; padding: 20px; background: var(--light); border-radius: 12px; }

/* Risks */
.guide-risks { margin-bottom: 40px; }
.guide-risks h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: 16px; }
.guide-risks-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.guide-risk-tag { font-size: .85rem; padding: 8px 14px; background: #fff3e0; border: 1px solid #ffcc80; border-radius: 8px; color: #e65100; }

/* EPI cards */
.guide-epi-card {
  margin-bottom: 32px; padding: 24px; border: 1px solid var(--border);
  border-radius: 12px; border-left: 4px solid var(--primary);
}
.guide-epi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.guide-epi-type { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.guide-epi-reason { font-size: .9rem; line-height: 1.6; margin: 0 0 16px; }

.guide-epi-norm { margin-top: 16px; padding: 16px; background: var(--light); border-radius: 8px; }
.guide-epi-norm strong { font-size: .95rem; }
.guide-epi-norm p { font-size: .85rem; line-height: 1.6; margin: 8px 0; }
.guide-legal-note { margin-top: 12px; padding: 10px 14px; background: #e8f5e9; border-radius: 6px; font-size: .82rem; line-height: 1.5; color: #2e7d32; }

.guide-epi-products { margin-top: 16px; }
.guide-epi-products-label { font-size: .8rem; font-weight: 700; color: var(--gray); text-transform: uppercase; margin-bottom: 12px; }
.grid-products-sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

/* Legal section */
.guide-legal { margin-top: 48px; padding: 24px; background: #e3f2fd; border-radius: 12px; }
.guide-legal h2 { font-size: 1.1rem; color: #1565c0; margin: 0 0 16px; }
.guide-legal ul { margin: 0; padding: 0 0 0 20px; font-size: .88rem; line-height: 1.8; }

@media (max-width: 640px) {
  .guides-grid { grid-template-columns: 1fr; }
  .guide-detail-header { flex-direction: column; gap: 8px; }
  .guide-epi-card { padding: 16px; }
}

/* --------------------------------------------------------------------------
   22. SEARCH — Enhanced intelligent search
   -------------------------------------------------------------------------- */
.search-norm-banner {
  padding: 10px 14px; background: #e8f5e9; border-radius: 6px;
  margin: 8px; font-size: .85rem; color: #2e7d32;
}
.search-interpretation {
  padding: 8px 14px; background: #e3f2fd; border-radius: 6px;
  margin: 4px 8px 8px; font-size: .8rem; color: #1565c0;
}
.search-result-item mark {
  background: #fff3cd; padding: 0 2px; border-radius: 2px;
}

/* --------------------------------------------------------------------------
   23. NORMATIVAS — Enriched norm cards
   -------------------------------------------------------------------------- */
.norm-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  transition: box-shadow .15s;
}
.norm-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.norm-card-header { display: flex; align-items: flex-start; gap: .75rem; }
.norm-description { color: #444; line-height: 1.55; }
.norm-meta { font-size: .82rem; color: #555; }
.norm-sublabel {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray);
  margin-bottom: .25rem;
}
.norm-section {
  margin-top: .75rem;
  padding-top: .6rem;
  border-top: 1px solid #f0f0f0;
}
.norm-legal {
  background: #fffde7;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: .55rem .7rem;
  margin-top: .75rem;
}
.norm-marking {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 6px;
  padding: .55rem .7rem;
}
.norm-products {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .35rem;
}
.badge-norm {
  background: var(--dark);
  color: #fff;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .45rem;
}
