:root {
    --unad-blue: #004685;
    --unad-orange: #ff6b00;
    --unad-bg: #f8fafc;
    --success: #22c55e;
    --pending: #cbd5e1;
    --grad-blue: linear-gradient(135deg, #1e528e 0%, #3a7bd5 100%);
    --grad-green: linear-gradient(135deg, #2d9a56 0%, #42b983 100%);
    --grad-cyan: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    --grad-orange: linear-gradient(135deg, #f37335 0%, #fdc830 100%);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--unad-bg);
    margin: 0;
    color: var(--unad-blue);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.navbar-custom {
    height: 60px;
    display: flex;
    padding: 0;
    z-index: 1001;
    border-bottom: 1px solid #e2e8f0;
}

.nav-left-white {
    width: 320px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #e2e8f0;
    height: 100%;
    transition: all 0.3s ease;
}

.nav-left-white.collapsed { width: 70px; }

.nav-right-blue {
    flex: 1;
    background-color: var(--unad-blue);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    color: white;
}

.nav-separator {
    height: 5px;
    background: linear-gradient(90deg, var(--unad-orange) 0%, rgba(255, 107, 0, 0) 100%);
    width: 100%;
    z-index: 1000;
}

.main-wrapper { display: flex; flex: 1; position: relative; }

.sidebar {
    width: 320px;
    background: white;
    padding: 25px 20px;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    height: calc(100vh - 65px);
    position: sticky;
    top: 65px;
    transition: all 0.3s ease;
}

.sidebar.collapsed { width: 70px; padding: 25px 10px; }
.sidebar.collapsed .phase-info, .sidebar.collapsed p { display: none; }
.sidebar.collapsed .phase-step::before { left: 25px; }
.sidebar.collapsed .phase-icon-wrapper { margin: 0 auto; }

.toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.phase-step { 
    display: flex; 
    align-items: flex-start; 
    gap: 12px; 
    margin-bottom: 18px; 
    position: relative;
}

.phase-step::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 32px;
    width: 2px;
    height: calc(100% - 10px);
    background: var(--pending);
    z-index: 1;
}
.phase-step.done::before { background: var(--success); }
.phase-step:last-child::before { display: none; }

.phase-icon-wrapper {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0;
    flex-shrink: 0; z-index: 2; position: relative; font-size: 0.85rem;
}

.phase-step.done .phase-icon-wrapper { background: #dcfce7; color: var(--success); border-color: #bbf7d0; }
.phase-step.active .phase-icon-wrapper { 
    background: #fff7ed; color: var(--unad-orange); border-color: #ffedd5; 
    transform: scale(1.1); box-shadow: 0 4px 10px rgba(255,107,0,0.2); 
}

.phase-info h6 { font-size: 0.8rem; margin: 0; font-weight: 700; color: var(--unad-blue); }
.phase-info span { font-size: 0.7rem; color: #94a3b8; font-weight: 500; }

.content-area { flex: 1; padding: 30px 40px; transition: all 0.3s ease; }

.title-panel {
    background: white;
    padding: 20px 25px;
    border-radius: 15px;
    border-left: 5px solid var(--unad-orange);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.metric-card {
    border-radius: 14px;
    padding: 10px 15px;
    color: white;
    height: 85px; 
    display: flex;
    flex-direction: row; 
    align-items: center; 
    gap: 15px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card-icon { font-size: 1.5rem; opacity: 0.9; flex-shrink: 0; }
.card-content { display: flex; flex-direction: column; }
.card-blue { background: var(--grad-blue); }
.card-green { background: var(--grad-green); }
.card-cyan { background: var(--grad-cyan); }
.card-orange { background: var(--grad-orange); }

.card-label { font-size: 0.6rem; font-weight: 700; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 1rem; font-weight: 800; line-height: 1.1; margin-top: 2px; }
.card-subtext { font-size: 0.65rem; opacity: 0.85; font-weight: 500; }

.table-card {
    background: white; border-radius: 15px; border: 1px solid #e2e8f0; 
    overflow: hidden; margin-top: 30px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.table thead { background: #e9ecef; border-bottom: 2px solid #dee2e6; }
.table th { font-size: 0.7rem; color: var(--unad-blue); text-transform: uppercase; padding: 15px 20px; }
.table td { padding: 12px 20px; font-size: 0.85rem; vertical-align: middle; color: var(--unad-blue); }

.status-pill { padding: 4px 10px; border-radius: 30px; font-size: 0.68rem; font-weight: 700; }
.st-done { background: #dcfce7; color: #15803d; }
.st-active { background: #fff7ed; color: #c2410c; }
.st-pending { background: #f1f5f9; color: #64748b; }

.btn-action { background: var(--unad-blue); color: white; border: none; padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: 0.75rem; }
.btn-action.secondary { background: #fff; color: var(--unad-blue); border: 1px solid #d2deef; box-shadow: none; }

footer:not(.footer-consulta) {
    background: var(--unad-blue);
    border-top: 5px solid;
    border-image: linear-gradient(90deg, #1e528e, #2d9a56, #f37335, #00b4db) 1;
    padding: 25px 40px;
    font-size: 0.75rem;
    color: white;
    text-align: center;
    width: 100%;
}

/* Footer compartido con vista de votacion */
.footer-consulta {
    width: 100%;
    max-width: 100%;
    background-color: #093679;
    color: #ffffff;
    overflow-x: clip;
}

.footer-consulta-shell {
    width: min(1680px, 100%);
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-sizing: border-box;
}

.footer-consulta-izq,
.footer-consulta-der {
    min-width: 0;
}

.footer-consulta-titulo {
    display: inline-block;
    font-size: 1.03rem;
    line-height: 1.25;
}

.footer-consulta-fecha {
    font-size: 0.72rem;
    opacity: 0.85;
    white-space: nowrap;
}

.main-title { font-size: 1.5rem; font-weight: 800; color: var(--unad-blue); margin-bottom: 2px; }

@media (max-width: 991.98px) {
    .nav-left-white {
        width: 220px;
    }

    .nav-left-white.collapsed {
        width: 64px;
    }

    .nav-right-blue {
        padding: 0 14px;
    }

    .sidebar {
        width: 100%;
        max-width: 280px;
        position: fixed;
        left: 0;
        top: 65px;
        z-index: 1002;
        height: calc(100vh - 65px);
        box-shadow: 0 12px 28px rgba(2, 19, 58, 0.18);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 100%;
        max-width: 280px;
        padding: 25px 20px;
    }

    .sidebar.collapsed .phase-info,
    .sidebar.collapsed p {
        display: block;
    }

    .sidebar.collapsed .phase-step::before {
        left: 17px;
    }

    .sidebar.collapsed .phase-icon-wrapper {
        margin: 0;
    }

    .content-area {
        width: 100%;
        padding: 20px 16px;
    }

    .phase-table-card {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .phase-table {
        display: block;
        width: 100%;
        max-width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .phase-table thead {
        display: none;
    }

    .phase-table tbody {
        display: block;
        width: 100%;
    }

    .phase-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        width: 100%;
        margin-bottom: 12px;
        padding: 14px;
        background: #ffffff;
        border: 1px solid #dbe4ef;
        border-left: 4px solid var(--unad-orange);
        border-radius: 12px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
        box-sizing: border-box;
    }

    .phase-table tr.table-active {
        background: #fffaf5;
        border-color: #fed7aa;
        border-left-color: var(--unad-orange);
    }

    .phase-table td {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
        width: 100%;
        max-width: 100%;
        padding: 0;
        border: 0;
        box-sizing: border-box;
        font-size: 0.82rem;
        line-height: 1.35;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        text-align: left !important;
        color: var(--unad-blue);
    }

    .phase-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 700;
        font-size: 0.66rem;
        line-height: 1.2;
        text-transform: uppercase;
        color: #64748b;
        letter-spacing: 0.02em;
        margin: 0;
    }

    .phase-table td[data-label="Accion"] {
        padding-top: 4px;
    }

    .phase-table td[data-label="Accion"]::before {
        display: none;
    }

    .phase-table td .btn-action {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        min-height: 40px;
        justify-content: center;
        border-radius: 10px;
        font-size: 0.8rem;
    }

    .phase-table td[colspan] {
        display: block;
        padding: 18px 10px;
        text-align: center !important;
    }
}
