:root {
    --sidebar-width: 250px;
    --primary-dark: #1e3a5f;
    --primary: #2c5282;
    --primary-light: #4a7ba8;
    --bg-light: #f5f7fa;
    --text-dark: #2d3748;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-size: 14px;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: white;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

    .sidebar-brand h5 {
        color: white;
    }

    .sidebar-brand small {
        color: rgba(255,255,255,0.6);
    }

.sidebar-nav {
    padding: 10px 0;
    flex-grow: 1;
    overflow-y: auto;
}

    .sidebar-nav .nav-section {
        padding: 15px 20px 5px;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: rgba(255,255,255,0.5);
        font-weight: 600;
    }

    .sidebar-nav .nav-link {
        color: rgba(255,255,255,0.8);
        padding: 10px 20px;
        border-left: 3px solid transparent;
        transition: all 0.15s;
    }

        .sidebar-nav .nav-link:hover {
            background: rgba(255,255,255,0.05);
            color: white;
            border-left-color: var(--primary-light);
        }

        .sidebar-nav .nav-link i {
            margin-right: 8px;
            width: 20px;
            display: inline-block;
        }

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .user-info i {
        font-size: 28px;
        color: rgba(255,255,255,0.8);
    }

    .user-info .fw-bold {
        font-size: 13px;
        color: white;
    }

    .user-info small {
        font-size: 11px;
        color: rgba(255,255,255,0.6);
    }

.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
}

.login-body {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

    .login-card h2 {
        color: var(--primary-dark);
    }

.card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.kpi-card {
    background: white;
    border-radius: 6px;
    padding: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

    .kpi-card .kpi-value {
        font-size: 28px;
        font-weight: 700;
        color: var(--primary-dark);
        line-height: 1;
    }

    .kpi-card .kpi-label {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #718096;
        margin-top: 5px;
    }

    .kpi-card.success {
        border-left-color: #38a169;
    }

    .kpi-card.warning {
        border-left-color: #ed8936;
    }

    .kpi-card.info {
        border-left-color: #3182ce;
    }

    .kpi-card.danger {
        border-left-color: #e53e3e;
    }

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

    .btn-primary:hover {
        background-color: var(--primary-dark);
        border-color: var(--primary-dark);
    }

.table {
    background: white;
    margin-bottom: 0;
}

    .table thead th {
        background: #f8fafc;
        border-bottom: 2px solid var(--border-color);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #4a5568;
        font-weight: 600;
    }

    .table tbody tr:hover {
        background: #f8fafc;
    }

.badge-estado {
    font-size: 11px;
    padding: 4px 10px;
    font-weight: 500;
}

.page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

    .page-header h1 {
        font-size: 24px;
        font-weight: 600;
        color: var(--primary-dark);
        margin: 0;
    }

    .page-header .subtitle {
        color: #718096;
        font-size: 14px;
        margin-top: 4px;
    }

.badge-bloqueada {
    background: #dc2626 !important;
    color: white;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.linea-manual {
    background-color: #fef3c7 !important;
}

    .linea-manual:hover {
        background-color: #fde68a !important;
    }

.progress-avance {
    height: 20px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

    .progress-avance .progress-bar {
        background: linear-gradient(90deg, #38a169, #2f855a);
        transition: width 0.3s;
    }

    .progress-avance .progress-label {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        text-align: center;
        line-height: 20px;
        font-size: 11px;
        font-weight: 600;
        color: white;
        text-shadow: 0 0 2px rgba(0,0,0,0.3);
    }

/* ============================================
   LOADING OVERLAY - agregado en v3
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 58, 95, 0.6);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

    .loading-overlay.active {
        display: flex;
        animation: fadeIn 0.15s ease-out;
    }

.loading-content {
    background: white;
    padding: 32px 56px;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
    max-width: 90vw;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-right-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 18px;
}

.loading-text {
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.loading-subtext {
    color: #718096;
    font-size: 12px;
    min-height: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
