/* ==========================================================================
   PALETA CORPORATIVA elizabethhaydee.one & DISEÑO PREMIUM GLASSMORPHISM
   ========================================================================== */
:root {
    --primary: #0F4C81;
    --primary-hover: #1b5e9c;
    --secondary: #1E293B;
    --bg-gradient: linear-gradient(135deg, #E2E8F0 0%, #F1F5F9 100%);
    --white: #FFFFFF;
    --border: rgba(255, 255, 255, 0.4);
    --border-dark: rgba(15, 76, 129, 0.15);
    --text: #0F172A;
    --text-muted: #64748B;
    
    --orange: #F97316;
    --orange-hover: #ea580c;
    
    --status-ok: #059669;
    --status-pend: #D97706;
    --status-err: #DC2626;

    --radius: 16px;
    --shadow-glass: 0 10px 30px 0 rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-gradient);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.8rem; }
.mb-2 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-center { text-align: center; }

/* ==========================================================================
   EFECTOS GLASSMORPHISM
   ========================================================================== */
.card-glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-glass);
}

.card-glass-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dark);
}

.card-glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dark);
}

.card-glass-sub {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.view-container { width: 100%; min-height: 100vh; }
.view-container.active { display: block; }

/* Botones estructurados */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 1.4rem;
    height: 46px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-large { height: 52px; font-size: 0.95rem; }
.btn-small { height: 36px; font-size: 0.8rem; padding: 0 1rem; }
.btn-massive { height: 64px; font-size: 1.15rem; border-radius: 16px; }

.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: #E2E8F0; color: var(--secondary); }
.btn-orange { background-color: var(--orange); color: var(--white); }
.btn-orange:hover { background-color: var(--orange-hover); }
.btn-danger { background-color: var(--status-err); color: var(--white); }

/* Formularios */
.form-group { margin-bottom: 1.2rem; width: 100%; }
label { display: block; font-size: 0.8rem; font-weight: 800; margin-bottom: 0.4rem; text-transform: uppercase; color: var(--secondary); letter-spacing: 0.5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    border: 2px solid rgba(15, 76, 129, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: all 0.2s;
}
input:focus, select:focus { border-color: var(--primary); background-color: var(--white); box-shadow: 0 0 0 4px rgba(15, 76, 129, 0.1); }
.filled-read { background-color: rgba(15, 76, 129, 0.04) !important; font-weight: 700; color: var(--primary); border-color: transparent !important; cursor: not-allowed; }
.input-massive { height: 64px; font-size: 1.6rem; font-weight: 800; text-align: center; color: var(--primary); border-radius: 16px; }
.highlight-label { color: var(--orange); font-size: 0.95rem; text-align: center; }

.toolbar-controls { display: flex; gap: 1rem; flex-wrap: wrap; }
.filter-group { flex: 1; min-width: 220px; }
.inline-edit-box { height: 38px !important; padding: 0 0.5rem !important; font-size: 0.85rem !important; border-radius: 8px !important; }

/* Vista Login */
#login-view { display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-wrapper { width: 100%; max-width: 420px; padding: 3rem 2.5rem; overflow: hidden; }
.brand-header { text-align: center; margin-bottom: 2.5rem; width: 100%; }

.brand-header h1 { 
    color: var(--primary); 
    font-size: 2.2rem; 
    font-weight: 900; 
    letter-spacing: 0.5px; 
    margin-bottom: 0.5rem; 
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.1;
}

/* Cabecera Central */
.app-header { height: 75px; display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; position: sticky; top: 0; z-index: 100; }
.brand-title h2 { color: var(--primary); display: flex; align-items: center; gap: 0.6rem; font-size: 1.4rem; font-weight: 800; }
.badge { background-color: var(--orange); color: var(--white); padding: 0.25rem 0.6rem; font-size: 0.7rem; border-radius: 6px; text-transform: uppercase; font-weight: 800; }
.user-info { display: flex; align-items: center; gap: 1.2rem; font-weight: 700; }

/* Barra de Navegación */
.app-nav { display: flex; overflow-x: auto; }
.nav-btn { flex: 1; min-width: 130px; height: 60px; border: none; background: transparent; display: flex; align-items: center; justify-content: center; gap: 0.6rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; pointer-events: auto; font-size: 0.85rem; }
.nav-btn.active { color: var(--primary); border-bottom-color: var(--primary); background-color: rgba(15, 76, 129, 0.05); }
.nav-icon { font-size: 1.3rem; pointer-events: none; }
.nav-text { pointer-events: none; }

.content-panel { display: none; }
.content-panel.active { display: block; }

.main-content { padding: 2rem; max-width: 1400px; margin: 0 auto; width: 100%; padding-bottom: 100px; }
.panel-card { padding: 2rem; margin-bottom: 2rem; }
.panel-card h3 { color: var(--primary); margin-bottom: 0.5rem; text-transform: uppercase; font-size: 1.1rem; font-weight: 800; letter-spacing: 0.5px; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.split-header-box { display: flex; justify-content: space-between; align-items: flex-start; }
.grid-split { display: grid; grid-template-columns: 350px 1fr; gap: 2rem; align-items: start; }

.camera-box { width: 100%; max-width: 500px; margin: 0 auto 1.5rem auto; border: 3px solid var(--primary); border-radius: var(--radius); overflow: hidden; padding: 0.5rem; background: #000; box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
#reader { width: 100%; }
.manual-input-divider { text-align: center; margin: 2rem 0; position: relative; }
.manual-input-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: rgba(15, 76, 129, 0.15); z-index: 1; }
.manual-input-divider span { background: var(--bg-gradient); padding: 0 1.2rem; color: var(--primary); font-size: 0.8rem; position: relative; z-index: 2; text-transform: uppercase; font-weight: 800; border-radius: 20px; }

.scan-input-group { display: flex; gap: 0.5rem; margin-bottom: 0; }
.scan-input-group input { flex: 1; font-size: 1.15rem; font-weight: 700; }

.file-input { padding: 0.8rem; height: auto; border: 2px dashed rgba(15, 76, 129, 0.3); border-radius: 12px; cursor: pointer; text-align: center; width: 100%; background: rgba(255,255,255,0.5); font-weight: 600; }

/* Tablas */
.table-card { padding: 0; overflow: hidden; }
.table-header-actions { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-dark); background: rgba(255,255,255,0.4); }
.table-responsive { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; white-space: nowrap; }
.data-table th, .data-table td { padding: 1rem 1.2rem; border-bottom: 1px solid rgba(15, 76, 129, 0.06); vertical-align: middle; }
.data-table th { background-color: rgba(15, 76, 129, 0.03); color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background-color: rgba(255, 255, 255, 0.9); }

/* Colores para Reporte Independiente */
.row-faltante { background-color: rgba(220, 38, 38, 0.04); }
.row-sobrante { background-color: rgba(249, 115, 22, 0.05); }
.row-conciliado { background-color: rgba(5, 150, 105, 0.04); }

.table-footer-bar { padding: 1.2rem 2rem; background: rgba(255,255,255,0.5); border-top: 1px solid var(--border-dark); text-align: right; }

.status-tag { padding: 0.35rem 0.8rem; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; display: inline-block; letter-spacing: 0.5px; }
.status-correcto { background-color: rgba(5, 150, 105, 0.1); color: var(--status-ok); }
.status-inconsistente { background-color: rgba(249, 115, 22, 0.1); color: var(--orange); }
.status-pendiente { background-color: rgba(220, 38, 38, 0.1); color: var(--status-err); }

/* DASHBOARD METRICAS */
.dashboard-captura-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dash-card {
    background: var(--white);
    border: 1px solid rgba(15, 76, 129, 0.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.08);
}

/* ==========================================================================
   ESTILOS INYECTADOS: TARJETAS INTERACTIVAS CLICKABLES PARA MODAL DESGLOSE
   ========================================================================== */
.dash-clickable {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dash-clickable:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(15, 76, 129, 0.15);
}

.dash-clickable[data-kpi-target="completadas"]:hover {
    border-color: var(--status-ok);
    background-color: #F0FDF4;
}

.dash-clickable[data-kpi-target="pendientes"]:hover {
    border-color: var(--orange);
    background-color: #FFFBEB;
}

.dash-clickable[data-kpi-target="detalle"]:hover {
    border-color: var(--status-err);
    background-color: #FEF2F2;
}

.dash-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 900;
    flex-shrink: 0;
}

.dash-info {
    display: flex;
    flex-direction: column;
}

.dash-lbl {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.dash-val {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--secondary);
    line-height: 1;
}

/* BARRA DE PROGRESO EVOLUTIVA MUY HERMOSA */
.progress-section {
    padding: 1.5rem 2rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(15, 76, 129, 0.15);
    box-shadow: 0 8px 30px rgba(15, 76, 129, 0.08);
    position: relative;
    overflow: hidden;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.progress-title {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-percentage {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    transition: color 0.4s, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-wrapper {
    width: 100%;
    height: 28px;
    background-color: rgba(15, 76, 129, 0.06);
    border-radius: 14px;
    padding: 4px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

.progress-bar-evolutive {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #0F4C81 0%, #059669 100%);
    background-size: 200% 100%;
    animation: gradientShift 4s ease infinite;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3);
}

.progress-bar-evolutive::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(
        -45deg, 
        rgba(255, 255, 255, 0.25) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.25) 50%, 
        rgba(255, 255, 255, 0.25) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 35px 35px;
    animation: moveStripes 1.5s linear infinite;
}

/* CHIPS ACUMULATIVOS */
.manual-tags-area {
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.6rem; 
    margin-bottom: 1.2rem; 
    min-height: 52px; 
    padding: 0.6rem; 
    background: rgba(15, 76, 129, 0.03); 
    border: 2px dashed rgba(15, 76, 129, 0.2); 
    border-radius: 12px; 
    align-items: center;
}

.location-tag-chip {
    background-color: var(--primary);
    color: var(--white);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 6px rgba(15, 76, 129, 0.15);
}

.location-tag-chip button {
    background: transparent;
    border: none;
    color: var(--orange);
    font-weight: 900;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.location-tag-chip button:hover {
    color: var(--white);
}

@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 35px 0; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--secondary); color: var(--white); padding: 1rem 1.5rem; border-radius: 12px; font-weight: 700; box-shadow: 0 10px 25px rgba(0,0,0,0.2); pointer-events: auto; font-size: 0.9rem; }
.toast.error { background: var(--status-err); }

/* Modal Táctil */
.custom-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.6); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-content { width: 100%; max-width: 600px; max-height: 85vh; overflow-y: auto; margin: 0; padding: 2rem; border-radius: 24px; }
.modal-header-box { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-dark); padding-bottom: 1rem; }
.btn-close-bare { background: transparent; border: none; font-size: 1.6rem; font-weight: 900; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.btn-close-bare:hover { color: var(--status-err); }
.modal-list-container { display: flex; flex-direction: column; gap: 1rem; }

/* MEMORIA VISUAL PARA DESAMBIGUACIÓN DE VARIANTES */
.touch-select-card { 
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    padding: 1.2rem 1.5rem; 
    background: rgba(255, 255, 255, 0.8); 
    border: 2px solid rgba(15, 76, 129, 0.1); 
    border-radius: 16px; 
    cursor: pointer; 
    transition: all 0.2s; 
    text-align: left; 
    width: 100%; 
    box-shadow: var(--shadow-sm); 
}
.touch-select-card:hover { 
    border-color: var(--primary); 
    background: var(--white); 
    transform: translateY(-2px); 
    box-shadow: 0 8px 20px rgba(15,76,129,0.1); 
}

.touch-select-card.counted-variant {
    background-color: #ECFDF5 !important;
    border-color: #10B981 !important;
}
.touch-select-card.counted-variant .touch-title {
    color: #065F46 !important;
}
.counted-tag-memory {
    background-color: #10B981;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.touch-title { font-size: 1.15rem; font-weight: 800; color: var(--primary); margin-bottom: 0.4rem; }
.touch-detail { font-size: 0.9rem; color: var(--text-muted); line-height: 1.4; }

/* RESPONSIVIDAD MÓVIL */
@media (max-width: 768px) {
    .grid-split { grid-template-columns: 1fr; gap: 1.5rem; }
    .app-header { padding: 0 1.2rem; height: 65px; }
    .brand-title h2 { font-size: 1.2rem; }
    
    .brand-header h1 { font-size: 1.8rem; } 
    
    .app-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: 75px; z-index: 1000; justify-content: space-around; box-shadow: 0 -4px 20px rgba(0,0,0,0.08); border-top: 1px solid var(--border-dark); border-bottom: none; border-radius: 20px 20px 0 0; }
    .nav-btn { flex-direction: column; gap: 0.3rem; height: 100%; min-width: auto; border-bottom: none; border-top: 3px solid transparent; padding: 0; }
    .nav-btn.active { border-bottom-color: transparent; border-top-color: var(--orange); background: transparent; }
    .nav-icon { font-size: 1.4rem; }
    .nav-text { font-size: 0.65rem; font-weight: 800; }
    
    .main-content { padding: 1rem; padding-bottom: 110px; }
    .panel-card { padding: 1.5rem; margin-bottom: 1.5rem; }
    .input-massive { font-size: 1.4rem; height: 56px; }
    .toolbar-controls { flex-direction: column; gap: 0.8rem; }
    
    .progress-section { padding: 1.2rem; }
    .progress-percentage { font-size: 1.3rem; }
}