/* ============================================================
   CERTIFICA PREMIUM — DISEÑO X ROJO (GRAFITO VOLCÁNICO)
   ============================================================ */

:root {
  /* TEMA OSCURO (GRAFITO VOLCÁNICO) POR DEFECTO */
  --bg-primary: #14161a;      
  --bg-secondary: #1a1d24;
  --bg-gradient: linear-gradient(135deg, #14161a 0%, #1a1d24 100%);
  --bg-card: #1f232b;         
  --bg-card-soft: #292e38;    

  /* 🔥 ACENTO ROJO PREMIUM */
  --primary: #ff2d2d;         
  --primary-dark: #cc0000;    
  --primary-light: #ff6b6b;   
  --accent: #ff2d2d;          

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-light: #52525b;
  --text-on-dark: #ffffff;

  --shadow-dark-sm: 4px 4px 10px rgba(0,0,0,0.5), -4px -4px 10px rgba(255,255,255,0.03);
  --shadow-dark-md: 8px 8px 20px rgba(0,0,0,0.6), -6px -6px 16px rgba(255,255,255,0.04);
  --shadow-dark-lg: 12px 12px 30px rgba(0,0,0,0.7), -8px -8px 24px rgba(255,255,255,0.05);
  --shadow-inner: inset 4px 4px 8px rgba(0,0,0,0.6), inset -4px -4px 8px rgba(255,255,255,0.04);
  
  --neon-blue: rgba(255, 45, 45, 0.25); 

  --radius-sm: 12px; --radius-md: 20px; --radius-lg: 28px; --radius-xl: 40px; --radius-pill: 999px;
}

/* TEMA CLARO (PLÁSTICO BLANCO) */
[data-theme="light"] {
  --bg-primary: #e0e5ec;
  --bg-secondary: #e8ecf2;
  --bg-gradient: linear-gradient(135deg, #e0e5ec 0%, #e8ecf2 100%);
  --bg-card: #e8ecf2;
  --bg-card-soft: #eef2f7;
  
  --primary: #e63946;         
  --primary-dark: #b02a37;    
  --primary-light: #ff6b7a;   
  --accent: #e63946;          

  --text-primary: #1e2235;
  --text-secondary: #4a5578;
  --text-muted: #8a96b1;
  --text-light: #b8c0cc;
  --text-on-dark: #ffffff;

  --shadow-dark-sm: 4px 4px 8px #b8c0cc, -4px -4px 8px #ffffff;
  --shadow-dark-md: 6px 6px 16px #b8c0cc, -6px -6px 16px #ffffff;
  --shadow-dark-lg: 10px 10px 24px #b8c0cc, -10px -10px 24px #ffffff;
  --shadow-inner: inset 4px 4px 8px #b8c0cc, inset -4px -4px 8px #ffffff;
  
  --neon-blue: rgba(230, 57, 70, 0.25);
}

/* ============ RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background-color: var(--bg-primary); background-image: var(--bg-gradient);
  color: var(--text-primary); transition: background .4s ease, color .4s ease;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 20px; }
.hidden { display: none !important; }

/* ============ SPLASH ============ */
#splash { position: fixed; inset: 0; background: var(--bg-primary); background-image: var(--bg-gradient); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .6s ease; }
#splash.oculto { opacity: 0; pointer-events: none; }
.splash-logo { width: 140px; height: 140px; border-radius: 30px; background-color: var(--bg-card); background-repeat: no-repeat; background-position: center center; background-size: 110px 110px; display: flex; align-items: center; justify-content: center; font-size: 60px; margin-bottom: 22px; box-shadow: var(--shadow-dark-lg); animation: pulse 1.6s ease-in-out infinite; overflow: hidden; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.splash-texto { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 3px; color: var(--text-on-dark); margin-bottom: 4px; }
.splash-sub { font-size: 11px; letter-spacing: 3px; color: var(--text-light); text-transform: uppercase; font-weight: 600; }
.loader-line { width: 180px; height: 4px; background: rgba(255,255,255,.1); border-radius: 10px; overflow: hidden; margin-top: 26px; position: relative; }
.loader-line::after { content: ""; position: absolute; height: 100%; width: 40%; background: var(--primary); border-radius: 10px; animation: slide 1.5s infinite; }
@keyframes slide { from { left: -40%; } to { left: 140%; } }

/* ============ PANTALLA PIN ============ */
#pinPantalla { position: fixed; inset: 0; background: var(--bg-primary); background-image: var(--bg-gradient); z-index: 9998; display: none; align-items: center; justify-content: center; flex-direction: column; padding: 30px; }
.pin-card { max-width: 420px; width: 100%; background: var(--bg-card); border-radius: var(--radius-xl); padding: 40px 32px; text-align: center; box-shadow: var(--shadow-dark-lg); }
.pin-card .pin-emoji { font-size: 56px; margin-bottom: 16px; }
.pin-card h2 { font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 2px; color: var(--text-primary); margin-bottom: 8px; }
.pin-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.pin-card input { width: 100%; padding: 18px; border-radius: var(--radius-pill); border: 2px solid transparent; background: var(--bg-card-soft); color: var(--text-primary); font-family: inherit; font-size: 24px; text-align: center; letter-spacing: 12px; font-weight: 700; outline: none; box-shadow: var(--shadow-inner); transition: all .25s ease; }
.pin-card input:focus { border-color: var(--primary); box-shadow: var(--shadow-inner), 0 0 0 4px var(--neon-blue); }
.pin-card .pin-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 20px; font-weight: 600; }
.pin-card button { width: 100%; padding: 18px; border-radius: var(--radius-pill); border: none; background: var(--primary); color: #fff; font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; margin-top: 16px; box-shadow: 0 8px 20px rgba(0,0,0, 0.4); transition: all .25s ease; }
.pin-card button:hover { transform: translateY(-2px); }

/* ============ APP LAYOUT ============ */
#app { display: none; flex-direction: column; height: 100vh; }
#app.active { display: flex; }

/* ============ HEADER (CON HILO ROJO) ============ */
.header-main {
  position: relative; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px; background: var(--bg-card); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow-dark-md); min-height: 84px; flex-shrink: 0; transition: all 0.4s ease;
}
[data-theme="dark"] .header-main { background: #ffffff; }
[data-theme="light"] .header-main { background: #1e2235; }

.header-main::after {
  content: ''; position: absolute; bottom: 0; left: 10%; right: 10%; height: 2px;
  background: var(--primary); border-radius: 2px;
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
  opacity: 0.8; transition: all 0.4s ease;
}

.logo-container { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.logo-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--bg-card-soft); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--primary); background-repeat: no-repeat; background-position: center center; background-size: 38px 38px; box-shadow: var(--shadow-dark-sm); overflow: hidden; transition: all 0.4s ease; }
[data-theme="dark"] .logo-icon { background: #f0f0f0; box-shadow: 4px 4px 8px #d1d1d1, -4px -4px 8px #ffffff; }

.logo-text { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 2px; line-height: 1; transition: color 0.4s ease; }
[data-theme="dark"] .logo-text { color: #1a1a1a; }
[data-theme="light"] .logo-text { color: #ffffff; }
.logo-text span { color: var(--primary); }
.logo-text .sub { display: block; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; margin-top: 4px; text-transform: uppercase; transition: color 0.4s ease; }
[data-theme="dark"] .logo-text .sub { color: #666; }
[data-theme="light"] .logo-text .sub { color: rgba(255,255,255,0.6); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--bg-card-soft); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: all .25s ease; box-shadow: var(--shadow-dark-sm); }
[data-theme="dark"] .icon-btn { background: #f0f0f0; color: #333; box-shadow: 4px 4px 8px #d1d1d1, -4px -4px 8px #ffffff; }
[data-theme="light"] .icon-btn { background: rgba(255,255,255,0.1); color: #fff; }
.icon-btn:hover { color: var(--primary); transform: translateY(-2px); }
.icon-btn:active { box-shadow: var(--shadow-inner); }

/* ============ SIDE MENU (NEUMÓRFICO) ============ */
.menu-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); z-index: 100; }
.menu-overlay.active { display: block; }
.side-menu { position: fixed; top: 0; right: -420px; width: 380px; max-width: 88vw; height: 100%; background: var(--bg-card); z-index: 101; transition: right .45s cubic-bezier(.22,1,.36,1); padding: 32px 24px; overflow-y: auto; box-shadow: -12px 0 40px rgba(0,0,0,.5); border-radius: var(--radius-xl) 0 0 var(--radius-xl); border-left: 1px solid rgba(255,255,255,0.02); }
.side-menu.open { right: 0; }
.menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.menu-header h3 { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 2px; color: var(--text-primary); }
.menu-header h3 i { color: var(--primary); margin-right: 8px; }
.close-menu { background: var(--bg-card-soft); border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .2s; box-shadow: var(--shadow-dark-sm); }
.close-menu:hover { color: var(--primary); transform: rotate(90deg); }
.menu-section { margin-bottom: 8px; }
.menu-section .section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); padding: 8px 18px; margin-bottom: 6px; font-weight: 700; }
.menu-divider { height: 2px; background: var(--bg-card-soft); box-shadow: var(--shadow-inner); margin: 16px 0; border: none; }
.menu-item { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--radius-pill); color: var(--text-secondary); font-size: 15px; font-weight: 600; cursor: pointer; transition: all .25s ease; border: none; background: none; width: 100%; text-align: left; margin-bottom: 6px; }
.menu-item:hover { background: var(--bg-card-soft); transform: translateX(-4px); color: var(--primary); }
.menu-item i { width: 32px; height: 32px; text-align: center; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 15px; background: var(--bg-card-soft); border-radius: 50%; flex-shrink: 0; box-shadow: var(--shadow-dark-sm); }

/* MENÚ ACTIVO HUNDIDO EN AMBOS MODOS */
.menu-item.active { background: var(--bg-card-soft); color: var(--primary); box-shadow: var(--shadow-inner); }
.menu-item.active i { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow-dark-sm); }

/* ============ MAIN CONTAINER ============ */
.main-container { position: relative; z-index: 10; flex: 1; overflow-y: auto; padding: 32px 32px 100px 32px; height: calc(100vh - 84px); max-width: 1600px; margin: 0 auto; width: 100%; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.section-title { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 2px; color: var(--text-on-dark); }
.section-title small { font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500; color: var(--text-light); margin-left: 12px; text-transform: none; }

/* ============ CARDS ============ */
.card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; margin-bottom: 20px; box-shadow: var(--shadow-dark-md); border: 1px solid rgba(255,255,255,0.02); }
[data-theme="light"] .card { border: 1px solid rgba(255,255,255,0.5); }
.cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* ============ MODULE CARDS + LEDs ============ */
.module-card { position: relative; background: var(--bg-card); border-radius: var(--radius-lg); padding: 36px 24px 46px 24px; transition: all .35s cubic-bezier(.22,1,.36,1); cursor: pointer; text-align: center; box-shadow: var(--shadow-dark-md); min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.02); font-family: inherit; color: inherit; }
[data-theme="light"] .module-card { border: 1px solid rgba(255,255,255,0.5); }
.module-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-dark-lg); }
.module-card:active { transform: scale(.97); }
.module-card i { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; font-size: 32px; background: var(--bg-card-soft); color: var(--primary); border-radius: 50%; margin-bottom: 16px; box-shadow: var(--shadow-dark-sm); transition: all 0.3s ease; }
.module-card:hover i { transform: scale(1.1); color: var(--primary-light); filter: drop-shadow(0 0 8px var(--primary)); }
.module-card h3 { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 1.5px; color: var(--text-primary); margin-bottom: 4px; }
.module-card p { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* El LED Rojo */
.module-card::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 50px; height: 10px; border-radius: 50px; background-color: var(--primary); box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary); transition: all 0.3s ease; z-index: 1; }
.module-card:hover::after { box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary); transform: translateX(-50%) scaleY(1.2); }

/* ============ FORMULARIOS ============ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .8px; }
.form-group input, .form-group select, .form-group textarea { padding: 14px 20px; border-radius: var(--radius-pill); border: 2px solid transparent; background: var(--bg-card-soft); color: var(--text-primary); outline: none; transition: all .25s ease; width: 100%; font-size: 15px; font-family: inherit; font-weight: 500; box-shadow: var(--shadow-inner); }
.form-group textarea { border-radius: 16px; resize: vertical; line-height: 1.6; padding: 16px 20px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: var(--shadow-inner), 0 0 0 4px var(--neon-blue); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============ BOTONES ============ */
.btn { padding: 14px 24px; border: none; border-radius: var(--radius-pill); font-weight: 700; font-size: 14px; cursor: pointer; transition: all .25s ease; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; letter-spacing: .5px; text-transform: uppercase; }
.btn:active { transform: scale(.97); box-shadow: var(--shadow-inner); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0, 0.3); }
.btn-primary:hover { transform: translateY(-2px); background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 6px 16px rgba(34,197,94,.3); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(239,68,68,.3); }
.btn-secondary { background: var(--bg-card-soft); color: var(--text-secondary); box-shadow: var(--shadow-dark-sm); border: 1px solid rgba(255,255,255,0.05); }
[data-theme="light"] .btn-secondary { border: 1px solid rgba(255,255,255,0.5); }
.btn-secondary:hover { color: var(--primary); transform: translateY(-2px); }
.btn-sm { padding: 10px 16px; font-size: 12px; }
.btn-block { width: 100%; }

/* ============ SELECTOR DE PLANTILLA ============ */
.selector-plantilla:hover { border-color: var(--primary) !important; background: var(--bg-card-soft) !important; }

/* ============ STATS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; text-align: center; box-shadow: var(--shadow-dark-md); border: 1px solid rgba(255,255,255,0.02); }
[data-theme="light"] .stat { border: 1px solid rgba(255,255,255,0.5); }
.stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.stat .value { font-family: 'Bebas Neue', sans-serif; font-size: 36px; color: var(--primary); margin-top: 8px; }

/* ============ MODAL ============ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); z-index: 9999; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { max-width: 540px; width: 100%; max-height: 90vh; background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-dark-lg); overflow-y: auto; animation: modalIn .35s cubic-bezier(.22,1,.36,1); }
@keyframes modalIn { from { opacity: 0; transform: scale(.94) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-title { font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 1.5px; margin-bottom: 20px; color: var(--text-primary); }
.modal-actions { display: flex; gap: 12px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

/* ============ TOAST ============ */
#toastContainer { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 99999; width: 90%; max-width: 440px; pointer-events: none; }
.toast { background: var(--bg-card); border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 10px; box-shadow: var(--shadow-dark-md); color: var(--text-primary); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 12px; animation: toastIn .4s cubic-bezier(.22,1,.36,1); pointer-events: all; border-left: 5px solid var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
.toast .toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--primary); }
.toast .toast-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; margin-left: auto; font-weight: 700; }

/* ============ BOTÓN VOLVER ============ */
.btn-volver { background: transparent; border: none; color: var(--primary); cursor: pointer; font-family: inherit; font-size: 14px; padding: 8px 0; margin-bottom: 16px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.btn-volver:hover { color: var(--primary-light); }

/* ============ HISTORIAL ============ */
.lista-historial { display: flex; flex-direction: column; gap: 12px; margin-bottom: 90px; }
.item-historial { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-dark-md); border: 1px solid rgba(255,255,255,0.02); position: relative; cursor: pointer; transition: all .25s ease; display: flex; flex-direction: column; gap: 12px; }
[data-theme="light"] .item-historial { border: 1px solid rgba(255,255,255,0.5); }
.item-historial:hover { transform: translateY(-3px); }
.item-historial.seleccionado { border: 2px solid var(--primary); box-shadow: 0 0 0 3px var(--neon-blue), var(--shadow-dark-md); }
.item-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.item-info p { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.item-info .folio { font-family: 'Courier New', monospace; font-weight: 700; color: var(--primary); font-size: 12px; }
.item-acciones { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ============ BOTONES DE ACCIÓN ============ */
.btn-pdf, .btn-png, .btn-wa, .btn-email, .btn-eliminar { padding: 10px 16px; border-radius: var(--radius-pill); border: none; cursor: pointer; font-size: 12px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-family: inherit; text-transform: uppercase; letter-spacing: .5px; transition: all .2s ease; }
.btn-pdf { background: var(--bg-card-soft); color: var(--primary); box-shadow: var(--shadow-dark-sm); }
.btn-png { background: var(--bg-card-soft); color: #7b1fa2; box-shadow: var(--shadow-dark-sm); }
.btn-wa { background: var(--bg-card-soft); color: #25D366; box-shadow: var(--shadow-dark-sm); }
.btn-email { background: var(--bg-card-soft); color: #1976d2; box-shadow: var(--shadow-dark-sm); }
.btn-eliminar { background: rgba(239,68,68,.15); color: var(--danger); }
.btn-pdf:hover, .btn-png:hover, .btn-wa:hover, .btn-email:hover { transform: translateY(-2px); }

.vacio { text-align: center; padding: 48px 24px; color: var(--text-muted); font-size: 14px; }
.vacio .emoji { font-size: 56px; display: block; margin-bottom: 14px; opacity: .5; }
.contador { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--bg-card-soft); box-shadow: var(--shadow-inner); font-size: 12px; font-weight: 700; color: var(--primary); margin-left: 8px; }

/* ============ CHECKBOX ============ */
.checkbox-item { position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--text-light); background: var(--bg-card-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s ease; z-index: 2; font-size: 15px; color: transparent; font-weight: 900; user-select: none; }
.checkbox-item.activo { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ BARRA FLOTANTE ============ */
.barra-flotante { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px); width: calc(100% - 32px); max-width: 600px; background: var(--primary); color: #fff; border-radius: var(--radius-lg); padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0, 0.4); z-index: 9998; transition: transform .35s cubic-bezier(.2, 1, .3, 1); pointer-events: none; opacity: 0; }
.barra-flotante.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.barra-flotante-info { font-size: 14px; font-weight: 600; }
.barra-flotante-info strong { font-size: 18px; font-weight: 800; margin-right: 3px; }
.barra-flotante-acciones { display: flex; gap: 8px; flex-shrink: 0; }
.btn-flotante-limpiar { padding: 10px 14px; border-radius: var(--radius-pill); border: none; background: rgba(255,255,255,.2); color: #fff; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-flotante-zip { padding: 10px 16px; border-radius: var(--radius-pill); border: none; background: #fff; color: var(--primary-dark); font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }

/* ============ BARRA SELECCIÓN ============ */
.barra-seleccion { display: flex; gap: 8px; margin-bottom: 14px; }
.btn-mini { flex: 1; padding: 12px 16px; border-radius: var(--radius-pill); border: none; background: var(--bg-card-soft); color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-dark-sm); transition: all .2s ease; }
.btn-mini:hover { color: var(--primary); }
.btn-mini-zip { background: var(--primary); color: #fff; }

/* ============ MANUAL ============ */
.manual-seccion { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 16px; box-shadow: var(--shadow-dark-md); }
.manual-seccion h3 { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 1.5px; margin-bottom: 14px; color: var(--primary); }
.manual-seccion p, .manual-seccion li { font-size: 13.5px; color: var(--text-secondary); line-height: 1.8; }
.manual-seccion ol, .manual-seccion ul { padding-left: 22px; }
.manual-seccion code { background: var(--bg-card-soft); padding: 2px 8px; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 12px; color: var(--primary); font-weight: 700; }

/* ============ CAMPOS DE NOMBRES LOTE ============ */
.campo-nombre-lote { animation: aparecer .3s cubic-bezier(.2, 1, .3, 1); }
@keyframes aparecer { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
#listaNombresLote { max-height: 500px; overflow-y: auto; padding-right: 4px; }
#pegarLista { min-height: 160px; font-family: 'Roboto Mono', 'Courier New', monospace !important; font-size: 12.5px !important; line-height: 1.8 !important; letter-spacing: 0 !important; }

/* ============ OVERLAY GENÉRICO ============ */
.overlay-progreso { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(10px); z-index: 99999; display: none; align-items: center; justify-content: center; flex-direction: column; padding: 30px; }
.overlay-progreso.active { display: flex; }
.overlay-card { max-width: 420px; width: 100%; background: var(--bg-card); border-radius: var(--radius-xl); padding: 36px 30px; text-align: center; box-shadow: var(--shadow-dark-lg); }
.overlay-card .emoji { font-size: 48px; margin-bottom: 16px; display: block; }
.overlay-card h3 { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 1.5px; color: var(--text-primary); margin-bottom: 8px; }
.overlay-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; min-height: 20px; }
.overlay-barra { height: 10px; background: rgba(0,0,0,.3); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.overlay-barra > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary-dark), var(--primary-light)); border-radius: 6px; transition: width .3s ease; }
.overlay-contador { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.spinner-overlay { width: 44px; height: 44px; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--primary); border-radius: 50%; animation: spinOverlay .8s linear infinite; margin: 0 auto 16px; }
@keyframes spinOverlay { to { transform: rotate(360deg); } }

/* ============ CONTENEDOR DE CAPTURA ============ */
#capturaContenedor { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #ffffff; z-index: 99998; overflow: auto; display: none; justify-content: center; align-items: flex-start; padding: 10px; }

/* ============ PANEL DEV ============ */
.dev-header { background: var(--bg-card); color: var(--text-primary); border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 20px; box-shadow: var(--shadow-dark-md); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dev-header h2 { font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 2px; }
.dev-header p { font-size: 12px; color: var(--text-muted); margin-top: 4px; letter-spacing: 1px; }
.dev-header .dev-badge { background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; padding: 6px 14px; border-radius: 999px; text-transform: uppercase; }

.dev-escenarios { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.dev-escenario-btn { padding: 10px 16px; border-radius: var(--radius-pill); border: 2px solid transparent; background: var(--bg-card-soft); color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: all .2s ease; text-transform: uppercase; }
.dev-escenario-btn:hover { border-color: var(--primary); color: var(--primary); }
.dev-escenario-btn.activo { background: var(--primary); color: #fff; }

.dev-grupo { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-dark-md); }
.dev-grupo h3 { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 1.5px; color: var(--primary); margin-bottom: 14px; }

.dev-modulo { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-radius: var(--radius-pill); background: var(--bg-card-soft); margin-bottom: 8px; transition: all .2s ease; cursor: pointer; }
.dev-modulo:hover { transform: translateX(4px); }
.dev-modulo-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.dev-modulo-info .icono { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); box-shadow: var(--shadow-dark-sm); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.dev-modulo-info .texto h4 { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin: 0 0 2px; }
.dev-modulo-info .texto p { font-size: 11px; color: var(--text-muted); margin: 0; }

.dev-switch { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--bg-card-soft); box-shadow: var(--shadow-inner); cursor: pointer; transition: all .25s ease; flex-shrink: 0; border: none; padding: 0; }
.dev-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text-muted); transition: all .25s ease; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.dev-switch.activo { background: var(--primary); }
.dev-switch.activo::after { left: 25px; background: #fff; }

.dev-precio { background: var(--bg-card-soft); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dev-precio .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.dev-precio .monto { font-family: 'Bebas Neue', sans-serif; font-size: 42px; color: var(--primary); line-height: 1; }
.dev-precio .monto small { font-size: 16px; color: var(--text-secondary); margin-left: 4px; }
.dev-precio .plan-nombre { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 1.5px; color: var(--text-primary); margin-bottom: 4px; }

.dev-acciones { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.dev-acciones .btn { flex: 1; min-width: 200px; }

.dev-toast { position: fixed; bottom: 30px; right: 30px; background: var(--primary); color: #fff; padding: 16px 24px; border-radius: var(--radius-lg); font-size: 14px; font-weight: 700; box-shadow: 0 12px 32px rgba(0,0,0, 0.4); z-index: 99999; animation: slideInRight .4s cubic-bezier(.22,1,.36,1); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ============ RESPONSIVE ============ */
@media (min-width: 600px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .cards-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }
@media (max-width: 480px) {
  .header-main { padding: 12px 18px; min-height: 72px; }
  .main-container { padding: 22px 18px 100px 18px; height: calc(100vh - 72px); }
  .cards-grid { gap: 12px; }
  .module-card { padding: 24px 16px 40px 16px; min-height: 150px; }
  .module-card i { width: 56px; height: 56px; font-size: 24px; }
  .module-card h3 { font-size: 16px; }
  .module-card p { font-size: 11.5px; }
  .section-title { font-size: 26px; }
  .row { grid-template-columns: 1fr; }
  .icon-btn { width: 46px; height: 46px; }
  .logo-text { font-size: 20px; }
  #listaNombresLote input[type="tel"], #listaNombresLote input[type="email"] { font-size: 11px; }
}
@media (max-width: 600px) {
  .dev-header { padding: 18px 20px; }
  .dev-header h2 { font-size: 22px; }
  .dev-precio .monto { font-size: 32px; }
  .dev-modulo { padding: 12px 14px; }
  .dev-acciones .btn { min-width: 100%; }
}
/* ============================================================
   PARCHE MAESTRO: FORZAR EL DISEÑO EN MODO OSCURO
   (No afecta al modo claro)
   ============================================================ */

/* 1. Fondo de las tarjetas (Evita que app.js las ponga blancas) */
[data-theme="dark"] .module-card, 
[data-theme="dark"] .card, 
[data-theme="dark"] .stat {
  background: var(--bg-card) !important;
  border: 1px solid rgba(255,255,255,0.05) !important;
}

/* 2. Textos para que se lean bien */
[data-theme="dark"] .module-card h3, 
[data-theme="dark"] .card h3, 
[data-theme="dark"] .section-title {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .module-card p, 
[data-theme="dark"] .card p {
  color: var(--text-muted) !important;
}

/* 3. El menú lateral SÓLIDO (Quitar el cristal) */
.side-menu {
  background: var(--bg-card) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 4. El fondo de los botones del menú (No blanco) */
[data-theme="dark"] .menu-item i {
  background: var(--bg-card-soft) !important;
}

/* 5. El botón activo del menú (Hundido) */
[data-theme="dark"] .menu-item.active {
  background: var(--bg-card-soft) !important;
  color: var(--primary) !important;
  box-shadow: var(--shadow-inner) !important;
}
[data-theme="dark"] .menu-item.active i {
  background: var(--bg-card) !important;
  color: var(--primary) !important;
}