/* ==========================================================================
   BRICMAN — Sistema de Cotizaciones
   Diseño industrial-editorial con identidad corporativa.
   ========================================================================== */

/* ------------------------------ TOKENS --------------------------------- */
:root {
  /* Brand */
  --brand-navy:   #00123F;
  --brand-blue:   #3767A6;
  --brand-orange: #F25C05;
  --brand-cyan:   #01C5FF;
  --brand-gray:   #d1d1d1;

  /* Category palette */
  --cat-PESADO:     #F25C05;
  --cat-SUSPENSION: #3767A6;
  --cat-EMBRAGUES:  #16a34a;
  --cat-MIXTO:      #01C5FF;

  /* Semantic */
  --success: #16a34a;
  --warn:    #d97706;
  --danger:  #dc2626;

  /* LIGHT THEME (default) */
  --bg:          #f5f6f8;
  --bg-soft:     #eceef2;
  --surface:     #ffffff;
  --surface-2:   #fafbfc;
  --surface-3:   #f0f2f5;
  --border:      #e3e6eb;
  --border-2:    #d1d5db;
  --text:        #0f172a;
  --text-soft:   #475569;
  --text-muted:  #94a3b8;
  --text-on-brand: #ffffff;
  --shadow-sm:   0 1px 2px rgba(15,23,42,.05);
  --shadow:      0 4px 16px rgba(15,23,42,.07), 0 1px 3px rgba(15,23,42,.04);
  --shadow-lg:   0 20px 50px rgba(15,23,42,.18), 0 4px 12px rgba(15,23,42,.06);

  --header-bg:   var(--brand-navy);
  --header-text: #ffffff;

  /* Type */
  --font-display: 'Saira Condensed', 'Bebas Neue', system-ui, sans-serif;
  --font-body:    'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Radii */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Layout */
  --header-h: 116px;
  --sidebar-w: 252px;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:          #07091a;
  --bg-soft:     #0a0e25;
  --surface:     #0e1330;
  --surface-2:   #121738;
  --surface-3:   #1a2046;
  --border:      #1f274d;
  --border-2:    #2a3461;
  --text:        #eef1ff;
  --text-soft:   #a8b1d6;
  --text-muted:  #6b779b;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
  --shadow:      0 4px 16px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg:   0 20px 50px rgba(0,0,0,.6);

  --header-bg:   #050816;
  --header-text: #ffffff;
}

/* ------------------------------ RESET ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv01';
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
img { max-width: 100%; display: block; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------ HEADER --------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 76px;
  padding: 0 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ffffff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--brand-orange), #ff7e2a);
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2.5px;
  line-height: 1;
  color: #ffffff;
}
.brand-tag {
  font-size: 10.5px;
  color: rgba(255,255,255,.55);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-family: var(--font-mono);
}
.mode-pill-crm {
  background: var(--brand-orange);
  color: #fff;
}
.mode-pill-calle {
  background: var(--brand-cyan);
  color: var(--brand-navy);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 540px;
}
.search-wrap input {
  width: 100%;
  height: 40px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 0 64px 0 40px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  transition: all var(--transition);
}
.search-wrap input::placeholder { color: rgba(255,255,255,.5); }
.search-wrap input:focus {
  background: rgba(255,255,255,.13);
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(1,197,255,.18);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.6);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #ffffff;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: rgba(255,255,255,.13); }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }

.icon-btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 32px;
  height: 32px;
  font-size: 14px;
}
.icon-btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.quote-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 16px 0 14px;
  background: var(--brand-orange);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .3px;
  transition: all var(--transition);
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}
.quote-btn:hover { background: #ff6a14; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(242,92,5,.4); }
.quote-btn:active { transform: translateY(0); }
.quote-count {
  background: rgba(255,255,255,.25);
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.quote-count.pulse { animation: pulse .5s ease; }
@keyframes pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); background: #fff; color: var(--brand-orange); }
  100% { transform: scale(1); }
}

/* Strip */
.topbar-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 24px;
  background: rgba(0,0,0,.25);
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: 12px;
  color: rgba(255,255,255,.72);
  font-weight: 500;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.topbar-strip::-webkit-scrollbar { display: none; }
.strip-item strong { color: #fff; font-weight: 700; font-family: var(--font-mono); }
.strip-sep { color: rgba(255,255,255,.25); }
.strip-discount strong { color: var(--brand-cyan); }

/* ------------------------------ LAYOUT --------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* ------------------------------ SIDEBAR -------------------------------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.sidebar-close {
  display: none;
}

.filter-block {
  margin-bottom: 26px;
}
.filter-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Categorías */
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.cat-btn:hover { background: var(--surface-3); }
.cat-btn.active {
  background: var(--surface-3);
  box-shadow: inset 3px 0 0 var(--cat-color);
}
.cat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat-color);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color) 22%, transparent);
}
.cat-name { flex: 1; font-size: 13px; font-weight: 500; }
.cat-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.cat-btn.active .cat-name { color: var(--text); font-weight: 600; }

/* Brands */
.brand-search-wrap { margin-bottom: 8px; }
.brand-search-wrap input {
  width: 100%;
  height: 32px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 11px;
  font-size: 12.5px;
  outline: none;
}
.brand-search-wrap input:focus { border-color: var(--brand-blue); }

.brand-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}
.brand-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.brand-item:hover { background: var(--surface-3); }
.brand-item input {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: all var(--transition);
}
.brand-item input:checked {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}
.brand-item input:checked::after {
  content: '';
  position: absolute;
  left: 3.5px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.brand-item label {
  font-size: 12.5px;
  color: var(--text-soft);
  cursor: pointer;
  flex: 1;
  user-select: none;
  font-weight: 500;
}
.brand-item input:checked + label { color: var(--text); font-weight: 600; }

/* Price */
.price-row { display: flex; align-items: center; gap: 8px; }
.price-sep { color: var(--text-muted); font-weight: 600; }
.price-input {
  flex: 1;
  height: 36px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 11px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  min-width: 0;
}
.price-input:focus { border-color: var(--brand-blue); }

.clear-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 36px;
  background: var(--surface-3);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all var(--transition);
}
.clear-filters:hover { background: var(--surface); border-color: var(--brand-orange); color: var(--brand-orange); }

/* ------------------------------ MAIN ----------------------------------- */
.main {
  padding: 22px 24px 60px;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
}

.results-label {
  font-size: 13px;
  color: var(--text-soft);
  flex: 1;
}
.results-label strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-select {
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 32px 0 12px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23475569' stroke-width='1.6' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.sort-select:focus { border-color: var(--brand-blue); }

.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.view-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--brand-navy); color: #fff; }
[data-theme="dark"] .view-btn.active { background: var(--brand-cyan); color: var(--brand-navy); }

/* Active chips */
.active-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.active-chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
}
.chip-x {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.chip-x:hover { background: var(--brand-orange); color: #fff; }

/* ------------------------------ PRODUCTS ------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}
.products-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Card */
.product-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
  overflow: hidden;
}
.product-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: var(--cat-color);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
}
.product-card:hover {
  border-color: var(--cat-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.product-card:hover::before { opacity: 1; }

/* Imagen del producto */
.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform 280ms ease;
}
.product-card:hover .card-image img {
  transform: scale(1.05);
}
.card-image-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}
.card-image-fallback svg {
  opacity: .35;
}
.card-image-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--border);
  color: var(--text-soft);
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: all var(--transition);
  z-index: 3;
  backdrop-filter: blur(4px);
}
.product-card:hover .card-image-zoom { opacity: 1; transform: translateY(0); }
.card-image-zoom:hover { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
[data-theme="dark"] .card-image-zoom { background: rgba(14,19,48,.95); }
[data-theme="dark"] .card-image { background: var(--surface-2); }

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--cat-color) 12%, transparent);
  color: var(--cat-color);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.stock-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--success);
  letter-spacing: .5px;
}
.stock-badge.low { color: var(--warn); }

.card-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .3px;
  font-weight: 500;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-brand {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.card-prices {
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.price-row-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.price-row-card.main {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
}
.price-row-card .price-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  font-size: 9.5px;
}
.price-row-card.main .price-label { font-size: 11px; color: var(--text-soft); }
.price-row-card .price-amt {
  font-family: var(--font-mono);
  font-weight: 700;
}
.price-row-card.main .price-amt {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
}
.price-row-card.p1 .price-amt { color: var(--brand-cyan); font-weight: 700; }
.price-row-card.p2 .price-amt { color: var(--brand-blue); font-weight: 700; }
[data-theme="dark"] .price-row-card.p2 .price-amt { color: #6ea3df; }

.add-btn {
  padding: 0px 4px;    
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  margin-top: 4px;
  background: var(--brand-navy);
  color: #fff;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .3px;
  transition: all var(--transition);
}
.add-btn:hover { background: var(--brand-orange); }
.add-btn.added { background: var(--success); }
[data-theme="dark"] .add-btn { background: var(--brand-blue); }
[data-theme="dark"] .add-btn:hover { background: var(--brand-orange); }

/* Row view */
.product-row {
  display: grid;
  grid-template-columns: 4px 130px 1fr 110px 90px 96px 110px;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all var(--transition);
  overflow: hidden;
}
.product-row:hover { border-color: var(--cat-color); box-shadow: var(--shadow-sm); }
.row-stripe { height: 32px; background: var(--cat-color); }
.row-code { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.row-title { font-size: 13px; font-weight: 500; }
.row-brand { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.row-price-stack { text-align: right; font-family: var(--font-mono); }
.row-price-stack .pmain { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); }
.row-price-stack .palt { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.row-price-stack .palt strong { color: var(--brand-cyan); font-weight: 700; }
.row-add {
  height: 34px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  color: var(--brand-orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  transition: all var(--transition);
}
.row-add:hover { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px dashed var(--border-2);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state-desc { font-size: 13px; }

/* ------------------------------ PAGINATION ----------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px 0 12px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-soft);
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--brand-blue); color: var(--text); }
.page-btn.active {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}
[data-theme="dark"] .page-btn.active {
  background: var(--brand-cyan);
  border-color: var(--brand-cyan);
  color: var(--brand-navy);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--text-muted); font-family: var(--font-mono); }

/* ------------------------------ QUOTE PANEL ---------------------------- */
.quote-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.quote-overlay.open { opacity: 1; pointer-events: auto; }

.quote-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 460px;
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(.32,.72,.36,1);
  box-shadow: -20px 0 50px rgba(0,0,0,.25);
}
.quote-panel.open { transform: translateX(0); }

.quote-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quote-eyebrow {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--brand-orange);
  font-weight: 700;
  margin-bottom: 3px;
}
.quote-title {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 2.5px;
  font-weight: 700;
  color: var(--text);
}

.quote-items {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-empty {
  margin: auto 0;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.quote-empty svg { margin: 0 auto 12px; opacity: .5; }
.quote-empty h4 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.qi {
  display: grid;
  grid-template-columns: 4px 1fr auto auto;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.qi-stripe { width: 4px; height: 32px; background: var(--cat-color); border-radius: 2px; }
.qi-info { min-width: 0; }
.qi-code { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); letter-spacing: .3px; }
.qi-title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qi-qty {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.qi-qty button {
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all var(--transition);
}
.qi-qty button:hover { background: var(--surface-3); color: var(--text); }
.qi-qty .qty-val {
  min-width: 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
}
.qi-remove {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: all var(--transition);
}
.qi-remove:hover { background: rgba(220,38,38,.1); color: var(--danger); }

.quote-foot {
  border-top: 1px solid var(--border);
  padding: 18px 22px 22px;
  background: var(--surface-2);
}
.totals-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-soft);
}
.totals-row + .totals-row { border-top: 1px dashed var(--border); }
.totals-row .label { display: flex; align-items: center; gap: 8px; }
.totals-row .badge {
  font-size: 9.5px;
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: .5px;
}
.totals-row.p1 .badge { background: rgba(1,197,255,.18); color: var(--brand-blue); }
.totals-row.p2 .badge { background: rgba(55,103,166,.14); color: var(--brand-blue); }
.totals-row .amt { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.totals-row.p1 .amt, .totals-row.p2 .amt { color: var(--brand-blue); }
.totals-row.savings { font-size: 11.5px; color: var(--success); font-weight: 600; padding-top: 8px; border-top: 1px solid var(--border)!important; }

.min-warn {
  font-size: 11.5px;
  text-align: center;
  padding: 8px 10px;
  background: rgba(217,119,6,.1);
  border: 1px solid rgba(217,119,6,.25);
  color: var(--warn);
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 500;
}

.btn-cta {
  width: 100%;
  height: 50px;
  background: var(--brand-orange);
  color: #fff;
  border-radius: var(--r);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  box-shadow: 0 4px 0 #b34204, 0 8px 16px rgba(242,92,5,.3);
}
.btn-cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 #b34204, 0 10px 20px rgba(242,92,5,.4); }
.btn-cta:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #b34204; }
.btn-cta:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ------------------------------ MODAL ---------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,9,26,.78);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms cubic-bezier(.32,.72,.36,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-md { max-width: 640px; }
.modal-lg { max-width: 920px; }

.modal-head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.modal-head p { font-size: 12.5px; color: var(--text-muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}
.modal-body-flush { padding: 0; }

.modal-foot {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--surface-2);
}
.foot-split { justify-content: flex-end; }
.foot-grow { flex: 1; }

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.form-group .req { color: var(--brand-orange); }
.form-group input,
.form-group select,
.form-group textarea {
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13.5px;
  outline: none;
  transition: all var(--transition);
}
.form-group textarea { height: 70px; padding: 8px 12px; resize: vertical; min-height: 60px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 18%, transparent);
}
.form-group input.error,
.form-group select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand-navy);
  color: #fff;
}
.btn-primary:hover { background: #001b5e; }
[data-theme="dark"] .btn-primary { background: var(--brand-orange); }
[data-theme="dark"] .btn-primary:hover { background: #ff6a14; }
.btn-ghost {
  background: var(--surface-3);
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebd5a; }

/* ------------------------------ QUOTE DOCUMENT ------------------------- */
.quote-doc {
  padding: 38px 44px;
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.5;
}

.qd-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--brand-navy);
  position: relative;
}
.qd-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 80px;
  height: 3px;
  background: var(--brand-orange);
}
.qd-company { display: flex; gap: 14px; align-items: center; }
.qd-logo {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: var(--brand-navy);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.qd-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.qd-logo-fallback {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--brand-orange);
  letter-spacing: 1px;
}
.qd-company-info .qd-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--brand-navy);
  line-height: 1;
}
.qd-company-info .qd-tag {
  font-size: 10.5px;
  color: #64748b;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 5px;
  font-weight: 600;
}
.qd-company-info .qd-contact {
  font-size: 11px;
  color: #475569;
  margin-top: 10px;
  line-height: 1.6;
}

.qd-title-card {
  text-align: right;
}
.qd-quote-label {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--brand-navy);
  line-height: 1;
}
.qd-quote-num {
  display: inline-block;
  background: var(--brand-orange);
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 6px;
}
.qd-dates {
  margin-top: 12px;
  font-size: 11px;
  color: #475569;
  line-height: 1.7;
}
.qd-dates strong { color: #0f172a; }

/* Cliente */
.qd-client {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 28px 0 24px;
  padding: 18px 22px;
  background: #f8fafc;
  border-radius: 10px;
  border-left: 4px solid var(--brand-blue);
}
.qd-block-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2.5px;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.qd-field { font-size: 12px; line-height: 1.7; }
.qd-field span { color: #64748b; display: inline-block; min-width: 70px; }
.qd-field strong { color: #0f172a; }

/* Tabla */
.qd-table-wrap { margin: 8px 0 18px; }
.qd-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2.5px;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e2e8f0;
}
.qd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.qd-table thead th {
  background: var(--brand-navy);
  color: #fff;
  padding: 10px 8px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.qd-table thead th.r { text-align: right; }
.qd-table thead th.c { text-align: center; }
.qd-table tbody td {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.qd-table tbody td.r { text-align: right; font-family: var(--font-mono); font-weight: 600; }
.qd-table tbody td.c { text-align: center; font-family: var(--font-mono); font-weight: 700; }
.qd-table tbody tr:nth-child(even) td { background: #f8fafc; }
.qd-table .qd-code { font-family: var(--font-mono); font-size: 10.5px; color: #64748b; }
.qd-table .qd-name { color: #0f172a; font-weight: 500; }
.qd-table .qd-brand { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.qd-table .qd-cat-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }

/* Totales */
.qd-totals {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 26px;
  margin-top: 20px;
}
.qd-terms {
  font-size: 10.5px;
  color: #475569;
  line-height: 1.7;
}
.qd-terms h4 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 6px;
}
.qd-terms ul { list-style: none; padding-left: 0; }
.qd-terms li { padding-left: 12px; position: relative; margin-bottom: 4px; }
.qd-terms li::before { content: '▸'; position: absolute; left: 0; color: var(--brand-orange); font-size: 10px; }

.qd-totals-box {
  background: var(--brand-navy);
  color: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.qd-totals-box::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px;
  height: 100px;
  background: var(--brand-orange);
  border-radius: 50%;
  transform: translate(40%, -40%);
  opacity: .15;
}
.qd-tot-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  color: rgba(255,255,255,.7);
  padding: 5px 0;
  position: relative;
}
.qd-tot-row + .qd-tot-row { border-top: 1px solid rgba(255,255,255,.08); }
.qd-tot-row .amt { font-family: var(--font-mono); font-weight: 600; color: #fff; }
.qd-tot-row.primary {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 2px solid rgba(255,255,255,.2)!important;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
}
.qd-tot-row.primary .amt {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 1.5px;
  color: var(--brand-orange);
}
.qd-tot-row.savings {
  background: rgba(22,163,74,.18);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 8px;
  border: 1px solid rgba(22,163,74,.3);
  font-size: 10.5px;
  color: #86efac;
}
.qd-tot-row.savings .amt { color: #86efac; }

.qd-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
  letter-spacing: .5px;
}
.qd-footer .qd-sign {
  text-align: right;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brand-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 240ms ease;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ------------------------------ ROW IMAGE ------------------------------ */
.row-img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.row-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.row-img-fallback {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ------------------------------ QUOTE ITEM IMAGE ----------------------- */
.qi-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.qi-img img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.qi-img-fallback {
  color: var(--text-muted);
  font-size: 14px;
}
.qi {
  grid-template-columns: 4px 36px 1fr auto auto;
}

/* ------------------------------ LIGHTBOX ------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; animation: fade-in 200ms ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid rgba(255,255,255,.15);
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }
.lightbox-caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
  max-width: 80vw;
}
.lightbox-caption .code { font-family: var(--font-mono); color: var(--brand-cyan); font-size: 11px; margin-bottom: 2px; display: block; }

/* ------------------------------ DANGER BTN ----------------------------- */
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.modal-sm { max-width: 440px; }

/* Empty cart button */
.clear-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  background: transparent;
  border: 1px dashed var(--border-2);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .3px;
  margin-bottom: 10px;
  transition: all var(--transition);
}
.clear-cart-btn:hover { border-color: var(--danger); color: var(--danger); border-style: solid; }

/* ------------------------------ MODO CRM ------------------------------- */
/* En modo CRM, ocultamos todo lo relacionado con crédito 30d y descuentos
   y mostramos solo el precio prepagado con "+IVA" */

body[data-mode="crm"] .price-row-card.main,
body[data-mode="crm"] .price-row-card.p2,
body[data-mode="crm"] .row-price-stack .palt {
  display: none;
}

/* En CRM, p1 se convierte en el precio principal */
body[data-mode="crm"] .price-row-card.p1 {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
body[data-mode="crm"] .price-row-card.p1 .price-label {
  font-size: 9.5px;
  color: var(--text-soft);
  letter-spacing: 1.2px;
  font-weight: 700;
}
body[data-mode="crm"] .price-row-card.p1 .price-amt {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
body[data-mode="crm"] .card-prices {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
body[data-mode="crm"] .price-row-card.p1 .iva-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--brand-orange);
  background: color-mix(in srgb, var(--brand-orange) 14%, transparent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-body);
  align-self: center;
}

/* Row view en CRM */
body[data-mode="crm"] .row-price-stack .pmain::after {
  content: ' +IVA';
  font-size: 9.5px;
  color: var(--brand-orange);
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: .5px;
}

/* Carrito en CRM */
body[data-mode="crm"] .totals-row.main,
body[data-mode="crm"] .totals-row.p2,
body[data-mode="crm"] .totals-row.savings {
  display: none;
}
body[data-mode="crm"] .totals-row.p1 {
  font-size: 15px;
  font-weight: 700;
}
body[data-mode="crm"] .totals-row.p1 .amt {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text);
  letter-spacing: .5px;
}
body[data-mode="crm"] .totals-row.p1 .amt::after {
  content: ' +IVA';
  font-size: 11px;
  color: var(--brand-orange);
  font-weight: 700;
  margin-left: 4px;
}
body[data-mode="crm"] .totals-row.p1 .badge {
  display: none;
}

/* Cotización HTML en CRM */
body[data-mode="crm"] .qd-table thead th:nth-child(5), /* P. Lista */
body[data-mode="crm"] .qd-table thead th:nth-child(7), /* Cr. 30d */
body[data-mode="crm"] .qd-table tbody td:nth-child(5),
body[data-mode="crm"] .qd-table tbody td:nth-child(7),
body[data-mode="crm"] .qd-tot-row.savings,
body[data-mode="crm"] .qd-tot-row.crm-hidden {
  display: none;
}
body[data-mode="crm"] .qd-tot-row.primary .amt::after {
  content: ' +IVA';
  font-size: 13px;
  color: var(--brand-orange);
  font-weight: 700;
  margin-left: 6px;
}
@media (max-width: 1100px) {
  .product-row {
    grid-template-columns: 4px 1fr auto auto;
    gap: 12px;
  }
  .row-brand, .row-code { display: none; }
}

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 84%;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(.32,.72,.36,1);
    z-index: 100;
    height: 100vh;
    box-shadow: 20px 0 50px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close {
    display: grid;
    place-items: center;
    width: 32px; height: 32px;
    position: absolute;
    top: 14px; right: 14px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: 14px;
  }
  .filter-toggle { display: inline-flex; }
  .quote-panel { width: 100%; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0 14px; height: 64px; gap: 10px; }
  .brand-text { display: none; }
  .quote-btn span:not(.quote-count) { display: none; }
  .quote-btn { padding: 0 10px; }
  .search-kbd { display: none; }
  .main { padding: 8px 10px 8px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .product-card { padding: 12px; }
  .card-title { font-size: 12px; -webkit-line-clamp: 2; }
  .price-row-card.main .price-amt { font-size: 18px; }
  .row-add {grid-column: 1 / -1;margin: 0px 10px 0px 15px;}
  .modal-foot { flex-wrap: wrap; padding: 12px 16px; }
  .modal-head { padding: 18px 18px 14px; }
  .modal-body { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .quote-doc { padding: 24px 18px; }
  .qd-header { grid-template-columns: 1fr; }
  .qd-title-card { text-align: left; }
  .qd-client, .qd-totals { grid-template-columns: 1fr; }
  .topbar-strip { font-size: 11px; padding: 8px 14px; }
}

/* ------------------------------ PRINT ---------------------------------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  body * { visibility: hidden !important; }
  #previewModal,
  #previewModal * { visibility: visible !important; }
  #previewModal {
    position: absolute !important;
    inset: 0 !important;
    background: #fff !important;
    backdrop-filter: none !important;
    display: block !important;
    padding: 0 !important;
  }
  #previewModal .modal {
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    animation: none !important;
  }
  .no-print { display: none !important; }
  .quote-doc { padding: 20mm 14mm !important; }
  @page { size: A4; margin: 0; }
}