:root {
    /* e-ABC Corporate Colors */
    --color-green: #A5C23F;
    --color-blue: #1DA2DC;
    --color-orange: #FFA000;
    
    /* Default (Light Theme Fallback) */
    --bg-color: #f4f6f8;
    --text-color: #353535;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e2e8f0;
        --card-bg: #262626;
        --card-border: #404040;
        --input-bg: #333333;
        --input-border: #404040;
    }
}

body.light-theme {
    --bg-color: #f4f6f8;
    --text-color: #353535;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
}

body.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #e2e8f0;
    --card-bg: #262626;
    --card-border: #404040;
    --input-bg: #333333;
    --input-border: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 2rem;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
}

/* e-ABC CSS Logo */
.brand-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.brand-top {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    letter-spacing: -1px;
}

.brand-e {
    color: var(--text-color);
}

.brand-abc {
    color: var(--color-green);
}

.brand-bottom {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--text-color);
    text-transform: uppercase;
    font-family: 'Poppins', sans-serif;
    margin-top: 0.1rem;
}

h1 {
    color: var(--text-color);
}

.btn-theme {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.btn-theme:hover {
    background-color: var(--card-border);
}

.filters {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

select, input[type="text"] {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    transition: all 0.2s;
}

select {
    padding-right: 2.5rem;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
}

select:hover, select:focus, input[type="text"]:hover, input[type="text"]:focus {
    border-color: var(--color-green);
    background-color: #404040;
}

input[type="text"]::placeholder {
    color: #64748b;
}

.btn-primary {
    background-color: var(--color-blue);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background-color: #1585b5;
}

.glass {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card h3 {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
}

#kpi-active { color: var(--color-green); }
#kpi-completed { color: var(--color-blue); }
#kpi-risk { color: var(--color-orange); }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container h2, .table-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.canvas-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--card-border);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

th:hover {
    color: white;
}

th span {
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
}

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

.status-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-terminado { background: rgba(53, 53, 53, 0.4); color: #cbd5e1; border: 1px solid var(--card-border); } 
.status-activo { background: rgba(165, 194, 63, 0.15); color: var(--color-green); border: 1px solid rgba(165, 194, 63, 0.3); } 
.status-noiniciado { background: rgba(29, 162, 220, 0.15); color: var(--color-blue); border: 1px solid rgba(29, 162, 220, 0.3); }

/* Responsive adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    .filters {
        width: 100%;
        flex-wrap: wrap;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
