/* ════════════════════════════════════════════════════════════
   SmartBuilder EC — Sistema de Diseño v2.0
   ════════════════════════════════════════════════════════════ */

/* ─── Tokens del sistema ─────────────────────────────────── */
:root {
  --c-blue-900: #0f1e3c;
  --c-blue-800: #162d58;
  --c-blue-700: #1a3464;
  --c-blue-600: #1F3B6D;
  --c-blue-500: #2952a3;
  --c-blue-400: #4B8EF5;
  --c-blue-100: #DBEAFE;
  --c-blue-50:  #EFF6FF;

  --c-ai:       #7C3AED;
  --c-ai-dark:  #5B21B6;
  --c-ai-light: #EDE9FE;

  --c-success:       #059669;
  --c-success-light: #D1FAE5;
  --c-danger:        #DC2626;
  --c-danger-light:  #FEE2E2;
  --c-warning:       #D97706;
  --c-warning-light: #FEF3C7;

  --c-bg:        #EFF3FB;
  --c-surface:   #FFFFFF;
  --c-surface-2: #F8FAFD;
  --c-border:    #DDE5F0;
  --c-border-s:  #C4D0E5;

  --c-text:   #0D1B35;
  --c-text-2: #2D4470;
  --c-text-3: #5E78A0;
  --c-text-4: #8FA5C8;

  --sb-width:  260px;
  --sb-bg:     linear-gradient(180deg, #1a3464 0%, #0f1e3c 100%);
  --sb-text:   rgba(255,255,255,0.68);
  --sb-active: #ffffff;
  --sb-accent: #60A5FA;
  --sb-done:   #34D399;
  --sb-hover:  rgba(255,255,255,0.07);

  --r-xs: 4px;  --r-sm: 8px;  --r-md: 12px;
  --r-lg: 16px; --r-xl: 22px; --r-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm: 0 2px 8px rgba(31,59,109,0.09);
  --shadow-md: 0 4px 16px rgba(31,59,109,0.13);
  --shadow-lg: 0 10px 32px rgba(31,59,109,0.18);
  --shadow-ai: 0 4px 20px rgba(124,58,237,0.32);

  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 320ms ease;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  font-size: 15px;
}

/* ════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════ */

.layout { display: flex; height: 100vh; overflow: hidden; }

.main {
  flex: 1;
  overflow-y: auto;
  padding: 0 36px 40px;
  background: var(--c-bg);
  transition: padding var(--t-slow);
}

/* Focus mode */
.focus-mode .sidebar  { width: 0; overflow: hidden; }
.focus-mode .main     { padding: 0 100px 40px; }

h1 { font-size: 25px; font-weight: 700; color: var(--c-text);   margin-bottom: 6px; }
h2 { font-size: 18px; font-weight: 700; color: var(--c-text-2); }
h3 { font-size: 15px; font-weight: 700; color: var(--c-text-2); }
p  { color: var(--c-text-3); line-height: 1.65; }
hr { border: none; border-top: 1px solid var(--c-border); margin: 22px 0; }

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */

.sidebar {
  width: var(--sb-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--t-slow);
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.22);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.logo-img { max-width: 108px; height: auto; filter: brightness(1.1); }

.menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.menu::-webkit-scrollbar { width: 3px; }
.menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: var(--r-full); }

/* Botón focus mode en sidebar */
#btnFocusMode {
  display: block;
  margin: 10px 12px 4px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,0.48);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast);
  letter-spacing: 0.02em;
}
#btnFocusMode:hover { background: rgba(255,255,255,0.11); color: rgba(255,255,255,0.85); }

/* Pestaña fija para restaurar el sidebar — siempre visible en focus mode */
#btnFocusExit {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 500;
  background: var(--c-blue-600);
  color: white;
  border: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 14px 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
  box-shadow: 2px 0 10px rgba(0,0,0,0.20);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), background var(--t-fast);
}
#btnFocusExit:hover { background: var(--c-blue-700); }
.focus-mode #btnFocusExit { opacity: 1; pointer-events: auto; }

/* Grupos */
.nav-grupos { list-style: none; padding: 0; margin: 0; }
.nav-grupo  { margin-bottom: 2px; }

.nav-grupo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  cursor: pointer;
  color: rgba(255,255,255,0.44);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  transition: color var(--t-fast);
  user-select: none;
}
.nav-grupo-header:hover { color: rgba(255,255,255,0.80); }

.nav-grupo-arrow { font-size: 9px; transition: transform var(--t-base); color: rgba(255,255,255,0.35); }

.nav-grupo-items {
  list-style: none; padding: 0; margin: 0;
  overflow: hidden; max-height: 600px;
  transition: max-height 0.28s ease, opacity 0.2s ease;
  opacity: 1;
}
.nav-grupo-items.closed { max-height: 0; opacity: 0; }

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px 8px 24px;
  font-size: 13px;
  font-weight: 400;
  color: var(--sb-text);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  margin: 1px 0;
}
.nav-item:hover:not(.disabled) { background: var(--sb-hover); color: white; }
.nav-item.active { border-left-color: var(--sb-accent); color: white; font-weight: 600; background: rgba(96,165,250,0.13); }
.nav-item.completed { color: var(--sb-done); }
.nav-item.completed::before { content: "✓"; font-size: 10px; font-weight: 700; color: var(--sb-done); flex-shrink: 0; }
.nav-item.disabled { color: rgba(255,255,255,0.26); cursor: not-allowed; pointer-events: none; }

.sidebar ul { list-style: none; padding: 0; }
.sidebar li { margin: 0; }

/* ════════════════════════════════════════════════════════════
   BARRA DE PROGRESO SUPERIOR
   ════════════════════════════════════════════════════════════ */

#progress-bar-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 0 0;
  margin: 0 -36px 28px;
  box-shadow: var(--shadow-xs);
}

#progress-bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px 11px;
}

#progress-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
  min-width: 160px;
}

#progress-track {
  flex: 1;
  height: 5px;
  background: var(--c-border);
  border-radius: var(--r-full);
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-blue-600), var(--c-blue-400));
  border-radius: var(--r-full);
  transition: width 0.55s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

#progress-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-blue-600);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* ════════════════════════════════════════════════════════════
   SECCIONES Y CARDS
   ════════════════════════════════════════════════════════════ */

.wizard-section { width: 100%; animation: sectionEnter 0.22s ease both; }

@keyframes sectionEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.paso-titulo {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-blue-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--c-blue-50);
  padding: 3px 10px;
  border-radius: var(--r-full);
  margin-bottom: 8px;
}

.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ════════════════════════════════════════════════════════════
   FORMULARIOS
   ════════════════════════════════════════════════════════════ */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; position: relative; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text-2);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-family: inherit;
  background: var(--c-surface-2);
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
  height: auto;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--c-blue-600);
  background: var(--c-surface);
  box-shadow: 0 0 0 3px rgba(31,59,109,0.11);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error { border-color: var(--c-danger); background: #fff8f8; }

.form-group textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

textarea {
  width: 100%;
  height: 120px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--c-border);
  padding: 11px 14px;
  font-size: 14.5px;
  font-family: inherit;
  resize: vertical;
  background: var(--c-surface-2);
  color: var(--c-text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--c-blue-600);
  background: var(--c-surface);
  box-shadow: 0 0 0 3px rgba(31,59,109,0.11);
}

.hint { font-size: 13px; color: var(--c-text-3); line-height: 1.55; }
.hint strong { color: var(--c-text-2); }
.error-msg { font-size: 12px; color: var(--c-danger); display: none; margin-top: 2px; }

/* ════════════════════════════════════════════════════════════
   BOTONES
   ════════════════════════════════════════════════════════════ */

.btn-siguiente {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-blue-600);
  color: white;
  border: none;
  padding: 11px 28px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 22px;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 2px 8px rgba(31,59,109,0.22);
}

.btn-siguiente:hover:not(:disabled) {
  background: var(--c-blue-700);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(31,59,109,0.30);
}

.btn-siguiente:active:not(:disabled) { transform: translateY(0); }
.btn-siguiente:disabled { opacity: 0.5; cursor: not-allowed; }

/* ✨ Botón IA — gradiente morado/azul */
.btn-ia {
  background: linear-gradient(135deg, #8B5CF6 0%, #4B8EF5 100%) !important;
  box-shadow: 0 3px 14px rgba(124,58,237,0.30) !important;
}
.btn-ia:hover:not(:disabled) {
  background: linear-gradient(135deg, #7C3AED 0%, #3B6FD0 100%) !important;
  box-shadow: 0 6px 22px rgba(124,58,237,0.40) !important;
  transform: translateY(-1px) !important;
}

.btn-modo {
  border: 1.5px solid var(--c-blue-600);
  background: var(--c-surface);
  color: var(--c-blue-600);
  border-radius: var(--r-full);
  padding: 7px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  font-family: inherit;
  transition: all var(--t-fast);
}
.btn-modo.active { background: var(--c-blue-600); color: white; }
.btn-modo:hover:not(.active) { background: var(--c-blue-50); }

/* Copy button */
.btn-copiar-ia {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--c-blue-50);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xs);
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--c-text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
  z-index: 2;
}
.form-group:hover .btn-copiar-ia,
.textarea-ia-row:hover .btn-copiar-ia { opacity: 1; }
.btn-copiar-ia:hover { background: var(--c-blue-100); color: var(--c-blue-600); }
.btn-copiar-ia.copiado { color: var(--c-success); border-color: #6EE7B7; background: var(--c-success-light); }

.modo-objetivos, .mode-objetivos {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.modo-objetivos p { margin: 0; color: var(--c-text-3); font-size: 14px; }

.next-btn, .send-btn, .btnCopiar {
  background: var(--c-blue-600);
  color: white;
  border: none;
  padding: 11px 24px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background var(--t-fast);
}
.next-btn:hover, .send-btn:hover, .btnCopiar:hover { background: var(--c-blue-700); }
.btnCopiar { margin-top: 14px; }

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--c-text);
  color: white;
  padding: 11px 22px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease both;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  white-space: nowrap;
}
.toast.success { background: var(--c-success); }
.toast.error   { background: var(--c-danger);  }
.toast.warning { background: var(--c-warning); }
.toast.out     { animation: toastOut 0.22s ease both; }

@keyframes toastIn  { from { opacity:0; transform:translateY(12px) scale(.95); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); }      to { opacity:0; transform:translateY(-8px) scale(.95); } }

/* ════════════════════════════════════════════════════════════
   CELEBRATION OVERLAY
   ════════════════════════════════════════════════════════════ */

#celebration-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,24,54,0.92);
  z-index: 99998;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  animation: celebFadeIn 0.3s ease;
  backdrop-filter: blur(6px);
}
#celebration-overlay.show { display: flex; }

.celebration-icon  { font-size: 76px; animation: celebBounce 0.6s ease 0.15s both; }
.celebration-title { color: white; font-size: 28px; font-weight: 800; text-align: center; animation: celebSlide 0.4s ease 0.3s both; }
.celebration-sub   { color: rgba(255,255,255,0.65); font-size: 16px; text-align: center; animation: celebSlide 0.4s ease 0.42s both; }

.celebration-bar {
  width: 280px; height: 5px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--r-full);
  overflow: hidden;
  animation: celebSlide 0.4s ease 0.5s both;
  margin-top: 8px;
}
.celebration-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #60A5FA, #34D399);
  border-radius: var(--r-full);
  animation: celebProgress 3s linear both;
}

@keyframes celebFadeIn  { from{opacity:0} to{opacity:1} }
@keyframes celebBounce  { 0%{transform:scale(0)} 60%{transform:scale(1.18)} 100%{transform:scale(1)} }
@keyframes celebSlide   { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
@keyframes celebProgress{ from{width:0%} to{width:100%} }

/* ════════════════════════════════════════════════════════════
   LOADER
   ════════════════════════════════════════════════════════════ */

#contenedorLoader1, #contenedorLoader2 {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 26vh;
  gap: 18px;
  color: var(--c-text-3);
}

.cargando { font-size: 14.5px; font-weight: 500; color: var(--c-text-3); animation: pulse 1.6s ease infinite; }
@keyframes pulse { 0%,100%{opacity:0.5} 50%{opacity:1} }

.rueda {
  border: 7px solid var(--c-blue-100);
  border-top-color: var(--c-blue-600);
  border-radius: 50%;
  width: 52px; height: 52px;
  animation: giro 0.8s linear infinite;
}
@keyframes giro { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   OBJETIVOS (TABS)
   ════════════════════════════════════════════════════════════ */

.objetivos-tabs { display: flex; gap: 10px; margin: 14px 0 22px; flex-wrap: wrap; }

.objetivos-tabs .nav-item {
  border: 1.5px solid var(--c-border-s);
  background: var(--c-surface);
  color: var(--c-text-2);
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.objetivos-tabs .nav-item:hover:not(.disabled) { border-color: var(--c-blue-600); background: var(--c-blue-50); color: var(--c-blue-600); transform: translateY(-1px); }
.objetivos-tabs .nav-item.active { background: var(--c-blue-600); border-color: var(--c-blue-600); color: white; box-shadow: 0 4px 12px rgba(31,59,109,0.26); }
.objetivos-tabs .nav-item.completed { background: var(--c-success); border-color: var(--c-success); color: white; }
.objetivos-tabs .nav-item.disabled { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-text-4); cursor: not-allowed; opacity: 0.7; }

/* ════════════════════════════════════════════════════════════
   TEMARIO
   ════════════════════════════════════════════════════════════ */

.temas-lista { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }

.tema-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-blue-50);
  border: 1px solid var(--c-blue-100);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--c-blue-600);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--t-fast);
}
.tema-item:hover { background: var(--c-blue-100); }
.tema-item button { background: var(--c-danger); color: white; border: none; border-radius: var(--r-xs); padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background var(--t-fast); }
.tema-item button:hover { background: #b91c1c; }

.tema-input-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.tema-input-row input { flex: 1; }

/* ════════════════════════════════════════════════════════════
   ENCUADRE
   ════════════════════════════════════════════════════════════ */

.checkbox-list { display: flex; flex-direction: column; gap: 7px; margin: 12px 0 18px; }

.checkbox-list label {
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  color: var(--c-text-2);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
}
.checkbox-list label:hover { border-color: var(--c-blue-600); background: var(--c-blue-50); color: var(--c-blue-600); }
.checkbox-list input { margin-right: 10px; accent-color: var(--c-blue-600); }

.regla-apartado {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 14px;
}
.regla-apartado h4 { margin: 0 0 10px; color: var(--c-text-2); font-size: 14px; }
.regla-apartado label { display: flex; align-items: center; margin-bottom: 7px; font-weight: 500; font-size: 14px; cursor: pointer; color: var(--c-text-2); padding: 5px 8px; border-radius: var(--r-xs); transition: background var(--t-fast); }
.regla-apartado label:hover { background: var(--c-blue-50); }
.regla-apartado input { margin-right: 10px; accent-color: var(--c-blue-600); }

/* ════════════════════════════════════════════════════════════
   TÉCNICAS
   ════════════════════════════════════════════════════════════ */

.radio-card-group { display: grid; gap: 11px; margin-top: 14px; }

.radio-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.radio-card:hover { border-color: var(--c-blue-600); background: var(--c-blue-50); box-shadow: var(--shadow-sm); }
.radio-card input { margin-top: 3px; accent-color: var(--c-blue-600); }
.radio-card h4 { margin: 0 0 4px; color: var(--c-text); font-size: 14.5px; }
.radio-card p  { margin: 0; font-size: 13px; color: var(--c-text-3); }
.radio-card small { font-size: 12px; color: var(--c-text-4); margin-top: 4px; display: block; }

.tecnica-personalizada { margin-top: 14px; padding: 16px; border: 1.5px dashed var(--c-border-s); border-radius: var(--r-md); background: var(--c-surface-2); }

.tecnica-detalle { margin-top: 20px; padding: 20px; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface); box-shadow: var(--shadow-xs); }
.tecnica-detalle h3 { margin-top: 0; color: var(--c-text-2); font-size: 15px; }
.tecnica-detalle p  { margin-bottom: 10px; font-size: 14px; }

.textarea-ia-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; position: relative; }
.textarea-ia-row textarea { width: 100%; }

.btn-ia-expositiva {
  padding: 10px 14px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  background: var(--c-blue-600);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--t-fast);
}
.btn-ia-expositiva:hover { background: var(--c-blue-700); }


.btn-ia-dialogo {
  padding: 10px 14px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  background: var(--c-blue-600);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--t-fast);
}
.btn-ia-dialogo:hover { background: var(--c-blue-700); }


.btn-ia-demostrativa {
  padding: 10px 14px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  background: var(--c-blue-600);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--t-fast);
}
.btn-ia-demostrativa:hover { background: var(--c-blue-700); }


.tecnica-nombre-editable {
  width: 100%;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--c-text-2);
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--c-border-s);
  border-radius: 0;
  padding: 4px 2px;
  margin-bottom: 16px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--t-fast);
}
.tecnica-nombre-editable:focus { border-bottom-color: var(--c-blue-600); background: var(--c-blue-50); border-radius: var(--r-xs) var(--r-xs) 0 0; }
.tecnica-nombre-editable::placeholder { color: var(--c-text-4); font-weight: 400; }

/* ════════════════════════════════════════════════════════════
   TABLA DE TIEMPOS
   ════════════════════════════════════════════════════════════ */

.tiempos-wrapper { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }

.tiempo-bloque { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--t-base); }
.tiempo-bloque:hover { box-shadow: var(--shadow-md); }

.tiempo-bloque-header { background: linear-gradient(90deg, var(--c-blue-700), var(--c-blue-600)); color: white; padding: 13px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tiempo-bloque-header h3 { margin: 0; font-size: 15px; font-weight: 700; }

.tiempo-subtotal { background: rgba(255,255,255,0.17); padding: 5px 12px; border-radius: var(--r-full); font-size: 13px; font-weight: 600; white-space: nowrap; }

.tabla-tiempos { width: 100%; border-collapse: collapse; }
.tabla-tiempos thead { background: var(--c-surface-2); }
.tabla-tiempos th { padding: 11px 16px; color: var(--c-text-2); text-align: left; font-size: 12.5px; font-weight: 700; border-bottom: 1px solid var(--c-border); text-transform: uppercase; letter-spacing: 0.05em; }
.tabla-tiempos td { padding: 11px 16px; border-bottom: 1px solid var(--c-border); vertical-align: middle; font-size: 14px; color: var(--c-text); }
.tabla-tiempos tbody tr:last-child td { border-bottom: none; }
.tabla-tiempos tbody tr:hover { background: var(--c-blue-50); }

.col-tiempo { width: 156px; }
.input-tiempo-wrapper { display: flex; align-items: center; gap: 8px; }
.input-tiempo { width: 78px; padding: 8px 10px; border: 1.5px solid var(--c-border-s); border-radius: var(--r-sm); font-size: 15px; font-family: inherit; text-align: center; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input-tiempo:focus { border-color: var(--c-blue-600); box-shadow: 0 0 0 3px rgba(31,59,109,0.11); }
.min-label { color: var(--c-text-3); font-size: 13px; }

.total-tiempos-card { margin-top: 18px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 17px 22px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); }
.total-tiempos-card h3 { margin: 0; color: var(--c-text-2); font-size: 15px; }
.total-tiempos-numero { font-size: 30px; font-weight: 800; color: var(--c-blue-600); }

.total-correcto { background: var(--c-success-light); border-color: #6EE7B7; }
.total-correcto .total-tiempos-numero { color: var(--c-success); }
.total-error    { background: var(--c-danger-light);  border-color: #FCA5A5; }
.total-error .total-tiempos-numero    { color: var(--c-danger); }

#err-tiempos { display: none; margin-top: 14px; padding: 13px 18px; border-radius: var(--r-md); background: var(--c-danger-light); border: 1px solid #FCA5A5; color: var(--c-danger); font-size: 15px; font-weight: 600; text-align: center; }

/* ════════════════════════════════════════════════════════════
   EVALUACIONES
   ════════════════════════════════════════════════════════════ */

.evaluacion-porcentajes-card { margin: 20px 0 24px; padding: 22px; border-radius: var(--r-xl); background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }

.evaluacion-diagnostica-card { margin-bottom: 18px; padding: 16px; border-radius: var(--r-lg); background: var(--c-surface-2); border: 1px solid var(--c-border); text-align: center; }
.evaluacion-diagnostica-card span   { display: block; color: var(--c-text-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.evaluacion-diagnostica-card strong { display: block; margin: 8px 0; color: var(--c-blue-600); font-size: 36px; line-height: 1; }
.evaluacion-diagnostica-card small  { color: var(--c-text-3); font-size: 13px; }

.evaluacion-valores { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.evaluacion-valor-card { padding: 16px; border-radius: var(--r-lg); background: var(--c-surface-2); border: 1px solid var(--c-border); text-align: center; }
.evaluacion-label { display: block; margin-bottom: 8px; color: var(--c-text-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.evaluacion-valor-card strong { display: block; color: var(--c-blue-600); font-size: 36px; line-height: 1; font-weight: 800; }

.valor-fijo-evaluacion { margin-top: 8px; padding: 12px 16px; border-radius: var(--r-md); background: var(--c-blue-50); border: 1px solid var(--c-blue-100); color: var(--c-blue-600); font-size: 20px; font-weight: 700; text-align: center; }

.slider-contenedor label { display: block; margin-bottom: 12px; color: var(--c-text-2); font-size: 15px; font-weight: 700; }

#sliderEvaluaciones { width: 100%; height: 12px; border-radius: var(--r-full); outline: none; cursor: pointer; appearance: none; -webkit-appearance: none; background: var(--c-border); }
#sliderEvaluaciones::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: white; border: 3px solid var(--c-blue-600); box-shadow: 0 2px 10px rgba(31,59,109,0.28); cursor: grab; transition: transform var(--t-fast); }
#sliderEvaluaciones::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
#sliderEvaluaciones::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: white; border: 3px solid var(--c-blue-600); box-shadow: 0 2px 10px rgba(31,59,109,0.28); cursor: grab; }

.slider-extremos { display: flex; justify-content: space-between; margin-top: 10px; color: var(--c-text-3); font-size: 12px; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   FORMATOS
   ════════════════════════════════════════════════════════════ */

.formatos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; margin-top: 20px; }

.formato-card { border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 18px 20px; background: var(--c-surface); box-shadow: var(--shadow-sm); transition: box-shadow var(--t-base), transform var(--t-base); border-left: 4px solid var(--c-blue-600); }
.formato-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.formato-card h3 { margin-top: 0; color: var(--c-text); font-size: 14.5px; }
.formato-card p  { color: var(--c-text-3); font-size: 13px; margin-bottom: 0; }

/* ════════════════════════════════════════════════════════════
   SPEED DIAL
   ════════════════════════════════════════════════════════════ */

#sd-container { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; }

#sd-main { width: 50px; height: 50px; border-radius: 50%; border: none; background: var(--c-blue-600); color: white; font-size: 22px; cursor: pointer; box-shadow: var(--shadow-md); transition: transform var(--t-base), background var(--t-fast); flex-shrink: 0; }
#sd-main:hover { background: var(--c-blue-700); }
#sd-main.open  { transform: rotate(45deg); background: var(--c-blue-700); }

/* Las opciones colapsan su altura cuando están ocultas para que el botón principal quede siempre en la esquina */
.sd-option { display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s, max-height 0.25s ease, margin-bottom 0.2s; pointer-events: none; max-height: 0; overflow: hidden; margin-bottom: 0; }
.sd-option.visible { opacity: 1; transform: translateY(0); pointer-events: auto; max-height: 52px; margin-bottom: 10px; }
.sd-option-btn { width: 42px; height: 42px; border-radius: 50%; border: none; color: white; font-size: 18px; cursor: pointer; box-shadow: var(--shadow-md); flex-shrink: 0; transition: transform var(--t-fast); }
.sd-option-btn:hover { transform: scale(1.08); }
.sd-option-label { background: rgba(10,24,54,0.85); color: white; font-size: 12px; padding: 4px 10px; border-radius: var(--r-sm); white-space: nowrap; pointer-events: none; }

/* Barra de descarga */
#sd-progreso-bar { position: fixed; bottom: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--c-blue-400), var(--c-ai)); transition: width 0.5s ease; z-index: 99999; }

/* Modal de confirmación — limpiar datos */
.sd-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 99999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.sd-modal-overlay.visible { opacity: 1; pointer-events: auto; }
.sd-modal { background: #fff; border-radius: 12px; padding: 32px 28px 24px; max-width: 420px; width: 90%; box-shadow: 0 12px 40px rgba(0,0,0,0.22); text-align: center; transform: translateY(-12px); transition: transform 0.2s; }
.sd-modal-overlay.visible .sd-modal { transform: translateY(0); }
.sd-modal h3 { margin: 0 0 12px; font-size: 18px; color: #b71c1c; }
.sd-modal p  { margin: 0 0 24px; font-size: 14px; color: #444; line-height: 1.6; }
.sd-modal-btns { display: flex; gap: 12px; justify-content: center; }
.sd-modal-btns button { padding: 10px 24px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.sd-modal-btn-cancelar { background: #e0e0e0; color: #333; }
.sd-modal-btn-cancelar:hover { background: #bdbdbd; }
.sd-modal-btn-aceptar  { background: #c62828; color: #fff; }
.sd-modal-btn-aceptar:hover  { background: #b71c1c; }

/* ════════════════════════════════════════════════════════════
   TOKEN (LOGIN)
   ════════════════════════════════════════════════════════════ */

.token-container { max-width: 480px; margin: 80px auto; background: var(--c-surface); padding: 44px 40px; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); text-align: center; border: 1px solid var(--c-border); }
.sectionTitle { color: var(--c-text); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.token-inputs { display: flex; justify-content: center; gap: 10px; margin: 28px 0; }
.token-box { width: 52px; height: 64px; font-size: 26px; text-align: center; border-radius: var(--r-sm); border: 2px solid var(--c-border-s); background: var(--c-surface-2); font-weight: 700; color: var(--c-text); transition: all var(--t-fast); font-family: inherit; outline: none; }
.token-box:focus { border-color: var(--c-blue-600); background: var(--c-surface); box-shadow: 0 0 0 3px rgba(31,59,109,0.14); }

.submitToken { background: var(--c-blue-600); color: white; border: none; padding: 14px 30px; font-size: 16px; font-weight: 600; font-family: inherit; border-radius: var(--r-md); cursor: pointer; width: 100%; transition: all var(--t-fast); box-shadow: 0 2px 10px rgba(31,59,109,0.22); }
.submitToken:hover { background: var(--c-blue-700); box-shadow: 0 4px 16px rgba(31,59,109,0.34); transform: translateY(-1px); }

.tokenNumber { font-size: 60px; font-weight: 800; color: var(--c-blue-600); margin: 16px 0; letter-spacing: -2px; }
.tempoCambioToken { font-size: 18px; color: var(--c-text-3); }

/* ════════════════════════════════════════════════════════════
   MISC / HEREDADO
   ════════════════════════════════════════════════════════════ */

.input-card { position: relative; margin-bottom: 28px; height: 250px; }
.input-card textarea { width: 100%; height: 80%; border: none; outline: none; resize: none; font-size: 1.1em; font-family: inherit; }

.results { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding-bottom: 28px; }
.checks li { list-style: none; margin: 8px 0; font-size: 14px; }
.check-ok { color: var(--c-success); font-weight: 600; }
.check-bad { color: var(--c-danger);  font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   MÓVIL
   ════════════════════════════════════════════════════════════ */

.menu-toggle { position: fixed; top: 14px; left: 14px; font-size: 20px; background: var(--c-blue-600); color: white; border: none; border-radius: var(--r-sm); width: 38px; height: 38px; cursor: pointer; z-index: 1001; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .sidebar { position: fixed; left: calc(-1 * var(--sb-width)); top: 0; height: 100vh; transition: left var(--t-slow); z-index: 1000; }
  .sidebar.active { left: 0; }

  .main { padding: 0 18px 32px; }
  #progress-bar-container { margin: 0 -18px 22px; }

  .results           { grid-template-columns: 1fr; }
  .form-grid         { grid-template-columns: 1fr; }
  .evaluacion-valores { grid-template-columns: 1fr; }
  .evaluacion-valor-card strong { font-size: 28px; }

  .tiempo-bloque-header { flex-direction: column; align-items: flex-start; }
  .tabla-tiempos th, .tabla-tiempos td { padding: 9px; }
  .col-tiempo   { width: 120px; }
  .input-tiempo { width: 66px; }
  .total-tiempos-card { flex-direction: column; align-items: flex-start; gap: 10px; }

  .focus-mode .main { padding: 0 20px 32px; }
}

/* ════════════════════════════════════════════════════════════
   CUSTOM MODALS
   ════════════════════════════════════════════════════════════ */

.cm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 60, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cm-box {
  background: var(--c-surface);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15, 30, 60, 0.28);
  max-width: 500px;
  width: 100%;
  overflow: hidden;
  animation: cmSlideIn 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes cmSlideIn {
  from { opacity: 0; transform: translateY(-18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--c-border);
}

.cm-icon {
  font-size: 26px;
  flex-shrink: 0;
  line-height: 1;
}

.cm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-blue-600);
  margin: 0;
  line-height: 1.3;
}

.cm-body {
  padding: 18px 24px 22px;
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.65;
}

.cm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

.cm-btn-ok,
.cm-btn-confirm {
  background: var(--c-blue-600);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-base);
  min-width: 90px;
}

.cm-btn-ok:hover,
.cm-btn-confirm:hover {
  background: var(--c-blue-700);
}

.cm-btn-cancel {
  background: none;
  color: var(--c-text-3);
  border: 1.5px solid var(--c-border-s);
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base);
  min-width: 90px;
}

.cm-btn-cancel:hover {
  border-color: var(--c-text-2);
  color: var(--c-text-2);
}

/* Variante peligro para confirmaciones destructivas */
.cm-btn-confirm.danger {
  background: var(--c-danger);
}

.cm-btn-confirm.danger:hover {
  background: #b91c1c;
}

/* ════════════════════════════════════════════════════════════
   BOTÓN REGRESAR
   ════════════════════════════════════════════════════════════ */

.btn-regresar {
  display: inline-block;
  padding: 11px 24px;
  background: none;
  color: var(--c-text-3);
  border: 1.5px solid var(--c-border-s);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
  margin-right: 10px;
}

.btn-regresar:hover {
  border-color: var(--c-blue-600);
  color: var(--c-blue-600);
  background: var(--c-blue-50);
}

/* Agrupar botón regresar + siguiente en la misma fila */
.btn-regresar + .btn-siguiente {
  display: inline-block;
}

/* ════════════════════════════════════════════════════════════
   MEJORAS RESPONSIVE ADICIONALES
   ════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .btn-regresar,
  .btn-siguiente {
    width: 100%;
    margin-right: 0;
    margin-bottom: 8px;
    text-align: center;
  }

  .btn-regresar + .btn-siguiente {
    display: block;
  }

  .card {
    padding: 18px 14px;
  }

  h1 { font-size: 20px; }

  .progress-bar-container { padding: 8px 14px; }

  .tema-input-row {
    flex-direction: column;
  }

  .tema-input-row input,
  .tema-input-row button {
    width: 100%;
  }
}
