/* Cotizador dentro del backoffice. Reutiliza las variables y componentes de backoffice.css. */
[hidden] { display: none !important; }

.field-label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--ink-faint); }
.field-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.82rem; color: var(--ink-soft); line-height: 1.35; }
.field-check input { margin-top: 3px; flex-shrink: 0; }
textarea.field-input { resize: vertical; min-height: 60px; }
.muted { color: var(--ink-faint); font-size: 0.82rem; }
.error-text { color: var(--orange-light); font-size: 0.85rem; min-height: 1.2em; margin-top: 8px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-small { padding: 5px 11px; font-size: 0.78rem; border-radius: 9px; }
.link-box { word-break: break-all; font-family: monospace; font-size: 0.8rem; background: var(--navy-darker); border: 1px solid var(--glass-border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--glass-border); background: var(--glass); color: var(--ink-soft); font-size: 0.8rem; cursor: pointer; }
.chip.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.chip .n { opacity: 0.75; margin-left: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.cot-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cot-head h2 { margin: 0 0 4px; font-family: monospace; font-size: 1.3rem; }
.cot-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cot-grid .k { font-size: 0.72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 3px; }
.cot-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.cot-card h3 { margin: 0 0 12px; font-size: 1rem; }
.cot-totales { margin-left: auto; width: min(100%, 300px); margin-top: 12px; }
.cot-totales div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.9rem; }
.clp { display: block; font-size: 0.72rem; font-weight: 400; color: var(--ink-faint); text-align: right; white-space: nowrap; }
.cot-totales span:last-child { text-align: right; }
.cot-badge-frec { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 700; letter-spacing: .3px; background: rgba(247,117,53,.16); color: var(--orange-light); border: 1px solid rgba(247,117,53,.4); }
.cot-totales .total { border-top: 1px solid var(--glass-border); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.05rem; }
.num { text-align: right; white-space: nowrap; }
.cot-lista { margin: 0; padding-left: 20px; font-size: 0.88rem; color: var(--ink-soft); }
.cot-lista li { margin-bottom: 6px; }
.cot-timeline { list-style: none; margin: 0; padding: 0; }
.cot-timeline li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--glass-border); font-size: 0.85rem; }
.cot-timeline li:first-child { border-top: none; }
.cot-timeline .cuando { color: var(--ink-faint); min-width: 118px; font-size: 0.78rem; }
.cot-pdf { width: 100%; height: 78vh; border: 1px solid var(--glass-border); border-radius: 12px; background: #fff; margin-top: 10px; }

/* Editor */
.cot-items { width: 100%; }
.cot-items th { font-size: 0.7rem; }
.cot-items td { padding: 6px 4px; vertical-align: top; border-bottom: 1px solid var(--glass-border); }
.cot-items .c-desc { width: 46%; }
.cot-items .c-n { width: 11%; }
.cot-items input.field-input, .cot-items textarea.field-input { padding: 7px 8px; }
.cot-items .sub { padding-top: 12px; }
.cot-fila { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.cot-fila > select { flex: 0 0 120px; }
.cot-fila > .field-input { flex: 1; }
.cot-barra { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 0; background: linear-gradient(transparent, var(--navy-deep) 35%); margin-top: 8px; flex-wrap: wrap; }

/* Resumen */
.cot-barras { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 10px; }
.cot-barras .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cot-barras .par { display: flex; align-items: flex-end; gap: 3px; height: 120px; width: 100%; justify-content: center; }
.cot-barras .b { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; }
.cot-barras .b.creadas { background: var(--teal); }
.cot-barras .b.aceptadas { background: var(--orange); }
.cot-barras .mes { font-size: 0.66rem; color: var(--ink-faint); margin-top: 6px; white-space: nowrap; }
.cot-leyenda { display: flex; gap: 14px; font-size: 0.75rem; color: var(--ink-faint); margin-top: 8px; }
.cot-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.cot-logo { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; }

#toast-cot { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); border: 1px solid var(--glass-border); color: var(--ink); padding: 11px 18px; border-radius: 12px; font-size: 0.88rem; z-index: 200; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); max-width: 90vw; }
#toast-cot.err { border-color: var(--danger, #E5484D); }
#toast-cot.ok { border-color: var(--success, #4CAF7D); }

select { color-scheme: dark; }
select option, select optgroup { background-color: #14313C; color: #EAF2F0; }

@media (max-width: 720px) {
  .cot-items thead { display: none; }
  .cot-items, .cot-items tbody, .cot-items tr, .cot-items td { display: block; width: 100%; }
  .cot-items tr { border: 1px solid var(--glass-border); border-radius: 12px; padding: 8px; margin-bottom: 10px; }
  .cot-items td { border: none; padding: 4px 0; }
  .cot-items .c-desc, .cot-items .c-n { width: 100%; }
  .cot-items td::before { content: attr(data-et); display: block; font-size: 0.7rem; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 2px; }
  .cot-items .sub { padding-top: 4px; text-align: left; }
}

/* Especificaciones con miniatura */
.cot-specs { list-style: none; margin: 0; padding: 0; }
.cot-specs li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--glass-border); font-size: 0.88rem; color: var(--ink-soft); }
.cot-specs li:first-child { border-top: none; }
.cot-specs .et { color: var(--orange); font-weight: 700; min-width: 22px; }
.cot-specs .cuerpo { flex: 1; min-width: 0; }
.cot-specs .url { display: block; font-size: 0.76rem; margin-top: 3px; word-break: break-all; color: var(--teal-light); }
.cot-specs .mini { flex: 0 0 auto; }
.cot-specs .mini img { display: block; max-width: 110px; max-height: 84px; border-radius: 8px; border: 1px solid var(--glass-border); background: #fff; }

/* Editor de especificaciones con vista previa de la imagen */
.cot-spec { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--glass-border); flex-wrap: wrap; }
.cot-spec:first-child { border-top: none; }
.cot-spec-campos { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cot-spec-prev { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.8rem; }
.cot-spec-prev img { max-width: 160px; max-height: 120px; border-radius: 10px; border: 1px solid var(--glass-border); background: #fff; }
.cot-spec-prev .prev-error { color: var(--orange-light); }
.cot-spec-acc { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
@media (max-width: 720px) { .cot-spec-acc { flex-direction: row; flex-wrap: wrap; } }
