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

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.10);
  --border-md: rgba(0,0,0,0.18);
  --text: #1a1a18;
  --text-muted: #6b6a65;
  --accent: #4f6ce6;
  --accent-hover: #3a56d4;
  --accent2: #e67e22;
  --danger: #d04040;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 5px rgba(0,0,0,0.08);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Pasos ── */
.paso { display: none; min-height: 100vh; }
.paso.active { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }

.paso-inner {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
}
.paso-inner.wide { max-width: 860px; }

/* ── Paso 1 ── */
.logo-marca {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
  font-size: 18px; font-weight: 600;
}
h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.subtitle { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }

/* ── Header de paso ── */
.paso-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 8px;
}
.paso-header h2 { font-size: 20px; font-weight: 600; }
.step-badge {
  background: var(--bg); border: 0.5px solid var(--border-md);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; color: var(--text-muted);
}

/* ── Campos ── */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-group label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field-group input, .field-group select, .field-group textarea {
  border: 0.5px solid var(--border-md); border-radius: 8px;
  padding: 10px 14px; font-size: 15px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color .15s;
}
.field-group input:focus, .field-group select:focus {
  outline: none; border-color: var(--accent);
}

/* ── Botones ── */
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 11px 22px; border-radius: 9px; font-size: 15px;
  cursor: pointer; transition: background .15s; text-decoration: none;
  display: inline-block; text-align: center;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.full { width: 100%; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  background: transparent; color: var(--text);
  border: 0.5px solid var(--border-md);
  padding: 11px 22px; border-radius: 9px; font-size: 15px;
  cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: var(--bg); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Logos grid ── */
.logos-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 560px) { .logos-grid { grid-template-columns: 1fr; } }

.logo-card {
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.logo-card-header {
  display: flex; align-items: center; justify-content: space-between;
}
.logo-num { font-size: 14px; font-weight: 600; }
.logo-required { font-size: 11px; color: var(--accent); background: #eef0fd; padding: 2px 8px; border-radius: 10px; }
.logo-optional { font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 8px; border-radius: 10px; }

.logo-upload input[type=file] { display: none; }
.upload-label {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 20px;
  border: 1.5px dashed var(--border-md); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); font-size: 13px;
  transition: border-color .15s, color .15s;
}
.upload-label:hover { border-color: var(--accent); color: var(--accent); }

.logo-preview { text-align: center; }
.logo-preview img { max-width: 100%; max-height: 120px; object-fit: contain; border-radius: 6px; background: var(--bg); padding: 8px; }
.btn-cambiar {
  margin-top: 8px; background: none; border: 0.5px solid var(--border-md);
  padding: 4px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
  color: var(--text-muted);
}
.btn-cambiar:hover { background: var(--bg); }

/* Checks */
.opciones-row { display: flex; flex-direction: column; gap: 8px; }
.check-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.check-label input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── Artículos selector ── */
.articulos-selector {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 20px; max-height: 280px; overflow-y: auto;
}
.art-selector-btn {
  text-align: left; background: var(--surface);
  border: 0.5px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 12px 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color .15s, background .15s;
}
.art-selector-btn strong { font-size: 14px; }
.art-selector-btn small { font-size: 12px; color: var(--text-muted); }
.art-selector-btn:hover { border-color: var(--accent); background: #f5f7ff; }
.art-selector-btn.selected { border-color: var(--accent); background: #eef0fd; }
.empty-hint { color: var(--text-muted); font-size: 14px; padding: 8px 0; }

/* Tipo selector */
#tipo-selector { margin-top: 20px; }
#tipo-selector h3 { font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.tipo-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tipo-btn {
  flex: 1; min-width: 100px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 10px; border-radius: 10px;
  border: 0.5px solid var(--border-md); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: all .15s;
}
.tipo-btn svg { stroke: var(--text-muted); }
.tipo-btn:hover { border-color: var(--accent); color: var(--accent); }
.tipo-btn:hover svg { stroke: var(--accent); }
.tipo-btn.active { border-color: var(--accent); background: #eef0fd; color: var(--accent); }
.tipo-btn.active svg { stroke: var(--accent); }

/* ── Configurador paso 4 ── */
.configurador {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px;
  align-items: start;
}
@media (max-width: 700px) { .configurador { grid-template-columns: 1fr; } }

.canvas-wrap-cliente { width: 100%; }
#canvas-cliente {
  display: block; max-width: 100%; border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
}

.conf-panel { display: flex; flex-direction: column; gap: 16px; }
.panel-section {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 14px 16px; border: 0.5px solid var(--border);
}
.panel-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.panel-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

/* Posiciones config */
.posiciones-config { display: flex; flex-direction: column; gap: 10px; }
.posicion-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.pos-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: #ddd; color: #555;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.pos-select-group { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-radio {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; cursor: pointer;
  border: 0.5px solid var(--border-md); border-radius: 6px;
  padding: 5px 10px; background: var(--surface);
  transition: all .12s;
}
.pos-radio input[type=radio] { display: none; }
.pos-radio.active { border-color: #aaa; background: #eee; }
.pos-radio.logo1.active { border-color: var(--accent); background: #eef0fd; color: var(--accent); }
.pos-radio.logo2.active { border-color: var(--accent2); background: #fdf2e5; color: var(--accent2); }

/* Escala */
.scale-row { display: flex; align-items: center; gap: 8px; }
.scale-row input[type=range] { flex: 1; accent-color: var(--accent); }
.scale-num {
  width: 54px; padding: 6px 8px; border-radius: 6px;
  border: 0.5px solid var(--border-md); text-align: center;
  font-size: 14px; font-family: inherit;
}
.scale-num:focus { outline: none; border-color: var(--accent); }
.scale-unit { font-size: 13px; color: var(--text-muted); }

/* ── Resultado ── */
.resultado-wrap {
  width: 100%; min-height: 300px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: var(--radius);
  border: 0.5px solid var(--border); margin-bottom: 20px;
  overflow: hidden;
}
#resultado-img { max-width: 100%; max-height: 70vh; object-fit: contain; display: block; }
.loading-state { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-muted); }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.resultado-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1a1a18; color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; transform: translateY(8px);
  transition: all .2s; pointer-events: none; z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
