/* ============================================================
   VENTI · Estilos principales
   Glassmorphism oscuro + naranja Pulso + Bricolage Grotesque
   Réplica fiel de preview-premium.html
   ============================================================ */

:root {
  --pulso: #ff5b04;
  --pulso-soft: #ff7a33;
  --bg-0: #0a0a0f;
  --bg-1: #12121a;
  --glass: rgba(255,255,255,0.045);
  --glass-strong: rgba(255,255,255,0.07);
  --stroke: rgba(255,255,255,0.10);
  --stroke-soft: rgba(255,255,255,0.06);
  --text: #f4f4f6;
  --text-dim: rgba(244,244,246,0.55);
  --text-faint: rgba(244,244,246,0.35);
  --radius: 20px;
  --radius-sm: 14px;
  --danger: #ef4444;
  --success: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 12% -5%, rgba(255,91,4,0.16), transparent 60%),
    radial-gradient(800px 600px at 95% 8%, rgba(120,80,255,0.12), transparent 55%),
    radial-gradient(700px 700px at 50% 110%, rgba(29,158,117,0.10), transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 64px;
}

/* ---- App container ---- */
.app {
  width: 100%;
  max-width: 1060px;
}

/* ---- Header / Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 48px; height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--pulso) 0%, #ff8a3d 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(255,91,4,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
  cursor: pointer;
}
.logo i { font-size: 26px; color: #fff; }
.brand h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1;
}
.brand p { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* ---- Nav ---- */
.nav {
  display: flex; align-items: center; gap: 6px;
}
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
}
.nav-btn i { font-size: 16px; }
.nav-btn:hover, .nav-btn.active {
  color: var(--text);
  border-color: rgba(255,91,4,0.4);
  background: rgba(255,91,4,0.08);
}
.nav-btn.active i { color: var(--pulso); }

.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
}
.pill i { color: var(--pulso); font-size: 16px; }

/* ---- Grid principal (generador) ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
}
.col { display: flex; flex-direction: column; gap: 16px; }

/* ---- Tarjeta de vidrio ---- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
}

.eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* ---- Select dropdown ---- */
.select-wrap {
  position: relative;
}
.select-trigger {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  width: 100%;
}
.select-trigger:hover { border-color: rgba(255,91,4,0.4); background: rgba(255,91,4,0.05); }
.icon-chip {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-chip i { font-size: 21px; }
.icon-chip.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-chip.sm i { font-size: 17px; }
.meta { flex: 1; min-width: 0; }
.meta strong { font-size: 14px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta span { font-size: 12px; color: var(--text-dim); }
.chev { color: var(--text-faint); font-size: 18px; flex-shrink: 0; }

.select-wrap { position: relative; z-index: 1; }
.select-wrap:has(.select-dropdown.open) { z-index: 999; }
.select-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 6px;
  z-index: 999;
  max-height: 260px; overflow-y: auto;
  display: none;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.select-dropdown.open { display: block; }
.select-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: background .15s;
}
.select-option:hover { background: rgba(255,91,4,0.08); }
.select-option.selected { background: rgba(255,91,4,0.12); color: var(--pulso); }

/* ---- Pieza selector (chips horizontales) ---- */
.pieza-list {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.pieza-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke-soft);
  background: var(--glass);
  font-size: 12px; font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
}
.pieza-chip:hover { border-color: var(--stroke); color: var(--text); }
.pieza-chip.active {
  color: var(--text);
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255,91,4,0.2), rgba(255,91,4,0.06));
  box-shadow: 0 0 0 1px rgba(255,91,4,0.45);
}

/* ---- Model list ---- */
.model-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.badge-soft {
  font-size: 11px; font-weight: 600;
  color: #5dcaa5;
  background: rgba(29,158,117,0.14);
  border: 1px solid rgba(29,158,117,0.25);
  padding: 3px 10px; border-radius: 999px;
}
.model-list { max-height: 280px; overflow-y: auto; }
.model {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-soft);
  background: var(--glass-strong);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .2s;
}
.model:hover { border-color: var(--stroke); }
.model.active {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255,91,4,0.18), rgba(255,91,4,0.06));
  box-shadow: 0 0 0 1px rgba(255,91,4,0.5), 0 8px 20px rgba(255,91,4,0.15);
}
.model .meta strong { font-size: 13px; }
.model .meta span {
  font-size: 11px; color: var(--text-dim);
  font-family: 'Space Grotesk', monospace;
}
.model .check { color: var(--pulso); font-size: 19px; display: none; }
.model.active .check { display: block; }

/* ---- Botón primario ---- */
.btn-primary {
  width: 100%; margin-top: 14px;
  background: linear-gradient(135deg, var(--pulso) 0%, #ff8a3d 100%);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px; font-weight: 600; font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255,91,4,0.4), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform .15s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(255,91,4,0.5), inset 0 1px 0 rgba(255,255,255,0.35); }
.btn-primary:active { transform: translateY(0) scale(0.99); }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed;
  transform: none !important;
}
.btn-primary i { font-size: 19px; }

/* ---- Spinner ---- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 8px; }
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-soft);
  background: var(--glass);
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  cursor: pointer; transition: all .2s;
  font-family: 'Inter', sans-serif;
}
.tab i { font-size: 18px; }
.tab.active {
  color: var(--text);
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255,91,4,0.2), rgba(255,91,4,0.05));
  box-shadow: 0 0 0 1px rgba(255,91,4,0.45);
}
.tab.active i { color: var(--pulso); }

/* ---- Output / WhatsApp preview ---- */
.output-area { flex: 1; min-height: 300px; }
.wa-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.wa-head .left { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.wa-head .left i { color: #25d366; font-size: 19px; }

.btn-ghost {
  display: flex; align-items: center; gap: 6px;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  color: var(--text); border-radius: 10px; padding: 7px 12px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .2s;
  font-family: 'Inter', sans-serif;
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-ghost i { font-size: 16px; }

.output-content {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  min-height: 120px;
  padding: 14px 16px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  max-height: 500px;
  overflow-y: auto;
}
.output-content.empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 14px; min-height: 200px;
}

.output-image {
  display: none;
  align-items: center; justify-content: center;
  min-height: 200px;
}
.output-image img {
  max-width: 100%; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-soft);
}

/* ---- Metrics ---- */
.metrics { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.metric {
  font-size: 11px; font-weight: 500; font-family: 'Space Grotesk', monospace;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--stroke-soft);
}
.m-blue { color: #85b7eb; background: rgba(55,138,221,0.12); }
.m-amber { color: #efb15f; background: rgba(239,159,39,0.12); }
.m-green { color: #5dcaa5; background: rgba(29,158,117,0.12); }

/* ---- Actions ---- */
.actions { display: flex; gap: 10px; }
.btn-sec {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--glass); border: 1px solid var(--stroke);
  color: var(--text); border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background .2s, border-color .2s;
  font-family: 'Inter', sans-serif;
}
.btn-sec:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,91,4,0.4); }
.btn-sec i { font-size: 16px; }

.fill { flex: 1; }

/* ---- Views ---- */
.view { display: none; }
.view.active { display: block; }

/* ---- CRUD Tables ---- */
.crud-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.crud-header h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 22px; font-weight: 700;
}
.btn-add {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--pulso) 0%, #ff8a3d 100%);
  color: #fff; border: none;
  border-radius: 10px; padding: 10px 18px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 6px 20px rgba(255,91,4,0.35);
  transition: transform .15s;
}
.btn-add:hover { transform: translateY(-1px); }
.btn-add i { font-size: 17px; }

.crud-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.crud-table th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  text-align: left;
  padding: 0 14px 8px;
}
.crud-table td {
  padding: 14px;
  background: var(--glass);
  border-top: 1px solid var(--stroke-soft);
  border-bottom: 1px solid var(--stroke-soft);
  font-size: 13px;
}
.crud-table td:first-child { border-left: 1px solid var(--stroke-soft); border-radius: 12px 0 0 12px; }
.crud-table td:last-child { border-right: 1px solid var(--stroke-soft); border-radius: 0 12px 12px 0; }

.crud-table .actions-cell {
  display: flex; gap: 6px; justify-content: flex-end;
}
.btn-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--stroke-soft);
  background: var(--glass);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
  font-size: 16px;
}
.btn-icon:hover { background: rgba(255,91,4,0.1); border-color: rgba(255,91,4,0.4); color: var(--text); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.4); color: var(--danger); }

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal h3 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 18px; font-weight: 700; margin-bottom: 20px;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: rgba(255,91,4,0.5);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-group .hint { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

.modal-actions {
  display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end;
}
.btn-cancel {
  padding: 10px 20px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .2s;
}
.btn-cancel:hover { background: rgba(255,255,255,0.1); }
.btn-save {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--pulso) 0%, #ff8a3d 100%);
  border: none; color: #fff;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 6px 20px rgba(255,91,4,0.35);
}

/* ---- Combo row (precios de oferta) ---- */
.combo-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.combo-row input {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
}
.combo-row input:focus { outline: none; border-color: rgba(255,91,4,0.5); }
.combo-row input[type="number"] { width: 80px; }
.combo-row input[type="text"] { flex: 1; min-width: 80px; }
.combo-row label.check-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-dim);
  text-transform: none; letter-spacing: 0;
  margin-bottom: 0; cursor: pointer; white-space: nowrap;
}
.combo-row .btn-icon { width: 28px; height: 28px; flex-shrink: 0; }

/* ---- WhatsApp bubbles (output) ---- */
.wa-thread { display: flex; flex-direction: column; gap: 14px; }
.wa-bubble-group { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.bubble-separator {
  font-size: 10px; font-weight: 500; letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 0 4px;
}
.bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 16px 16px 16px 4px;
  font-size: 13px; line-height: 1.55;
}
.bubble.green {
  background: linear-gradient(135deg, rgba(37,211,102,0.22), rgba(37,211,102,0.10));
  border: 1px solid rgba(37,211,102,0.25);
}
.bubble.gray {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
}

/* ---- Content card (audio, imagenes) ---- */
.content-card {
  padding: 14px 16px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.6;
}

/* ---- Ficha LucidSales cards ---- */
.ficha-sections { display: flex; flex-direction: column; gap: 10px; }
.ficha-card {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ficha-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,91,4,0.06);
  border-bottom: 1px solid var(--stroke-soft);
}
.ficha-card-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--pulso-soft);
}
.ficha-card-head .btn-copy-section {
  padding: 4px 8px; font-size: 11px;
}
.ficha-card-head .btn-copy-section i { font-size: 14px; }
.ficha-card-body {
  padding: 12px 14px;
  font-size: 13px; line-height: 1.6;
  color: var(--text);
}

/* [VERIFICAR] highlight */
.verify-tag {
  display: inline;
  background: rgba(239,177,95,0.18);
  border: 1px solid rgba(239,177,95,0.35);
  color: #efb15f;
  font-size: 11px; font-weight: 700;
  font-family: 'Space Grotesk', monospace;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---- Analyze photo thumbs ---- */
.analyze-thumb {
  width: 64px; height: 64px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--stroke-soft);
  position: relative;
  display: inline-block;
}
.analyze-thumb-wrap {
  position: relative; display: inline-block;
}
.analyze-thumb-wrap .remove-thumb {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ---- Palette swatches ---- */
.swatch {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 2px solid var(--stroke);
  display: inline-block;
  cursor: default;
  position: relative;
}
.swatch::after {
  content: attr(data-hex);
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-family: 'Space Grotesk', monospace;
  color: var(--text-faint); white-space: nowrap;
  display: none;
}
.swatch:hover::after { display: block; }

/* ---- Multi-result sections (text accordion) ---- */
.result-section {
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.result-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--glass);
  cursor: pointer;
  transition: background .15s;
}
.result-section-head:hover { background: rgba(255,91,4,0.05); }
.result-section-title {
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.result-section-title i { font-size: 16px; transition: transform .2s; }
.result-section.open .result-section-title i.chevron { transform: rotate(180deg); }
.result-section-actions { display: flex; align-items: center; gap: 6px; }
.result-section-cost {
  font-size: 11px; font-family: 'Space Grotesk', monospace;
  color: #5dcaa5;
}
.result-section-body {
  display: none;
  padding: 12px 14px;
  border-top: 1px solid var(--stroke-soft);
}
.result-section.open .result-section-body { display: block; }
.result-section.loading .result-section-head {
  color: var(--text-faint);
}
.result-section.error .result-section-head {
  border-left: 3px solid var(--danger);
}

/* ---- Version selector ---- */
.version-select {
  background: var(--glass);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: 'Space Grotesk', monospace;
  cursor: pointer;
}
.version-select:focus { outline: none; border-color: rgba(255,91,4,0.5); }
.version-select option { background: var(--bg-1); color: var(--text); }

/* ---- Historial table ---- */
.historial-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  font-size: 13px;
}
.historial-row:last-child { border-bottom: none; }
.historial-pieza {
  font-weight: 600; min-width: 140px;
}
.historial-model {
  font-family: 'Space Grotesk', monospace;
  font-size: 11px; color: var(--text-dim);
  min-width: 120px;
}
.historial-cost {
  font-family: 'Space Grotesk', monospace;
  font-size: 11px; color: #5dcaa5;
  min-width: 80px;
}
.historial-date {
  font-size: 11px; color: var(--text-faint);
  min-width: 130px;
}
.historial-preview {
  flex: 1; min-width: 0;
  font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Pieza checkbox style ---- */
.pieza-chip input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 14px; height: 14px;
  border: 2px solid var(--stroke);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.pieza-chip input[type="checkbox"]:checked {
  background: var(--pulso);
  border-color: var(--pulso);
}
.pieza-chip input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -2px; left: 1px;
  font-size: 11px; color: #fff; font-weight: 700;
}

/* ---- Batch template selectors (with thumbnails) ---- */
.batch-tpl-selectors { display: flex; flex-direction: column; gap: 8px; }
.batch-tpl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s;
  position: relative;
}
.batch-tpl-row:hover { border-color: rgba(255,91,4,0.3); }
.batch-tpl-row.selected {
  border-color: rgba(255,91,4,0.5);
  background: rgba(255,91,4,0.04);
}
.batch-tpl-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--stroke-soft);
  flex-shrink: 0;
  background: var(--glass);
}
.batch-tpl-thumb.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-faint);
}
.batch-tpl-info { flex: 1; min-width: 0; }
.batch-tpl-type {
  font-size: 10px; font-weight: 600; color: var(--pulso-soft);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.batch-tpl-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.batch-tpl-none { font-size: 12px; color: var(--text-faint); }
/* Dropdown inside row */
.batch-tpl-dd-wrap {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 4px;
  z-index: 100;
  display: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.batch-tpl-dd-wrap.open { display: block; }
.batch-tpl-dd-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
}
.batch-tpl-dd-opt:hover { background: rgba(255,91,4,0.08); }
.batch-tpl-dd-opt img {
  width: 36px; height: 36px;
  border-radius: 6px; object-fit: cover;
  border: 1px solid var(--stroke-soft);
}

/* ---- Batch image grid (3 images) ---- */
.img-batch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.img-batch-card {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.img-batch-card img {
  width: 100%; display: block;
  aspect-ratio: 1;
  object-fit: cover;
}
.img-batch-card .batch-label {
  padding: 8px 10px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pulso-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.img-batch-card .batch-label a {
  color: var(--text-dim);
  font-size: 16px;
  transition: color .2s;
}
.img-batch-card .batch-label a:hover { color: var(--text); }
.img-batch-card.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
}
.img-batch-card.loading .spinner { width: 24px; height: 24px; }
.img-batch-card.error {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px; color: var(--danger); font-size: 12px;
  text-align: center; padding: 12px;
}
@media (max-width: 760px) {
  .img-batch-grid { grid-template-columns: 1fr; }
}

/* ---- Image upload zone (modal) ---- */
.img-upload-zone {
  border: 2px dashed var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--glass);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-upload-zone:hover, .img-upload-zone.drag-over {
  border-color: var(--pulso);
  background: rgba(255,91,4,0.04);
}
.img-upload-zone.has-image {
  padding: 8px;
  border-style: solid;
  border-color: rgba(34,197,94,0.4);
}
.img-upload-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
  object-fit: contain;
}
.img-upload-zone.has-image .img-upload-placeholder { display: none; }

/* ---- Image template grid (CRUD) ---- */
.img-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.img-tpl-card {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s;
}
.img-tpl-card:hover { border-color: rgba(255,91,4,0.3); }
.img-tpl-card img {
  width: 100%; height: 140px;
  object-fit: cover;
  display: block;
}
.img-tpl-card-body {
  padding: 10px 12px;
}
.img-tpl-card-body strong {
  font-size: 13px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.img-tpl-card-body .tipo-badge {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pulso-soft);
  margin-top: 2px;
}
.img-tpl-card-body .card-actions {
  display: flex; gap: 4px; margin-top: 8px; justify-content: flex-end;
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px; font-weight: 500;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.4); color: #86efac; }
.toast.error { background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4); color: #fca5a5; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-faint);
}
.empty-state i { font-size: 36px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .nav { width: 100%; overflow-x: auto; }
}
