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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4A5568 0%, #2D3748 100%);
    color: white;
    padding: 20px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
}

.header-title {
    text-align: left;
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.header p {
    opacity: 0.9;
    font-size: 0.95em;
    margin: 0;
}

.consolidator-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-size: 1em;
}

.consolidator-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.consolidator-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.backup-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    font-size: 1em;
}

.backup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.backup-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.templates-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    font-size: 1em;
}

.templates-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-title {
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .header-actions button {
        width: 100%;
    }
}

.upload-section {
    padding: 20px;
    text-align: center;
}

.upload-section {
    padding: 20px;
}

.compact-upload-container {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    border: 2px solid #3B82F6;
}

.compact-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compact-label {
    font-size: 0.9em;
    font-weight: 600;
    color: #1e40af;
    text-align: center;
}

.compact-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.template-select-compact {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    font-size: 0.95em;
    color: #4A5568;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.template-select-compact:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

.template-select-compact:not(:disabled):hover {
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.template-select-compact:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.refresh-btn-compact {
    padding: 10px 12px;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.refresh-btn-compact:hover {
    background: #2563EB;
    transform: rotate(180deg);
}

.compact-controls input[type="file"] {
    display: none;
}

.file-btn-compact {
    flex: 1;
    padding: 10px 15px;
    background: #3B82F6;
    color: white;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
}

.file-btn-compact:hover:not(.disabled) {
    background: #2563EB;
    transform: translateY(-1px);
}

.file-btn-compact.disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

.file-btn-compact.disabled:hover {
    transform: none;
}

.delimiter-select-compact {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    font-size: 0.85em;
    color: #4A5568;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.delimiter-select-compact:hover {
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.delimiter-select-compact:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.custom-delimiter-compact {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    font-size: 0.9em;
    color: #4A5568;
    background: white;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
}

.custom-delimiter-compact:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.info-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.info-badge {
    padding: 8px 16px;
    background: white;
    border: 2px solid #3B82F6;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    color: #1e40af;
    white-space: nowrap;
}

.info-badge-file {
    border-color: #cbd5e1;
    color: #64748b;
    font-weight: 500;
}

.info-badge-file.active {
    border-color: #10b981;
    color: #047857;
    font-weight: 600;
}

.cumulative-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 2px solid #8b5cf6;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    color: #6d28d9;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.cumulative-toggle:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
}

.cumulative-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.clear-data-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.clear-data-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.clear-data-btn:active {
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .compact-upload-container {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .compact-section:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .compact-upload-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .compact-section:last-child {
        grid-column: auto;
    }
}

/* ========================================
   MODALES PERSONALIZADOS
   ======================================== */

.alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.alert-overlay.show {
    display: flex;
}

.alert-modal {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease-out;
    position: relative;
}

.alert-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.alert-modal-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.alert-modal-title {
    font-size: 1.4em;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.alert-modal-message {
    color: #475569;
    font-size: 1.05em;
    line-height: 1.6;
    margin-bottom: 25px;
}

.alert-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.alert-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-modal-btn-confirm {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.alert-modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.alert-modal-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.alert-modal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

.alert-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.alert-modal-btn-cancel:hover {
    background: #e2e8f0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
    display: inline-block;
    cursor: pointer;
    margin-bottom: 20px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: inline-block;
    padding: 15px 40px;
    background: #3B82F6;
    color: white;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-input-label:hover {
    background: #2563EB;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.file-name {
    margin-top: 15px;
    font-size: 1em;
    color: #666;
    min-height: 24px;
}

.file-name.active {
    color: #3B82F6;
    font-weight: 600;
}

.delimiter-section {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8eeff 100%);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.delimiter-label {
    font-size: 1em;
    color: #4A5568;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.delimiter-label::before {
    content: "⚙️";
    font-size: 1.2em;
}

.delimiter-select {
    padding: 10px 20px;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    font-size: 0.95em;
    color: #4A5568;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233B82F6' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.delimiter-select:hover {
    border-color: #2563EB;
    background-color: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.delimiter-select:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.custom-delimiter-input {
    padding: 10px 16px;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    font-size: 0.95em;
    color: #4A5568;
    width: 160px;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    background-color: white;
}

.custom-delimiter-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.custom-delimiter-input:hover {
    border-color: #2563EB;
    background-color: #f8f9ff;
}

.custom-delimiter-input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: scale(1.02);
}

.template-action {
    margin-top: 25px;
    text-align: center;
}

.templates-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.templates-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.templates-btn:active {
    transform: translateY(0);
}

.table-container {
    padding: 0 20px 20px 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}

thead {
    background: #4A5568;
    color: white;
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Estilo especial para la columna de número de fila */
td:first-child {
    background-color: #f8f9ff;
    font-weight: bold;
    color: #4A5568;
    text-align: center;
}

th:first-child {
    text-align: center;
    background-color: #374151;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9ff;
}

tbody tr:last-child td {
    border-bottom: none;
}

.info-section {
    padding: 15px 20px;
    background: #f8f9ff;
    border-top: 2px solid #e0e0e0;
    display: none;
}

.info-section.active {
    display: block;
}

.pagination-container {
    padding: 15px 20px;
    background: #f8f9ff;
    border-top: 1px solid #e0e0e0;
    display: none;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.pagination-container.active {
    display: flex;
}

.pagination-info {
    color: #666;
    font-size: 0.9em;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    padding: 8px 16px;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
    background: #2563EB;
    transform: translateY(-1px);
}

.page-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    color: #4A5568;
    font-weight: 600;
    padding: 0 10px;
}

.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
}

.stat-item {
    text-align: center;
}

.export-excel-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.export-excel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.export-excel-btn:active {
    transform: translateY(0);
}

.export-excel-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.export-excel-btn:disabled:hover {
    transform: none;
}

/* Tabs Container */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-header {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    padding-bottom: 0;
}

.tab {
    padding: 12px 20px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.tab:hover {
    background: #e0e7ff;
    color: #3b82f6;
}

.tab.active {
    background: white;
    color: #3b82f6;
    border-color: #3b82f6;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
}

.tab-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-close {
    margin-left: 8px;
    padding: 2px 6px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s ease;
}

.tab-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.tab-info {
    font-size: 0.85em;
    color: #94a3b8;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #3B82F6;
}

.stat-label {
    color: #666;
    margin-top: 2px;
    font-size: 0.9em;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2em;
}

.no-data svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.3;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5em;
    }

    .upload-section {
        padding: 20px;
    }

    .table-container {
        padding: 0 20px 20px 20px;
    }

    th, td {
        padding: 10px;
        font-size: 0.9em;
    }
}
