/* ============================================================
   COTIZACIONES — C v2.2
   Misma gramática visual que Registrar venta (styles.css, bloque
   "REGISTRAR VENTA — C v2.2"): fondo sage, buscador en una tarjeta
   blanca, detalle como el carrito de "Venta actual", panel derecho
   como "Cobro" (cuerpo con scroll propio + pie fijo con el total y
   el CTA). Lima solo en "Guardar cotización". Todo scoped a .qv1-*,
   cero cambios a .btn/.panel/.input globales ni a otros módulos.
   ============================================================ */

/* Fondo sage de la sección completa (mismo --sage de .reg-view), sin
   márgenes negativos: se pinta .main solo cuando Cotizaciones está montado. */
.main:has(#quotationV1Root) { background: var(--sage); }

.qv1-shell {
  font-family: 'Instrument Sans', var(--sans);
  color: var(--ink);
  letter-spacing: normal;
}
.qv1-shell .btn { letter-spacing: normal; }

/* ---------- Encabezados ---------- */
.qv1-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.qv1-head h3 {
  font-family: 'Instrument Sans', var(--sans);
  font-size: 27px; font-weight: 700; line-height: 1.1; letter-spacing: normal;
  color: var(--forest); margin: 0;
}
.qv1-head p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.qv1-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qv1-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  border: 0; background: transparent; padding: 0; margin-bottom: 4px;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.qv1-back:hover { color: var(--forest); }

.qv1-btn-dark { background: var(--forest); color: #fff; border: none; border-radius: 12px; font-weight: 600; }
.qv1-btn-dark:hover { background: var(--brand-deep); color: #fff; }
.qv1-new { min-height: 44px; padding: 10px 18px; font-size: 14.5px; }

/* ---------- Chips de estado (discretos) ---------- */
.qv1-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; background: var(--sage-soft); color: var(--muted); }
.qv1-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.qv1-chip.is-blue  { background: var(--info-tint); color: var(--info); }
.qv1-chip.is-green { background: var(--pos-tint);  color: var(--pos); }
.qv1-chip.is-red   { background: var(--neg-tint);  color: var(--neg); }
.qv1-chip.is-amber { background: var(--warn-tint); color: var(--warn); }

/* ============================================================
   LISTADO
   ============================================================ */
.qv1-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card); border: 1.5px solid rgba(19,32,24,.10); border-radius: 18px;
  box-shadow: var(--shadow-card); margin-bottom: 14px;
}
.qv1-stats > div { padding: 14px 20px; border-left: 1px solid rgba(19,32,24,.08); min-width: 0; }
.qv1-stats > div:first-child { border-left: 0; }
.qv1-stats span { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.qv1-stats b { display: block; margin-top: 4px; font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--forest); font-variant-numeric: tabular-nums; }

.qv1-filters { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto auto; gap: 8px; align-items: center; background: var(--sage-soft); border-radius: 14px; padding: 8px; margin-bottom: 14px; }
.qv1-filters .input { background: var(--card); border: none; border-radius: 9px; min-height: 40px; padding: 9px 12px; font-weight: 500; }
.qv1-filters .input:focus { box-shadow: 0 0 0 2px var(--valen-active-focus-ring); }
.qv1-filters .btn { min-height: 40px; padding: 8px 16px; }
.qv1-filters .qv1-refresh { background: transparent; color: var(--muted); font-size: 17px; padding: 8px 12px; }
.qv1-filters .qv1-refresh:hover { background: rgba(255,255,255,.6); color: var(--forest); }

.qv1-table-card { background: var(--card); border-radius: 20px; box-shadow: 0 1px 2px rgba(16,33,26,.04), 0 8px 20px rgba(16,33,26,.05); overflow: hidden; }
.qv1-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.qv1-table th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid rgba(19,32,24,.08); white-space: nowrap; background: transparent; }
.qv1-table td { padding: 13px 16px; border-bottom: 1px solid rgba(19,32,24,.07); vertical-align: middle; }
.qv1-table tr:last-child td { border-bottom: 0; }
.qv1-table tbody tr { cursor: pointer; transition: background .12s; }
.qv1-table tbody tr:hover { background: #F7F9F4; }
.qv1-table td b { font-weight: 600; color: var(--forest); }
.qv1-table td small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.qv1-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qv1-actions { white-space: nowrap; text-align: right; }
.qv1-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-left: 2px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; position: relative;
}
.qv1-icon svg { width: 16px; height: 16px; }
.qv1-icon:hover { background: var(--sage-soft); color: var(--forest); }
.qv1-icon::after { content: ""; position: absolute; inset: -4px; }

.qv1-empty, .qv1-loading { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; padding: 20px; }
.qv1-empty b, .qv1-loading b { color: var(--forest); font-weight: 600; }
.qv1-spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--sage-soft); border-top-color: var(--brand); animation: qv1spin .8s linear infinite; }
@keyframes qv1spin { to { transform: rotate(360deg); } }

/* ============================================================
   EDITOR — 2 columnas (detalle | cliente + resumen)
   Desktop: areas "main side" / "notes side". Móvil: main → side → notes
   (productos, detalle, cliente, resumen, notas).
   ============================================================ */
.qv1-ed .qv1-head { margin-bottom: 14px; align-items: flex-start; }
.qv1-lock { display: flex; align-items: center; gap: 10px; background: var(--sage-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.qv1-lock::before { content: "ⓘ"; color: var(--muted); }

.qv1-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 33%, 372px);
  grid-template-areas: "main side" "notes side";
  grid-template-rows: auto 1fr;
  gap: 16px 18px;
  align-items: start;
}
.qv1-main  { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.qv1-side  { grid-area: side; min-width: 0; }
.qv1-notes { grid-area: notes; min-width: 0; }

/* ---------- Buscador (= .sale-search-row) ---------- */
.qv1-search { position: relative; }
.qv1-search-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1.5px solid rgba(19,32,24,.14); border-radius: 20px;
  box-shadow: var(--shadow-card); padding: 10px 12px 10px 20px;
}
.qv1-search-row:focus-within { border-color: rgba(19,32,24,.28); }
.qv1-search-ico { font-size: 21px; line-height: 1; color: var(--muted-2); flex: none; }
.qv1-search-input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  padding: 8px 0; font-size: 17px; font-weight: 500; line-height: 1.3; color: var(--ink);
}
.qv1-search-input::placeholder { color: var(--muted-2); font-weight: 400; }
.qv1-search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; } /* Escape limpia la búsqueda */
/* Mismo tratamiento que .vl-btn ("Venta libre"): blanco + borde lima. */
.qv1-free-btn {
  flex: none; min-height: 42px; padding: 9px 16px;
  background: var(--card); color: var(--forest); border: 1.5px solid var(--lime); border-radius: 12px; font-weight: 600;
}
.qv1-free-btn:hover { background: var(--sage-soft); border-color: var(--lime-dk); }

/* Resultados: selector tipo POS. Desktop flota sobre el detalle (solo en
   la columna izquierda, nunca sobre el resumen); ≤980px empuja el flujo. */
.qv1-results:empty { display: none; }
.qv1-results {
  margin-top: 8px; background: var(--card); border: 1px solid rgba(19,32,24,.10); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(16,33,26,.14); overflow: hidden;
}
.qv1-results-list { max-height: 360px; overflow-y: auto; }
.qv1-res {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px;
  width: 100%; text-align: left; padding: 11px 16px; border: 0; border-bottom: 1px solid rgba(19,32,24,.06);
  background: #fff; cursor: pointer; transition: background .12s;
}
.qv1-res:last-child { border-bottom: 0; }
.qv1-res:hover, .qv1-res:focus-visible { background: #F4F7EF; outline: none; }
.qv1-res-main b { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qv1-res-main small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qv1-res-stock { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--sage-soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.qv1-res-stock.is-out { background: var(--warn-tint); color: var(--warn); }
.qv1-res-price { font-size: 14.5px; font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 76px; text-align: right; }
.qv1-res-add { font-size: 12px; font-weight: 600; color: var(--forest); background: var(--sage-soft); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.qv1-res:hover .qv1-res-add { background: var(--lime); }
.qv1-res-msg { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 13.5px; color: var(--muted); }
.qv1-res-msg .qv1-spinner { width: 16px; height: 16px; border-width: 2px; }
.qv1-res-msg .btn { margin-left: auto; }

/* ---------- Detalle (= .venta-actual) ---------- */
.qv1-doc {
  container-type: inline-size;
  background: var(--card); border-radius: 20px;
  box-shadow: 0 1px 2px rgba(16,33,26,.04), 0 8px 20px rgba(16,33,26,.05);
  padding: 18px 24px 8px;
}
.qv1-doc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 6px; }
.qv1-doc-head h4 { font-family: 'Instrument Sans', var(--sans); font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--forest); margin: 0; }
.qv1-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.qv1-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 104px 104px 30px;
  grid-template-areas: "name qty unit total del";
  align-items: center; gap: 14px;
  padding: 13px 0; border-top: 1px solid rgba(19,32,24,.08);
}
.qv1-line-name { grid-area: name; min-width: 0; }
.qv1-line-name b { font-size: 14.5px; font-weight: 600; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.qv1-line-name .tag { margin-left: 6px; vertical-align: 2px; font-size: 10.5px; padding: 2px 7px; }
.qv1-line-name small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.qv1-qty { grid-area: qty; display: inline-flex; align-items: center; gap: 4px; background: var(--sage-soft); border-radius: 10px; padding: 4px; justify-self: start; }
.qv1-qty button {
  width: 28px; height: 28px; border-radius: 7px; border: 0; background: #fff; color: var(--ink);
  font-size: 15px; font-weight: 600; line-height: 1; cursor: pointer; position: relative;
}
.qv1-qty button:hover { opacity: .75; }
.qv1-qty button:first-child::after { content: ""; position: absolute; top: -8px; bottom: -8px; left: -10px; right: -3px; }
.qv1-qty button:last-child::after  { content: ""; position: absolute; top: -8px; bottom: -8px; left: -3px; right: -10px; }
.qv1-qty input { width: 38px; height: 28px; border: 0; background: transparent; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink); padding: 0; -moz-appearance: textfield; }
.qv1-qty input::-webkit-outer-spin-button, .qv1-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qv1-qty input:focus { outline: 2px solid var(--valen-active-focus-ring); border-radius: 6px; }
.qv1-qty.is-static { background: transparent; padding: 0 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.qv1-line-unit { grid-area: unit; text-align: right; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qv1-line-unit small { font-size: 11.5px; margin-left: 3px; color: var(--muted-2); }
.qv1-unit-input {
  width: 100%; max-width: 104px; height: 34px; border: 0; border-radius: 8px; background: var(--sage-soft);
  text-align: right; padding: 0 9px; font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.qv1-unit-input:focus { outline: 2px solid var(--valen-active-focus-ring); }
.qv1-line-total { grid-area: total; text-align: right; font-size: 14.5px; font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qv1-line-del {
  grid-area: del; justify-self: end; position: relative;
  width: 26px; height: 26px; border-radius: 999px; border: 1.5px solid rgba(19,32,24,.14); background: #fff;
  color: var(--muted-2); font-size: 15px; line-height: 1; cursor: pointer;
}
.qv1-line-del:hover { background: var(--neg-tint); border-color: var(--neg-tint); color: var(--neg); }
.qv1-line-del::after { content: ""; position: absolute; inset: -8px; }
.qv1-line.is-locked { grid-template-columns: minmax(0, 1fr) auto 104px 104px; grid-template-areas: "name qty unit total"; }

.qv1-lines-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 12px 30px; border-top: 1px solid rgba(19,32,24,.08); text-align: center; }
.qv1-lines-empty b { font-size: 14.5px; font-weight: 600; color: var(--forest); }
.qv1-lines-empty span { font-size: 13px; color: var(--muted); }

/* Detalle angosto (1024 con panel derecho, o móvil): 2 filas por línea,
   igual criterio que .cart-item ≤480px en Registrar. */
@container (max-width: 520px) {
  .qv1-line {
    grid-template-columns: auto minmax(0, 1fr) auto 30px;
    grid-template-areas: "name name name del" "qty unit total total";
    row-gap: 8px; column-gap: 12px;
  }
  .qv1-line.is-locked { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "name name name" "qty unit total"; }
  .qv1-line-unit { text-align: left; }
  .qv1-line-del { align-self: start; }
}

/* ---------- Notas (secundario: sin tarjeta, sobre el sage) ---------- */
.qv1-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); line-height: 1.3; margin-bottom: 10px; }
.qv1-notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qv1-field { display: block; min-width: 0; }
.qv1-field > span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; line-height: 1.35; }
.qv1-field > span em { font-style: normal; color: var(--muted-2); }
.qv1-notes textarea {
  width: 100%; min-height: 64px; resize: vertical; border: 1.5px solid rgba(19,32,24,.10); border-radius: 12px;
  background: var(--card); padding: 9px 12px; font-size: 13.5px; line-height: 1.45; color: var(--ink);
}
.qv1-notes textarea:focus { outline: none; border-color: rgba(19,32,24,.28); box-shadow: 0 0 0 3px var(--valen-active-focus-ring); }
.qv1-notes textarea:disabled { background: transparent; color: var(--muted); }

/* ---------- Panel derecho (= .cobro) ---------- */
.qv1-side-card {
  container-type: inline-size;
  background: var(--card); border: 1.5px solid rgba(19,32,24,.12); border-radius: 20px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.qv1-side-body { padding: 16px 22px 6px; }
.qv1-side-sec + .qv1-side-sec { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(19,32,24,.09); }
.qv1-side .qv1-eyebrow { margin-bottom: 8px; }
.qv1-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.qv1-side .qv1-field > span { font-size: 11.5px; margin-bottom: 3px; }
.qv1-fields .span2 { grid-column: span 2; }
.qv1-in {
  width: 100%; min-width: 0; height: 38px; border: 0; border-radius: 9px; background: var(--sage-soft);
  padding: 0 11px; font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.qv1-in:focus { outline: none; box-shadow: 0 0 0 2px var(--valen-active-focus-ring); background: #fff; }
.qv1-in:disabled { background: transparent; padding-left: 0; color: var(--ink); }
.qv1-in::placeholder { color: var(--muted-2); font-weight: 400; }

.qv1-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 14px; }
.qv1-row span { color: var(--muted); }
.qv1-row b { font-weight: 600; color: var(--forest); font-variant-numeric: tabular-nums; }
.qv1-row.is-disc b { color: var(--neg); }
.qv1-row.is-disc.is-zero b { color: var(--muted-2); font-weight: 500; }

.qv1-disc { margin: 6px 0 4px; }
/* Segmento = .disc-seg de Cobro */
.qv1-seg { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 2px; background: var(--sage-soft); border-radius: 9px; padding: 3px; }
.qv1-seg button { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; padding: 0 6px; }
.qv1-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,33,26,.08); }
.qv1-seg button:disabled { cursor: not-allowed; opacity: .6; }
.qv1-disc-val { position: relative; margin-top: 6px; }
.qv1-disc-val .qv1-in { padding-left: 30px; }
.qv1-disc-val i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.qv1-disc-val[hidden] { display: none; }
.qv1-disc-help { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.4; }

.qv1-side-foot { padding: 6px 22px 18px; }
/* Total = .rs-total de Registrar (TOTAL A PAGAR), adaptado. */
.qv1-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 0 2px; border-top: 1px solid rgba(19,32,24,.09); }
.qv1-total span { font-size: 11.5px; font-weight: 500; letter-spacing: .04em; color: var(--muted-2); white-space: nowrap; }
.qv1-total b { font-family: 'Instrument Sans', var(--sans); font-size: 38px; font-weight: 700; line-height: 1.05; color: var(--forest); font-variant-numeric: tabular-nums; white-space: nowrap; }
@container (max-width: 330px) {
  .qv1-total { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* CTA: lima solo mientras sea una acción disponible (mismo criterio que #cobrarBtn). */
.qv1-save { margin-top: 12px; min-height: 50px; border-radius: 12px; font-size: 15.5px; font-weight: 600; }
.qv1-save:not(:disabled) { background: var(--lime); color: #1C2A14; }
.qv1-save:not(:disabled):hover { background: var(--lime-dk); color: #fff; }
.qv1-save:disabled { background: var(--sage-soft); color: var(--muted-2); cursor: not-allowed; }

/* Acciones del documento: una fila callada, ninguna compite con el CTA. */
.qv1-doc-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.qv1-doc-actions button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 50px; border: 1.5px solid rgba(19,32,24,.10); border-radius: 11px; background: #fff;
  color: var(--forest); font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 2px; gap: 3px;
}
.qv1-doc-actions button svg { color: var(--muted); }
.qv1-doc-actions button:hover { background: var(--sage-soft); border-color: transparent; }
.qv1-ed.is-locked .qv1-doc-actions { margin-top: 12px; }

/* Estado: acciones pequeñas, texto; Anular como enlace. */
.qv1-status-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qv1-status-btns button {
  min-height: 34px; border: 0; border-radius: 8px; background: var(--sage-soft); color: var(--ink);
  font-size: 12.5px; font-weight: 600; padding: 0 11px; cursor: pointer;
}
.qv1-status-btns button:hover { background: #D6DDC6; }
.qv1-status-btns .qv1-cancel { background: transparent; color: var(--neg); margin-left: auto; padding: 0 4px; }
.qv1-status-btns .qv1-cancel:hover { background: transparent; text-decoration: underline; }
.qv1-foot-note { margin: 12px 0 8px; font-size: 11.5px; line-height: 1.4; color: var(--muted-2); }

/* Desktop: panel derecho fijo con altura real; solo el cuerpo (cliente +
   descuento) cede espacio y scrollea; total + CTA nunca se recortan
   (mismo principio que .cobro-body / .cobro-foot en Registrar). */
@media (min-width: 981px) {
  .qv1-side { position: sticky; top: 76px; align-self: start; }
  .qv1-side-card { max-height: calc(100dvh - 92px); }
  .qv1-side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .qv1-side-foot { flex: none; }
  .qv1-search { z-index: 30; }
  .qv1-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; }
}
@media (min-width: 981px) and (max-width: 1120px) {
  .qv1-head h3 { font-size: 23px; }
  .qv1-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
  .qv1-side-body { padding: 16px 18px 4px; }
  .qv1-side-foot { padding: 6px 18px 16px; }
  .qv1-doc { padding: 16px 18px 6px; }
  .qv1-search-input { font-size: 16px; }
  .qv1-total b { font-size: 34px; }
}

@media (max-width: 980px) {
  .qv1-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side" "notes"; grid-template-rows: auto; }
  .qv1-head h3 { font-size: 24px; }
  .qv1-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qv1-stats > div:nth-child(3) { border-left: 0; }
  .qv1-stats > div:nth-child(n+3) { border-top: 1px solid rgba(19,32,24,.08); }
}

/* Táctil: 44px mínimo en controles (mismo --target-touch del sistema). */
@media (max-width: 760px) {
  .qv1-in, .qv1-filters .input, .qv1-filters .btn, .qv1-seg button, .qv1-status-btns button, .qv1-free-btn { min-height: var(--target-touch); }
  .qv1-in { height: var(--target-touch); font-size: 16px; }
  .qv1-search-input, .qv1-notes textarea, .qv1-unit-input, .qv1-qty input { font-size: 16px; }
  .qv1-qty button { width: 34px; height: 34px; }
  .qv1-qty input { height: 34px; }
  .qv1-unit-input { height: 40px; }
  .qv1-icon { width: 40px; height: 40px; }
  .qv1-filters { grid-template-columns: minmax(0, 1fr) auto; }
  .qv1-filters .input[type="search"] { grid-column: 1 / -1; }
  .qv1-filters select.input { grid-column: 1 / -1; }
  .qv1-filters .btn-primary, .qv1-filters .qv1-btn-dark { width: 100%; }
}

@media (max-width: 600px) {
  .qv1-head { flex-direction: column; align-items: stretch; }
  .qv1-head > .btn { width: 100%; min-height: var(--target-touch); }
  .qv1-search-row { flex-wrap: wrap; padding: 10px 12px 12px 16px; gap: 8px 10px; }
  .qv1-search-input { flex-basis: calc(100% - 40px); }
  .qv1-free-btn { width: 100%; }
  .qv1-res { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main price" "stock add"; row-gap: 6px; padding: 12px 14px; }
  .qv1-res-main { grid-area: main; } .qv1-res-price { grid-area: price; } .qv1-res-stock { grid-area: stock; justify-self: start; } .qv1-res-add { grid-area: add; justify-self: end; }
  .qv1-doc { padding: 14px 16px 4px; }
  .qv1-side-body { padding: 16px 16px 4px; }
  .qv1-side-foot { padding: 6px 16px 16px; }
  .qv1-notes-grid { grid-template-columns: 1fr; }
  .qv1-fields { grid-template-columns: 1fr; }
  .qv1-fields .span2 { grid-column: auto; }
  /* Tabla → filas compactas tipo tarjeta, sin scroll horizontal. */
  .qv1-table thead { display: none; }
  .qv1-table, .qv1-table tbody { display: block; }
  .qv1-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 13px 16px; border-bottom: 1px solid rgba(19,32,24,.07); }
  .qv1-table tr:last-child { border-bottom: 0; }
  .qv1-table td { display: block; padding: 0; border: 0; }
  .qv1-table td.qv1-c-num { grid-column: 1; grid-row: 1; }
  .qv1-table td.qv1-c-total { grid-column: 2; grid-row: 1; }
  .qv1-table td.qv1-c-cust { grid-column: 1; grid-row: 2; }
  .qv1-table td.qv1-c-status { grid-column: 2; grid-row: 2; text-align: right; }
  .qv1-table td.qv1-c-until, .qv1-table td.qv1-c-user { display: none; }
  .qv1-table td.qv1-actions { grid-column: 1 / -1; grid-row: 3; text-align: left; margin-left: -8px; }
}
@media (max-width: 360px) {
  .qv1-doc-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   Diálogos, toast
   ============================================================ */
.qv1-overlay { position: fixed; inset: 0; background: rgba(12,31,26,.42); z-index: 999998; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: 'Instrument Sans', var(--sans); }
.qv1-dialog { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 20px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.22); }
.qv1-dialog.small { width: min(420px, 100%); }
.qv1-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.qv1-dialog-head b { display: block; font-size: 18px; font-weight: 600; color: var(--forest); }
.qv1-dialog-head span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.qv1-dialog-head button { width: 36px; height: 36px; border: 0; border-radius: 999px; background: var(--sage-soft); color: var(--muted); font-size: 18px; cursor: pointer; flex: none; }
.qv1-dialog .qv1-fields { gap: 10px 12px; }
.qv1-dialog .qv1-field > span { font-size: 12.5px; }
.qv1-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.qv1-dialog-actions .btn { min-height: 44px; }
.qv1-dialog-actions .qv1-add { background: var(--forest); color: #fff; border-radius: 12px; }
.qv1-dialog-actions .qv1-add:hover { background: var(--brand-deep); }
.qv1-print-options { display: grid; gap: 8px; }
.qv1-print-options button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1.5px solid rgba(19,32,24,.10); border-radius: 14px; background: #fff; padding: 13px 15px; cursor: pointer; min-height: var(--target-touch); }
.qv1-print-options button:hover { background: var(--sage-soft); border-color: transparent; }
.qv1-print-options b { font-size: 14.5px; font-weight: 600; color: var(--forest); }
.qv1-print-options span { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) {
  .qv1-dialog { padding: 18px; }
  .qv1-dialog .qv1-fields { grid-template-columns: 1fr; }
  .qv1-dialog .qv1-fields .span2 { grid-column: auto; }
}

.qv1-toast { position: fixed; right: 22px; bottom: 22px; z-index: 999999; max-width: calc(100vw - 44px); padding: 12px 16px; border-radius: 12px; color: #fff; font-family: 'Instrument Sans', var(--sans); font-size: 14px; font-weight: 600; box-shadow: 0 15px 40px rgba(0,0,0,.2); background: var(--brand-deep); }
.qv1-toast.err { background: #a33e37; }

/* ============================================================
   CONFIGURACIÓN → Cotizaciones y transferencias
   ============================================================ */
.qv1-settings-card {
  margin-top: 16px; background: var(--card); border: 1.5px solid rgba(19,32,24,.10); border-radius: 20px;
  box-shadow: var(--shadow-card); padding: 22px 24px; font-family: 'Instrument Sans', var(--sans); color: var(--ink);
}
.qv1-settings-card > header h4 { font-family: 'Instrument Sans', var(--sans); font-size: 18px; font-weight: 600; color: var(--forest); margin: 0; }
.qv1-settings-card > header p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.qv1-cfg-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(19,32,24,.09); }
.qv1-cfg-group .qv1-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.qv1-cfg-group .qv1-fields .span3 { grid-column: 1 / -1; }
.qv1-settings-card .qv1-field > span { font-size: 12.5px; }
.qv1-settings-card textarea.qv1-in { height: auto; min-height: 84px; padding: 10px 11px; resize: vertical; line-height: 1.45; }
.qv1-days { position: relative; }
.qv1-days .qv1-in { padding-right: 46px; }
.qv1-days i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; color: var(--muted); }
.qv1-switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; margin-bottom: 12px; min-height: var(--target-touch); }
.qv1-switch input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.qv1-settings-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.qv1-settings-actions .btn { min-height: 44px; }
.qv1-ro-note { font-size: 12.5px; color: var(--muted); margin-right: auto; }
@media (max-width: 760px) {
  .qv1-settings-card { padding: 18px 16px; }
  .qv1-cfg-group .qv1-fields { grid-template-columns: 1fr; }
  .qv1-settings-actions { flex-direction: column; align-items: stretch; }
}
