/* VectorCaVer · interfaz neutra: grafito, un solo acento violeta, texto grande y claro */
:root {
  --fondo: #16171a;
  --panel: #1d1f23;
  --tarjeta: #23252a;
  --borde: #33363d;
  --borde-fuerte: #474b54;
  --texto: #eceef2;
  --texto-2: #b4b8c2;
  --texto-3: #8b909b;
  --acento: #8b5cf6;
  --acento-texto: #ffffff;
  --acento-suave: rgba(139, 92, 246, 0.16);
  --ok: #34d399;
  --radio: 12px;
  --fuente: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.5 var(--fuente);
  display: flex;
  flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── barra superior ── */
.barra {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; border-bottom: 1px solid var(--borde); background: var(--panel);
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.volver-hoos { white-space: nowrap; color: var(--texto-2); text-decoration: none; font-size: 13px; border: 1px solid var(--borde); padding: 4px 10px; border-radius: 99px; }
.volver-hoos:hover { color: var(--texto); border-color: var(--borde-fuerte); }
.pasos { display: flex; gap: 6px; list-style: none; margin: 0 auto; padding: 0; }
.pasos li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; color: var(--texto-3); font-size: 14px; transition: color .25s, background .25s; }
.pasos li b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--borde-fuerte); font-size: 12px; }
.pasos li.activo { color: var(--texto); background: var(--tarjeta); }
.pasos li.activo b { background: var(--acento); border-color: var(--acento); color: #fff; }
.pasos li.hecho b { background: transparent; border-color: var(--ok); color: var(--ok); }
.icono { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--borde); background: transparent; color: var(--texto-2); }
.icono:hover { color: var(--texto); border-color: var(--borde-fuerte); }

/* ── estructura ── */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px 1fr; }
.panel { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--borde); background: var(--panel); }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; transition: opacity .3s; }
.tarjeta[data-bloqueada] { opacity: .45; pointer-events: none; }
.tarjeta h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.tarjeta h2 b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--borde); font-size: 12px; }

.soltar {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 22px 12px; border: 1.5px dashed var(--borde-fuerte); border-radius: 10px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.soltar:hover, .soltar.encima { border-color: var(--acento); background: var(--acento-suave); }
.soltar__icono { width: 28px; height: 28px; color: var(--texto-2); }
.soltar strong { font-size: 15px; }
.soltar span { font-size: 13px; color: var(--texto-3); }
.consejo { margin: 10px 0 0; font-size: 13px; color: var(--texto-3); }

.lote { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.lote button { position: relative; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--borde); background: #fff center/contain no-repeat; padding: 0; }
.lote button[aria-current="true"] { outline: 2px solid var(--acento); }
.lote button i { position: absolute; right: 3px; bottom: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--texto-3); }
.lote button i.ok { background: var(--ok); }

.campo { margin-bottom: 16px; }
.campo__titulo { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--texto-2); margin-bottom: 6px; }
.ayuda { margin: 6px 0 0; font-size: 12.5px; color: var(--texto-3); }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.segmentos { display: flex; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 3px; gap: 3px; }
.segmentos button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; padding: 7px 4px; border-radius: 7px; font-size: 12.5px; color: var(--texto-2); white-space: nowrap; }
.segmentos button svg { width: 15px; height: 15px; }
.segmentos button[aria-checked="true"] { background: var(--tarjeta); color: var(--texto); box-shadow: 0 0 0 1px var(--borde-fuerte); }
.segmentos--chico { flex: none; }
.segmentos--chico button { padding: 6px 12px; }
.contador { display: flex; align-items: center; border: 1px solid var(--borde); border-radius: 10px; }
.contador button { width: 32px; height: 32px; border: 0; background: transparent; font-size: 18px; color: var(--texto-2); }
.contador output { min-width: 22px; text-align: center; font-weight: 600; }

.paleta { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 10px 0 0; }
.paleta li { display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 4px 6px 4px 4px; }
.paleta li.oculta { opacity: .45; }
.paleta label { position: relative; width: 28px; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); cursor: pointer; }
.paleta input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.paleta label:focus-within { outline: 2px solid var(--acento); outline-offset: 2px; }
.paleta code { font-size: 12px; color: var(--texto-2); }
.paleta button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: transparent; color: var(--texto-3); border-radius: 6px; }
.paleta button:hover { color: var(--texto); }
.paleta button svg { width: 15px; height: 15px; }

input[type="range"] { width: 100%; accent-color: var(--acento); height: 22px; }
.extremos { display: flex; justify-content: space-between; font-size: 12px; color: var(--texto-3); }

.interruptor { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--texto-2); margin-top: 8px; cursor: pointer; }
.interruptor input { accent-color: var(--acento); width: 16px; height: 16px; }

.retoque, .incluye { border-top: 1px solid var(--borde); padding-top: 10px; }
.retoque summary, .incluye summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--texto-2); }
.retoque[open] summary, .incluye[open] summary { margin-bottom: 8px; }
.herramientas { display: flex; gap: 6px; margin: 8px 0 12px; }
.herramientas button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 9px; border: 1px solid var(--borde); background: var(--panel); font-size: 13px; color: var(--texto-2); }
.herramientas button[aria-checked="true"] { border-color: var(--acento); color: var(--texto); background: var(--acento-suave); }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 9px 14px; border: 1px solid var(--borde-fuerte); background: var(--tarjeta); font-weight: 600; font-size: 14px; transition: background .2s, border-color .2s, transform .1s; }
.boton:active { transform: scale(.98); }
.boton--prin { width: 100%; padding: 12px 16px; background: var(--acento); border-color: var(--acento); color: var(--acento-texto); font-size: 15px; }
.boton--prin:hover { background: #7c4fe6; }
.boton--sec:hover { border-color: var(--texto-3); }
.boton[disabled] { opacity: .5; cursor: progress; }
.chip { border: 1px solid var(--borde-fuerte); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: 13px; color: var(--texto-2); }
.chip:hover { color: var(--texto); border-color: var(--texto-3); }
.sueltos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--texto-3); }
.checks { display: grid; gap: 6px; font-size: 13.5px; color: var(--texto-2); }
.checks input { accent-color: var(--acento); margin-right: 6px; }
#btnLote { width: 100%; margin-top: 12px; }

.progreso { position: relative; height: 26px; margin-top: 10px; border-radius: 8px; background: var(--panel); overflow: hidden; font-size: 12.5px; }
.progreso i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--acento-suave); transition: width .2s; }
.progreso span { position: relative; display: block; padding: 4px 10px; color: var(--texto-2); }

/* ── visor ── */
.visor { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.visor__barra { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--borde); }
.pestanas { display: flex; gap: 4px; }
.pestanas button { border: 0; background: transparent; color: var(--texto-3); padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.pestanas button[aria-selected="true"] { background: var(--tarjeta); color: var(--texto); box-shadow: 0 0 0 1px var(--borde); }
.fondos { display: flex; gap: 6px; }
.fondos button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--borde-fuerte); padding: 0; }
.fondos button[aria-checked="true"] { outline: 2px solid var(--acento); outline-offset: 1px; }
.fondos [data-prev="cuadros"] { background: repeating-conic-gradient(#d8d8d8 0 25%, #fff 0 50%) 0 0/10px 10px; }
.fondos [data-prev="blanco"] { background: #fff; }
.fondos [data-prev="negro"] { background: #0e0f11; }

.lienzo { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.prev-cuadros { background: repeating-conic-gradient(#2a2c31 0 25%, #23252a 0 50%) 0 0/22px 22px; }
.prev-blanco { background: #ffffff; }
.prev-negro { background: #0e0f11; }
.vacio { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; background: var(--fondo); }
.vacio h1 { margin: 6px 0 0; font-size: 24px; letter-spacing: -0.02em; }
.vacio p { margin: 0 0 8px; max-width: 46ch; color: var(--texto-2); }
.vacio .boton { width: auto; }

.comparar, .soloVector, .retocar { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.marco { position: relative; max-width: 100%; max-height: 100%; line-height: 0; }
.marco img, .marco svg { display: block; max-width: min(100%, 1100px); max-height: calc(100vh - 200px); width: auto; height: auto; }
#marcoVector svg { width: min(90vw - 400px, 1000px); max-height: calc(100vh - 200px); }
.comparar__vector { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
#imgOriginal { clip-path: inset(0 50% 0 0); }
.comparar__vector svg { width: 100%; height: 100%; max-width: none; max-height: none; }
.comparar__linea { position: absolute; top: -8px; bottom: -8px; left: 50%; width: 30px; margin-left: -15px; cursor: ew-resize; touch-action: none; }
.comparar__linea::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 2px; background: var(--acento); }
.comparar__linea span { position: absolute; top: 50%; left: 3px; width: 24px; height: 24px; margin-top: -12px; border-radius: 50%; background: var(--acento); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.etiqueta { position: absolute; top: -30px; font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: 6px; background: rgba(22,23,26,.85); color: var(--texto-2); }
.etiqueta--izq { left: 0; }
.etiqueta--der { right: 0; }

.v3d { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #34363c, #1b1c20 70%); }
.v3d__lienzo { position: absolute; inset: 0; }
.v3d__lienzo canvas { width: 100% !important; height: 100% !important; display: block; }
.v3d__panel { position: absolute; top: 14px; right: 14px; width: 240px; background: rgba(29,31,35,.92); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; display: grid; gap: 8px; font-size: 13px; color: var(--texto-2); backdrop-filter: blur(8px); }
.v3d__panel h3 { margin: 0; font-size: 14px; color: var(--texto); }
.v3d__panel label { display: block; }
.v3d__panel label input[type="range"], .v3d__panel label select { display: block; width: 100%; margin-top: 2px; }
.v3d__panel label.interruptor { display: flex; margin: 0; }
.v3d__panel output { color: var(--texto); font-weight: 600; }
.v3d__panel select { background: var(--panel); border: 1px solid var(--borde); border-radius: 8px; padding: 5px; }

.retocar canvas { max-width: 100%; max-height: 100%; cursor: crosshair; touch-action: none; background: repeating-conic-gradient(#d8d8d8 0 25%, #fff 0 50%) 0 0/16px 16px; }
.lienzo.gotero .comparar, .lienzo.gotero .soloVector { cursor: crosshair; }

.trabajando { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 99px; background: rgba(22,23,26,.92); border: 1px solid var(--borde); font-size: 13.5px; color: var(--texto-2); }
.trabajando i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--borde-fuerte); border-top-color: var(--acento); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.visor__pie { min-height: 38px; padding: 9px 16px; border-top: 1px solid var(--borde); font-size: 13px; color: var(--texto-3); display: flex; gap: 18px; flex-wrap: wrap; }
.visor__pie b { color: var(--texto-2); font-weight: 600; }

.aviso { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--tarjeta); border: 1px solid var(--borde-fuerte); padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.4); transition: opacity .25s, transform .25s; font-size: 14px; z-index: 50; }
.aviso.ver { opacity: 1; transform: translate(-50%, 0); }
.aviso.error { border-color: #f87171; }

/* ── celular y tablet ── */
@media (max-width: 900px) {
  body { height: auto; min-height: 100%; }
  .app { grid-template-columns: 1fr; }
  .panel { border-right: 0; order: 2; overflow: visible; }
  .visor { order: 1; height: 62vh; min-height: 380px; }
  .pasos li { padding: 6px 8px; font-size: 13px; }
  .marca span { display: none; }
  #marcoVector svg { width: 90vw; max-height: 52vh; }
  .marco img, .marco svg { max-height: 52vh; }
  .v3d__panel { top: auto; bottom: 10px; right: 10px; left: 10px; width: auto; grid-template-columns: 1fr 1fr; max-height: 46%; overflow-y: auto; }
  .v3d__panel h3 { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .barra { padding: 8px 10px; gap: 6px; }
  .pasos { gap: 2px; }
  .pasos li { gap: 4px; padding: 4px 5px; font-size: 12.5px; }
  .pasos li b { width: 20px; height: 20px; font-size: 11px; }
  .volver-hoos { white-space: nowrap; padding: 4px 8px; font-size: 12px; }
  .icono { width: 32px; height: 32px; }
  .visor__barra { padding: 8px; }
  .pestanas button { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.barra__acciones { display: flex; align-items: center; gap: 8px; }
