/* ============================================================
   COTIZADOR — Estilos específicos (importar después de app.css)
   ============================================================ */

/* ─── Pipeline / Kanban ──────────────────────────────────── */
.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  align-items: start;
  padding-bottom: 24px;
}
.pipeline-col {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pipeline-col-header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pipeline-col-title { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 700; }
.pipeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-draft       { background: #94a3b8; }
.dot-in_progress { background: #3b82f6; }
.dot-sent        { background: #8b5cf6; }
.dot-revision    { background: #f59e0b; }
.dot-confirmed   { background: #10b981; }
.dot-cancelled   { background: #ef4444; }
.pipeline-count {
  background: var(--bg); color: var(--text-muted);
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: var(--r-full); border: 1px solid var(--border);
  min-width: 22px; text-align: center;
}
.pipeline-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  flex: 1;
  transition: background .15s;
}
.pipeline-cards.drag-over { background: var(--brand-light); border-radius: var(--r); }

/* ─── Quote Card ─────────────────────────────────────────── */
.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: grab;
  user-select: none;
  transition: box-shadow var(--transition), transform var(--transition), opacity var(--transition);
  position: relative;
}
.quote-card:hover { box-shadow: var(--shadow); }
.quote-card.dragging { opacity: .5; transform: rotate(1.5deg); cursor: grabbing; }
.qc-number  { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.qc-company { font-size: var(--text-sm); font-weight: 700; margin-bottom: 2px; line-height: 1.3; }
.qc-client  { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 8px; }
.qc-meta    { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.qc-price   { font-size: var(--text-sm); font-weight: 800; color: var(--brand); }
.qc-items   { font-size: var(--text-xs); color: var(--text-muted); }
.qc-date    { font-size: 10px; color: var(--text-light); margin-top: 5px; }
.qc-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.quote-card:hover .qc-actions { display: flex; }
.qc-btn {
  width: 26px; height: 26px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; transition: all var(--transition);
}
.qc-btn:hover { background: var(--bg); border-color: var(--brand); color: var(--brand); }
.qc-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ─── Wizard Drawer ──────────────────────────────────────── */
.wizard-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  animation: fadeIn .2s ease;
}
.wizard-drawer {
  width: 100vw;
  max-width: 100vw;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  border-left: none;
}
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.wizard-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.wizard-title  { font-size: var(--text-lg); font-weight: 800; }
.wizard-number { font-size: var(--text-sm); color: var(--text-muted); margin-top: 1px; }

/* Step tabs */
.wizard-steps {
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
  overflow-x: auto;
}
.step-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 18px;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  white-space: nowrap;
}
.step-tab:hover  { color: var(--text); }
.step-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.step-tab.done   { color: var(--success); }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.step-tab.active .step-num { background: var(--brand); border-color: var(--brand); color: #fff; }
.step-tab.done   .step-num { background: var(--success); border-color: var(--success); color: #fff; }

.wizard-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.step-panel { display: none; flex: 1; flex-direction: column; min-height: 0; }
.step-panel.active { display: flex; overflow: hidden; }
.step-panel[data-step="0"].active { overflow-y: auto; } /* form scrolls normally */

.wizard-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  flex-shrink: 0;
}

/* ─── Step 0: New quotation form ─────────────────────────── */
.new-quote-form { padding: 32px 40px; max-width: 600px; margin: 0 auto; width: 100%; }
.nqf-title { font-size: var(--text-xl); font-weight: 800; margin-bottom: 6px; }
.nqf-sub   { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 28px; }
.nqf-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nqf-field { display: flex; flex-direction: column; gap: 5px; }
.nqf-field.full { grid-column: 1 / -1; }
.nqf-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

/* ─── Step 1: Product search ─────────────────────────────── */
.step1-layout {
  display: grid;
  grid-template-columns: 1fr 340px 320px;  /* search | cart | insights */
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.step1-search-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.search-row { display: flex; gap: 8px; }
.step1-cart { display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  overflow-y: auto;
  flex: 1;
  align-items: start;
}

.product-card-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  align-self: start;
}
.product-card-mini:hover { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(12,124,89,.1); transform: translateY(-1px); }
.pcm-img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-alt); padding: 10px; }
.pcm-img-ph { width: 100%; aspect-ratio: 1; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--border); }
.pcm-body   { padding: 8px 10px 10px; }
.pcm-source { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 3px; }
.pcm-title  { font-size: 11px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcm-price  { font-size: var(--text-sm); font-weight: 800; color: var(--brand); }
.pcm-add {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px;
  background: var(--brand); color: #fff;
  border: none; border-radius: 50%;
  font-size: 20px; line-height: 1;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow);
}
.product-card-mini:hover .pcm-add { display: flex; }

/* ─── Insights / Analytics panel ────────────────────────── */
.step1-insights {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.insights-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #0C7C59 0%, #0a6b4c 100%);
  color: #fff;
  flex-shrink: 0;
}
.insights-header-title { font-size: var(--text-sm); font-weight: 800; margin-bottom: 2px; }
.insights-header-sub   { font-size: 11px; opacity: .8; }
.insights-body { flex: 1; overflow-y: auto; padding: 14px 14px; }
.insights-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 32px 20px;
  gap: 12px;
}
.insights-empty-icon { font-size: 36px; opacity: .5; }

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
}
.insight-card-header {
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.insight-card-body { padding: 10px 12px; }
.insight-alert {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.insight-warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 10px;
}
.alt-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.alt-row:last-child { border-bottom: none; }
.alt-price-good { color: #047857; font-weight: 800; font-size: 11px; }
.alt-price-bad  { color: #b45309; font-size: 10px; }
.price-tag-cheaper { background: #ecfdf5; color: #047857; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.price-tag-pricier  { background: #fffbeb; color: #92400e; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.cart-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.cart-title { font-size: var(--text-sm); font-weight: 700; }
.cart-items { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.cart-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: var(--text-sm); }

.cart-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.ci-img   { width: 38px; height: 38px; object-fit: contain; border-radius: 4px; background: var(--bg); padding: 4px; }
.ci-name  { font-size: 11px; font-weight: 700; line-height: 1.3; }
.ci-src   { font-size: 9px; color: var(--brand); text-transform: uppercase; font-weight: 700; }
.ci-qty   { display: flex; align-items: center; gap: 3px; }
.qty-btn  { width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); font-size: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; cursor: pointer; line-height: 1; }
.qty-val  { font-size: 12px; font-weight: 700; min-width: 18px; text-align: center; }
.ci-del   { width: 20px; height: 20px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.ci-del:hover { color: var(--danger); }

.custom-product-panel { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface-alt); flex-shrink: 0; }
.custom-toggle { font-size: var(--text-xs); font-weight: 700; color: var(--brand); cursor: pointer; display: flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; }
.custom-form { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.custom-form.hidden { display: none; }

/* ─── Step 2: Mockup ─────────────────────────────────────── */
.step2-layout { display: grid; grid-template-columns: 210px 1fr; gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.mockup-sidebar { border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; height: 100%; box-sizing: border-box; }
.mi-thumb {
  border: 2px solid var(--border); border-radius: var(--r); padding: 10px;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; gap: 8px; position: relative;
}
.mi-thumb:hover  { border-color: var(--brand); }
.mi-thumb.active { border-color: var(--brand); background: var(--brand-light); }
.mi-thumb img    { width: 36px; height: 36px; object-fit: contain; border-radius: 4px; background: var(--bg); }
.mi-name { font-size: 11px; font-weight: 700; line-height: 1.3; flex: 1; }
.mi-done { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; background: var(--brand); border-radius: 50%; color: #fff; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; }

.mockup-canvas-area { display: flex; flex-direction: column; overflow: hidden; }
.mockup-tools {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  flex-shrink: 0; background: var(--surface-alt);
}
.tool-btn { display: flex; align-items: center; gap: 5px; padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); font-size: var(--text-xs); font-weight: 600; cursor: pointer; transition: all var(--transition); }
.tool-btn:hover { border-color: var(--brand); color: var(--brand); }
.tool-btn.active { background: var(--brand-light); border-color: var(--brand); color: var(--brand); }
.tool-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.canvas-wrap { flex: 1; display: flex; align-items: center; justify-content: center; background: #e8e8e8; overflow: hidden; padding: 20px; position: relative; }
#mockup-canvas { border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15); background: #fff; }
.mockup-bar { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--surface); flex-wrap: wrap; }
.mb-label  { font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); }
.mb-input  { height: 34px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 10px; font-size: var(--text-sm); font-weight: 700; width: 130px; outline: none; transition: border-color var(--transition); }
.mb-input:focus { border-color: var(--brand); }

/* ─── Step 3: Quote template ─────────────────────────────── */
.step3-layout { display: grid; grid-template-columns: 1fr 320px; gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.quote-preview-wrap { overflow-y: auto; overflow-x: hidden; padding: 24px; background: #e0e0e0; height: 100%; box-sizing: border-box; }
.quote-settings-panel { border-left: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; height: 100%; box-sizing: border-box; }
.ss-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* PDF Template — fixed A4 proportions in the editor */
#quote-template {
  background: #fff;
  width: 780px;
  max-width: 780px;
  /* A4 ratio: 297/210 × 780px ≈ 1103px per page */
  min-height: 1103px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #111;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Dashed line at 1103px to show where page 2 starts */
#quote-template::after {
  content: '';
  position: absolute;
  top: 1103px;
  left: 0;
  right: 0;
  border-top: 2px dashed rgba(12,124,89,.3);
  pointer-events: none;
}
.qt-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 18px 24px 14px;
  gap: 20px;
  border-bottom: 3px solid #0C7C59;
}
.qt-logo { height: 54px; object-fit: contain; display: block; }
.qt-logo-text { font-size: 24px; font-weight: 900; color: #0C7C59; letter-spacing: -.03em; }
.qt-co-info { text-align: center; }
.qt-co-name { font-size: 13px; font-weight: 900; margin-bottom: 4px; }
.qt-co-det  { font-size: 10px; color: #555; line-height: 1.65; }
.qt-doc { text-align: right; }
.qt-doc-label  { font-size: 11px; color: #777; }
.qt-doc-number { font-size: 24px; font-weight: 900; }

/* Client section — fixed column widths to prevent misalignment */
.qt-client-section {
  padding: 10px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 12px;
}
.qt-ct table, .qt-dates table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.qt-ct td, .qt-dates td { padding: 4px 8px; font-size: 11px; border: 1px solid #e5e7eb; overflow: hidden; }
.lbl { background: #374151 !important; color: #fff !important; font-weight: 700 !important; font-size: 10px !important; text-transform: uppercase; white-space: nowrap; width: 100px; }
.qt-ct td:first-child { width: 100px; }
.qt-ct td:last-child  { }
.qt-dates .date-label { background: #374151; color: #fff; font-weight: 700; text-align: center; font-size: 10px; }
.qt-dates .date-value { text-align: center; font-weight: 700; font-size: 11px; }

/* Items table */
/* Items section grows to fill remaining page height */
.qt-items { padding: 10px 24px; flex: 1; }
.qt-items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.qt-items-table th {
  background: #0C7C59; color: #fff;
  padding: 8px 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  text-align: left; overflow: hidden;
}
.qt-items-table th.r { text-align: right; }
.qt-items-table td { padding: 10px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; font-size: 11px; word-wrap: break-word; }
.qt-items-table tr:nth-child(even) td { background: #f9fafb; }
.td-r { text-align: right; font-weight: 700; }

/* Product image — contain to avoid distortion */
.qt-item-img {
  width: 90px; height: 90px;
  object-fit: contain;   /* contain = no crop/distortion */
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  display: block;
  padding: 4px;
}
.qt-item-img-ph { width: 90px; height: 90px; background: #f0f0f0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 32px; }
.qt-item-name { font-weight: 700; font-size: 11px; }
.qt-item-desc { font-size: 10px; color: #777; margin-top: 2px; }

.qt-footer-section {
  padding: 12px 24px 20px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  border-top: 2px solid #0C7C59;
}
.qt-notes-label { font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.qt-notes-text  { font-size: 10px; color: #555; line-height: 1.7; }
.qt-totals { width: 100%; border-collapse: collapse; }
.qt-totals td { padding: 4px 8px; font-size: 11px; }
.qt-totals .tl { font-weight: 600; color: #555; }
.qt-totals .tv { text-align: right; font-weight: 700; }
.qt-totals .grand td { background: #0C7C59; color: #fff; font-weight: 800; font-size: 13px; padding: 8px 10px; }
.qt-totals .grand .tv { font-size: 15px; text-align: right; }
.qt-footer-bar { background: #111827; color: #9ca3af; text-align: center; padding: 10px 24px; font-size: 10px; }

/* Editable in preview */
[contenteditable] { outline: none; border-radius: 2px; padding: 1px 2px; transition: background .1s; cursor: text; }
[contenteditable]:hover { background: rgba(12,124,89,.06); }
[contenteditable]:focus { background: rgba(12,124,89,.12); box-shadow: 0 0 0 1px #0C7C59; }

/* Source badges */
.src-badge { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: var(--r-full); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.src-iddentify    { background: #ecfdf5; color: #047857; }
.src-branddu      { background: #eff6ff; color: #1d4ed8; }
.src-cotizaciones { background: #fdf4ff; color: #7c3aed; }
.src-default      { background: var(--bg); color: var(--text-muted); }

/* Print */
@media print {
  @page { size: A4; margin: 10mm; }
  body > *:not(#qt-print) { display: none !important; }
  #qt-print { display: block !important; }
  /* Inline styles from previewPDF() control #quote-template.
     Clear the screen min-height so height:Nmm from JS works correctly. */
  #quote-template { min-height: 0 !important; }
  #quote-template::after { display: none !important; }
  .qt-header, .qt-client-section, .qt-footer-section, .qt-footer-bar { page-break-inside: avoid; }
  .qt-items-table tr { page-break-inside: avoid; }
  .qt-header, .qt-footer-bar, .qt-items-table th, .qt-totals .grand td,
  .lbl, .qt-dates .date-label {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Responsive */
@media (max-width: 1200px) { .pipeline { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .step1-layout, .step2-layout, .step3-layout { grid-template-columns: 1fr; }
  .step1-cart, .mockup-sidebar, .quote-settings-panel { display: none; }
  .wizard-drawer { width: 100vw; }
  .pipeline { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) { .pipeline { grid-template-columns: 1fr; } }
/* ════════════════════════════════════════════════════════════
 * CRM integration (Phase 4c+4d) — pickers integrados, lock banner
 * ════════════════════════════════════════════════════════════ */

/* ─── Lock banner (arriba del Step 0 cuando la quote está bloqueada) ─── */
.lock-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #9a3412;
}
.lock-banner .lock-icon { font-size: 18px; }
.lock-banner strong { display: block; margin-bottom: 2px; color: #7c2d12; }
.lock-banner .lock-deal-link { color: #c2410c; font-weight: 600; text-decoration: underline; }
.lock-banner .lock-deal-link:hover { color: #9a3412; }

/* ─── Pickers integrados en los campos f-company y f-name ─── */
/* La estrategia: el campo es un input normal, pero al escribir aparece un
 * dropdown debajo con coincidencias del CRM. Si el usuario clickea uno,
 * se llena el campo + se muestra el badge "🔗 CRM" junto al label.
 * Si el usuario edita el valor manualmente, el badge desaparece (queda
 * como dato libre, sin contact_id/company_id). */
.nqf-field.has-picker {
  position: relative;
}
.nqf-field.has-picker .nqf-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.link-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: #dcfce7;
  color: #15803d;
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.picker-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,.1);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 2px;
}
.picker-result {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.picker-result:last-child { border-bottom: none; }
.picker-result:hover { background: #f0fdf4; }
.picker-result strong { display: block; color: var(--text); }
.picker-result small { color: var(--text-muted); font-size: 11px; }
.picker-result.text-muted { color: var(--text-muted); cursor: default; font-style: italic; }
.picker-result.text-muted:hover { background: transparent; }
.picker-result.picker-create { background: #fafafa; }
.picker-result.picker-create:hover { background: #ecfdf5; }

/* ─── Lock indicator en quote cards del kanban ─── */
.quote-card.locked {
  background: #fff7ed;
  border-color: #fed7aa;
  cursor: not-allowed;
  opacity: 0.92;
}
.quote-card.locked:hover { box-shadow: none; }
.qc-lock {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.1));
}
.qc-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
}
.qc-btn.disabled:hover { background: transparent; }

/* ─── Wizard en modo solo lectura (cotización bloqueada por un negocio) ───
 * Cuando una quote tiene locked_by_deal_id != NULL, abrimos el wizard para que
 * el usuario pueda ver/imprimir el PDF, pero NO debe poder modificarla. El JS
 * agrega la clase `wizard-readonly` al backdrop; estas reglas neutralizan todo
 * lo que dispare un write al backend.
 */
.wizard-readonly input:not([type="file"]),
.wizard-readonly select,
.wizard-readonly textarea {
  pointer-events: none;
  background: #f9fafb !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}
.wizard-readonly [contenteditable="true"] {
  pointer-events: none;
  cursor: not-allowed;
}
/* Step 1 — Carrito: ocultar acciones de modificar (botones de qty, eliminar, custom product) */
.wizard-readonly .step1-search-panel,
.wizard-readonly .custom-product-panel,
.wizard-readonly .cart-item-actions,
.wizard-readonly .qc-remove,
.wizard-readonly .cart-item-controls {
  display: none !important;
}
/* Step 2 — Mockup: ocultar toolbar y mockup-bar (precio/cantidad/desc), dejar solo el canvas */
.wizard-readonly .mockup-tools,
.wizard-readonly .mockup-bar {
  display: none !important;
}
/* Step 3 — Quote template: ocultar settings panel salvo el botón de PDF */
.wizard-readonly .quote-settings-panel > div:not(:last-child) {
  pointer-events: none;
  opacity: 0.5;
}
.wizard-readonly .quote-settings-panel .btn-outline {
  /* "Finalizar cotización" — escribe a la BD, ocultar */
  display: none !important;
}
/* Banner persistente arriba del Step 0 (ya estilizado en lock-banner abajo) */
