/* =====================================================================
   CAPACITACIONES · Grupo Garcha · base
   Misma identidad que Mesa de Control y Vales: industrial y legible.
   Lo propio de este sistema está en cap.css.
   ===================================================================== */
:root {
  --brand: #FFD100;
  --brand-600: #F0C400;
  --brand-ink: #7A5F00;
  --brand-soft: rgba(255, 209, 0, .16);
  --on-brand: #0A0E13;

  --ink: #0A0E13;
  --steel-950: #0E141B;
  --steel-900: #131A23;
  --steel-800: #1B242F;
  --steel-700: #263241;
  --steel-400: #7C8B9C;
  --steel-200: #D3DAE1;
  --steel-100: #E9EDF1;
  --steel-50: #F4F6F8;

  --tx: #131A23;
  --tx-soft: #4E5C6B;
  --tx-mute: #6B7A8B;
  --line: #E1E6EB;
  --surface: #FFFFFF;
  --page: #F4F6F8;

  /* Estados (siempre con icono + texto, nunca solo color) */
  --ok: #0ca30c;
  --ok-ink: #006300;
  --ok-soft: #e3f5e3;
  --warn: #fab219;
  --warn-ink: #7a5200;
  --warn-soft: #fff4d9;
  --crit: #d03b3b;
  --crit-ink: #a42727;
  --crit-soft: #fbe6e6;
  --info-soft: #e8f1fc;
  --info-ink: #1c5cab;

  /* Gráficas: una sola serie (validada contra fondo claro), cuadrícula y ejes discretos */
  --serie-1: #2a78d6;
  --grid: #e6eaee;
  --eje: #c3cbd3;
  --muted-chart: #6b7a8b;

  --r: 4px;
  --r-lg: 6px;
  --sh-sm: 0 1px 2px rgba(10, 14, 19, .06), 0 2px 8px rgba(10, 14, 19, .04);
  --sh-lg: 0 12px 28px rgba(10, 14, 19, .14), 0 32px 64px rgba(10, 14, 19, .12);
  --f-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --lateral: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--tx);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--info-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.mono { font-family: var(--f-mono); letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mute { color: var(--tx-mute); }
.chico { font-size: 12px; }
.fuerte { font-weight: 600; }
.nowrap { white-space: nowrap; }
.fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.separa { justify-content: space-between; }
.apila { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.cargando { width: 34px; height: 34px; margin: 22vh auto; border: 3px solid var(--steel-200); border-top-color: var(--brand-600); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

/* ============================ ESTRUCTURA ============================ */
.app { display: grid; grid-template-columns: var(--lateral) 1fr; min-height: 100vh; }
.lateral {
  background: var(--steel-950); color: #EBF0F5;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.lateral .marca { padding: 20px 20px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.lateral .marca img { height: 34px; width: auto; display: block; }
.producto {
  font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: .1em;
  margin-top: 12px; color: #fff; display: flex; align-items: center; gap: 8px; text-transform: uppercase;
}
.producto::before { content: ''; width: 4px; height: 18px; background: var(--brand); display: inline-block; }
.portal-etiqueta { font-size: 12px; color: #9fb0c1; margin-top: 2px; padding-left: 12px; }
.lateral nav { flex: 1; overflow-y: auto; padding: 10px; }
.lateral .grupo { font-family: var(--f-display); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #8796a7; padding: 12px 12px 4px; }
.lateral nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r);
  color: #C9D3DD; font-weight: 500; border-left: 3px solid transparent;
}
.lateral nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.lateral nav a.activo { background: rgba(255, 209, 0, .1); color: #fff; border-left-color: var(--brand); }
.lateral nav a.activo svg { color: var(--brand); }
.lateral nav a svg { width: 18px; height: 18px; flex: none; color: #8796a7; }
.lateral .pie { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.lateral .pie .nombre { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.lateral .pie .empresa { color: #9fb0c1; font-size: 12px; margin-bottom: 8px; }
.lateral .pie button { background: none; border: 0; color: #C9D3DD; padding: 4px 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; }
.lateral .pie button:hover { color: #fff; }
.lateral .pie svg { width: 15px; height: 15px; }

.contenido { padding: 26px 30px 60px; min-width: 0; }
.vista { max-width: 1240px; margin: 0 auto; }
.barra-movil { display: none; }

.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.encabezado h1 { font-family: var(--f-display); font-size: 30px; font-weight: 700; letter-spacing: .01em; }
.encabezado .sub { color: var(--tx-soft); margin-top: 3px; }
.encabezado .volver { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 4px; }
.encabezado .volver svg { width: 14px; height: 14px; }

/* ============================ COMPONENTES ============================ */
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 18px; }
.tarjeta > h2, .tarjeta-titulo { font-family: var(--f-display); font-size: 19px; font-weight: 600; margin-bottom: 12px; letter-spacing: .01em; }
.tarjeta.sin-relleno { padding: 0; overflow: hidden; }
.tarjeta.sin-relleno > h2 { padding: 16px 18px 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 14px 16px; border-top: 3px solid var(--steel-200); }
.kpi.marca { border-top-color: var(--brand); }
.kpi .t { color: var(--tx-soft); font-size: 13px; }
.kpi .v { font-family: var(--f-display); font-size: 32px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .n { color: var(--tx-mute); font-size: 12px; }

.dos-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.col-detalle { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; min-height: 36px; border-radius: var(--r);
  border: 1px solid var(--steel-200); background: var(--surface); color: var(--tx);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--steel-50); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--brand); border-color: var(--brand-600); color: var(--on-brand); }
.btn.primario:hover:not(:disabled) { background: var(--brand-600); }
.btn.peligro { color: var(--crit-ink); border-color: #e9b9b9; }
.btn.peligro:hover:not(:disabled) { background: var(--crit-soft); }
.btn.chico { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.grande { padding: 13px 22px; font-size: 17px; min-height: 52px; }
.btn.bloque { width: 100%; }

.campo { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.campo input, .campo select, .campo textarea, .control {
  font-weight: 400; font-size: 14px; padding: 8px 10px; min-height: 38px;
  border: 1px solid var(--steel-200); border-radius: var(--r); background: #fff; width: 100%;
}
.campo textarea { min-height: 72px; resize: vertical; }
.campo .ayuda { font-weight: 400; color: var(--tx-mute); font-size: 12px; }
.campo.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.campo.check input { width: 18px; height: 18px; min-height: 0; }
.form { display: grid; gap: 12px; }
.form-fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--steel-100); color: var(--tx-soft); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.chip.info { background: var(--info-soft); color: var(--info-ink); }

.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r); background: var(--info-soft); color: var(--info-ink); }
.aviso svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.aviso.warn { background: var(--warn-soft); color: var(--warn-ink); }
.aviso.crit { background: var(--crit-soft); color: var(--crit-ink); }
.aviso.ok { background: var(--ok-soft); color: var(--ok-ink); }

.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--tx-soft); padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--steel-50); white-space: nowrap; }
.tabla th.num { text-align: right; }
.tabla td { padding: 10px 14px; border-bottom: 1px solid var(--steel-100); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .resumen { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-soft); font-size: 13px; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: var(--brand-soft); }
.vacio { text-align: center; color: var(--tx-mute); padding: 34px 16px; }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filtros .campo { min-width: 150px; }
.filtros .amplio { flex: 1; min-width: 220px; }
.paginador { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; color: var(--tx-soft); font-size: 13px; border-top: 1px solid var(--line); }

.modal-fondo { position: fixed; inset: 0; background: rgba(10, 14, 19, .55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; z-index: 100; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 520px; }
.modal.ancho { max-width: 860px; }
.modal-cabeza { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-cabeza h3 { font-family: var(--f-display); font-size: 21px; font-weight: 600; }
.modal-cabeza button { background: none; border: 0; cursor: pointer; padding: 4px; color: var(--tx-soft); }
.modal-cabeza svg { width: 20px; height: 20px; display: block; }
.modal-cuerpo { padding: 18px; }
.modal-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 8px; align-items: flex-start; background: var(--steel-900); color: #fff; padding: 11px 14px; border-radius: var(--r); box-shadow: var(--sh-lg); }
.toast svg { width: 18px; height: 18px; flex: none; color: var(--brand); }
.toast.error { background: var(--crit-ink); }
.toast.error svg { color: #fff; }

/* ======================= TRAZABILIDAD (línea de tiempo) ======================= */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 34px; }
.timeline li::before { content: ''; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--steel-100); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline .punto { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--steel-100); color: var(--tx-soft); }
.timeline .punto svg { width: 14px; height: 14px; }
.timeline .punto.ok { background: var(--ok-soft); color: var(--ok-ink); }
.timeline .punto.crit { background: var(--crit-soft); color: var(--crit-ink); }
.timeline .punto.warn { background: var(--warn-soft); color: var(--warn-ink); }
.timeline .punto.info { background: var(--info-soft); color: var(--info-ink); }
.timeline .t { font-weight: 600; }
.timeline .m { color: var(--tx-mute); font-size: 12px; }
.timeline .d { color: var(--tx-soft); font-size: 13px; overflow-wrap: anywhere; }

.firma-img { max-height: 70px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; display: block; }

/* ======================= GENERAR VALE ======================= */
.generar { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; align-items: start; }
.resumen-vale { position: sticky; top: 16px; }
.paso { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-family: var(--f-display); font-size: 19px; font-weight: 600; }
.paso b { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: var(--steel-950); color: var(--brand); font-size: 15px; }
.sugerencias { border: 1px solid var(--line); border-radius: var(--r); margin-top: 6px; overflow: hidden; }
.sugerencias button { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--steel-100); padding: 9px 12px; cursor: pointer; }
.sugerencias button:last-child { border-bottom: 0; }
.sugerencias button:hover, .sugerencias button:focus-visible { background: var(--brand-soft); }
.elegido { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 13px; background: var(--steel-50); border-radius: var(--r); border-left: 3px solid var(--brand); }
.elegido .n { font-weight: 700; font-size: 16px; }
.pestanas { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pestanas button { border: 1px solid var(--steel-200); background: #fff; border-radius: 999px; padding: 5px 13px; font-weight: 600; cursor: pointer; font-size: 13px; }
.pestanas button.activo { background: var(--steel-950); border-color: var(--steel-950); color: var(--brand); }
.lista-articulos { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.art { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r); }
.art .n { font-weight: 600; }
.item-vale { display: grid; gap: 7px; padding: 10px 0; border-bottom: 1px solid var(--steel-100); }
.item-vale .ctrl { display: flex; gap: 8px; align-items: center; }
.item-vale select { flex: 1; min-width: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--steel-200); border-radius: var(--r); }
.stepper button { width: 32px; height: 34px; border: 0; background: #fff; cursor: pointer; font-size: 17px; }
.stepper button:hover { background: var(--steel-50); }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }
.total { display: flex; justify-content: space-between; font-family: var(--f-display); font-size: 25px; font-weight: 700; padding: 12px 0 2px; }
.lista-cols { max-height: 430px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); }
.lista-cols label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--steel-100); cursor: pointer; }
.lista-cols label:hover { background: var(--steel-50); }
.lista-cols input { width: 18px; height: 18px; flex: none; }

/* Candado de dotación */
.dotacion-col { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.dotacion-col .fila { gap: 6px; }
.dotacion-col svg { width: 15px; height: 15px; }
.dotacion-col ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.dotacion-col li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.dotacion-col li.agotada, .dotacion-col li.agotada .mute { color: var(--crit-ink); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 4px; }

/* Orden de compra y factura */
.docs { display: grid; gap: 10px; }
.doc { padding: 10px 12px; background: var(--steel-50); border-radius: var(--r); }
.doc-cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.doc-cabeza strong { overflow-wrap: anywhere; text-align: right; }
.doc-archivos { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.doc-archivos li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-archivos a { display: inline-flex; align-items: center; gap: 5px; min-width: 0; flex: 1; }
.doc-archivos a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-archivos svg { width: 14px; height: 14px; flex: none; }
.doc-archivos .quitar { border: 0; background: none; color: var(--tx-mute); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; }
.doc-archivos .quitar:hover { color: var(--crit-ink); background: var(--crit-soft); }
.grupo-doc { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px 12px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.grupo-doc legend { font-weight: 700; padding: 0 6px; }
.barra-seleccion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; margin-bottom: 12px; background: var(--steel-950); color: #fff; border-radius: var(--r); position: sticky; top: 8px; z-index: 5; }
.barra-seleccion[hidden] { display: none; }
.tabla .col-casilla { width: 38px; padding-right: 0; }
.tabla .col-casilla input { width: 17px; height: 17px; display: block; }

/* ======================= CONTROL DEL GASTO ======================= */
.rejilla { display: grid; gap: 14px; align-items: start; }
.rejilla.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla.k21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.tarjeta-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.tarjeta-cabeza h2 { font-family: var(--f-display); font-size: 19px; font-weight: 600; letter-spacing: .01em; }
.tarjeta-cabeza .sub { color: var(--tx-mute); font-size: 12px; margin-top: 2px; }
.tarjeta.sin-relleno > .tarjeta-cabeza { padding: 16px 18px 0; }
.kpi .n .sube-mal { color: var(--crit-ink); font-weight: 600; }
.kpi .n .baja-bien { color: var(--ok-ink); font-weight: 600; }
.recargando { opacity: .55; pointer-events: none; transition: opacity .15s; }
.filtros .pestanas { margin: 0; min-height: 38px; align-items: center; font-weight: 400; }
.chips-resumen { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.buscador-traza { display: grid; gap: 6px; padding: 0 18px 12px; }
.buscador-traza input { font-size: 14px; padding: 8px 10px; min-height: 38px; border: 1px solid var(--steel-200); border-radius: var(--r); width: 100%; }

.grafica { width: 100%; position: relative; }
.grafica svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafica text { font-family: var(--f-body); }
.grafica .tt {
  position: absolute; pointer-events: none; background: var(--steel-950); color: #fff; padding: 7px 10px; border-radius: var(--r);
  font-size: 12.5px; white-space: nowrap; box-shadow: var(--sh-lg); transform: translate(-50%, calc(-100% - 10px)); z-index: 5;
}
.grafica .tt b { display: block; font-size: 13.5px; }
.grafica.barras { display: grid; gap: 6px; }
.barra-fila {
  display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  font-size: 13px; width: 100%; background: none; border: 0; padding: 1px 0; text-align: left; color: inherit;
}
.barra-fila.clic { cursor: pointer; border-radius: var(--r); }
.barra-fila.clic:hover .barra-etq { color: var(--tx); text-decoration: underline; }
.barra-etq { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; overflow-wrap: anywhere; color: var(--tx-soft); }
.barra-pista { border-left: 1px solid var(--eje); height: 22px; display: flex; align-items: center; }
.barra { height: 16px; background: var(--serie-1); border-radius: 0 4px 4px 0; }
.barra-val { min-width: 70px; }

/* ======================= ACCESO ======================= */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--steel-950); }
.acceso-caja { width: 100%; max-width: 400px; }
.acceso-caja .logo { height: 58px; display: block; margin: 0 auto 22px; }
.acceso-tarjeta { background: #fff; border-radius: var(--r-lg); padding: 26px; border-top: 4px solid var(--brand); }
.acceso-tarjeta h1 { font-family: var(--f-display); font-size: 28px; font-weight: 700; }
.acceso-tarjeta p { color: var(--tx-soft); margin: 4px 0 18px; }

/* ======================= CATÁLOGO ======================= */
.foto-art { width: 46px; height: 46px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r); flex: none; display: block; }
.foto-art.chica { width: 38px; height: 38px; }
.foto-art.sin-foto, .foto-producto.sin-foto { display: grid; place-items: center; color: var(--steel-400); background: var(--steel-50); }
.foto-art.sin-foto svg { width: 20px; height: 20px; }
.tabla td.celda-foto { width: 52px; padding-right: 0; }
.art .art-texto { flex: 1; min-width: 0; }
.linea-info { display: flex; align-items: center; gap: 10px; min-width: 0; }

.barra-catalogo { margin-bottom: 12px; }
.barra-catalogo .pestanas { margin: 0; }
.chips-catalogo { display: flex; flex-wrap: wrap; gap: 6px; }
.grupo-catalogo { margin-bottom: 22px; }
.grupo-catalogo > h2 { font-family: var(--f-display); font-size: 21px; font-weight: 600; margin-bottom: 8px; }
.grupo-catalogo > h2 .mute { font-family: var(--f-body); font-size: 13px; font-weight: 400; }
.catalogo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ficha { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); display: flex; flex-direction: column; overflow: hidden; }
.ficha-foto { height: 150px; background: #fff; border-bottom: 1px solid var(--steel-100); padding: 10px; overflow: hidden; }
.foto-producto { width: 100%; height: 100%; object-fit: contain; display: block; }
.foto-producto.sin-foto { width: 100%; height: 100%; border-radius: var(--r); }
.foto-producto.sin-foto svg { width: 40px; height: 40px; }
.ficha-cuerpo { padding: 10px 12px; display: grid; gap: 3px; flex: 1; align-content: start; }
.ficha-nombre { font-weight: 700; line-height: 1.25; }
.ficha-desc { margin: 2px 0; font-size: 13px; color: var(--tx-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ficha-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--steel-100); background: var(--steel-50); min-height: 46px; }
.ficha.inactivo .ficha-foto, .ficha.inactivo .ficha-cuerpo { opacity: .5; }
.ficha.sin-precio .ficha-foto { opacity: .75; }

/* Interruptor de activo / desactivado */
.interruptor { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.interruptor .riel { width: 38px; height: 22px; border-radius: 999px; background: var(--steel-200); position: relative; transition: background .15s; flex: none; }
.interruptor .riel::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(10, 14, 19, .3); transition: transform .15s; }
.interruptor input:checked + .riel { background: var(--ok); }
.interruptor input:checked + .riel::after { transform: translateX(16px); }
.interruptor input:focus-visible + .riel { outline: 2px solid var(--info-ink); outline-offset: 2px; }
.interruptor input:disabled + .riel { opacity: .5; }

/* Foto del gafete en caja y en el detalle del vale */
.gafete-caja { border: 1px dashed var(--steel-400); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; justify-items: start; background: #fff; }
.gafete-vacio { display: flex; align-items: center; gap: 10px; color: var(--tx-soft); }
.gafete-vacio svg { width: 26px; height: 26px; color: var(--steel-400); flex: none; }
.gafete-foto { max-height: 220px; max-width: 100%; border-radius: var(--r); border: 1px solid var(--line); display: block; }
.mira-gafete { position: absolute; inset: 14% 10%; border: 3px solid var(--brand); border-radius: 10px; pointer-events: none; }
.miniatura-gafete { padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: #fff; cursor: zoom-in; display: block; }
.miniatura-gafete img { display: block; height: 52px; width: 78px; object-fit: cover; border-radius: var(--r); }
.gafete-grande { width: 100%; max-height: 62vh; object-fit: contain; background: var(--steel-50); border-radius: var(--r); display: block; }

/* ======================= PANTALLAS CHICAS ======================= */
@media screen and (max-width: 1080px) {
  .generar, .col-detalle { grid-template-columns: minmax(0, 1fr); }
  .resumen-vale { position: static; }
  .rejilla.k2, .rejilla.k3, .rejilla.k21 { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: var(--lateral); transform: translateX(-100%); transition: transform .2s; }
  .lateral.abierto { transform: none; box-shadow: var(--sh-lg); }
  .barra-movil { display: flex; align-items: center; gap: 12px; background: var(--steel-950); color: #fff; padding: 9px 14px; position: sticky; top: 0; z-index: 30; }
  .barra-movil button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .barra-movil svg { width: 24px; height: 24px; display: block; }
  .barra-movil img { height: 26px; }
  .contenido { padding: 16px 14px 50px; }
  .dos-col { grid-template-columns: minmax(0, 1fr); }
  .catalogo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .ficha-foto { height: 120px; }
  .ficha-pie { flex-wrap: wrap; }
}
