:root {
    --apr-ink: #183b56;
    --apr-muted: #627d98;
    --apr-line: #d9e2ec;
    --apr-wash: #f4f7f9;
    --apr-accent: #e66a3c;
}

body {
    background: var(--apr-wash);
    color: var(--apr-ink);
}

:root {
    --apr-sidebar-width: 250px;
}

.acting-comite-form {
    margin: 0;
}

.acting-comite-form select {
    height: auto;
    margin: 0;
    padding: .3rem .6rem;
}

/* Layout shell: sidebar + top bar + content */

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

.sidebar {
    background: var(--apr-ink);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: var(--apr-sidebar-width);
}

.sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    padding: 1.5rem 1.5rem 1.25rem;
}

.sidebar-brand a {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
}

.sidebar-brand a span {
    color: var(--apr-accent);
}

.sidebar-brand-subtitle {
    color: rgba(255, 255, 255, .6);
    display: block;
    font-size: .75rem;
    margin-top: .3rem;
}

.sidebar-section-label {
    color: rgba(255, 255, 255, .5);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 1.25rem 1.5rem .5rem;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: 0 .75rem;
}

.sidebar-link {
    border-left: 3px solid transparent;
    border-radius: 4px;
    color: rgba(255, 255, 255, .8);
    display: block;
    padding: .65rem .75rem;
    text-decoration: none;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar-link-active {
    background: rgba(230, 106, 60, .16);
    border-left-color: var(--apr-accent);
    color: #fff;
    font-weight: 700;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .12);
    margin-top: auto;
    padding: 1.25rem 1.5rem;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    margin-bottom: .75rem;
}

.sidebar-user strong {
    font-size: .95rem;
}

.sidebar-user span {
    color: rgba(255, 255, 255, .6);
    font-size: .8rem;
}

.sidebar-logout {
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
    text-decoration: none;
}

.sidebar-logout:hover {
    color: #fff;
    text-decoration: underline;
}

.sidebar-overlay {
    background: rgba(15, 26, 40, .5);
    display: none;
    inset: 0;
    position: fixed;
    z-index: 20;
}

.app-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--apr-line);
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.app-topbar-title {
    flex: 1;
    font-size: 1.15rem;
    margin: 0;
}

.app-topbar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-end;
}

.app-topbar-date,
.topbar-comite-nombre {
    color: var(--apr-muted);
    font-size: .85rem;
    white-space: nowrap;
}

.app-content {
    flex: 1;
    padding: 1.5rem 0;
}

.app-content .container {
    max-width: none;
}

.sidebar-toggle {
    background: none;
    border: 0;
    cursor: pointer;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: .4rem;
}

.sidebar-toggle span {
    background: var(--apr-ink);
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 20px;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }

    .sidebar {
        bottom: 0;
        left: 0;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        z-index: 30;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.sidebar-open .sidebar-overlay {
        display: block;
    }

    .app-topbar-title {
        font-size: 1rem;
    }
}

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

.dashboard-card {
    background: #fff;
    border: 1px solid var(--apr-line);
    border-top: 4px solid var(--apr-accent);
    padding: 1.25rem 1.5rem 1.5rem;
    text-align: center;
}

.card-gauge {
    display: flex;
    justify-content: center;
    margin: .3rem auto;
}

.link-button {
    background: none;
    border: 0;
    color: var(--apr-accent);
    cursor: pointer;
    font-size: 1em;
    padding: 0;
}

.dashboard-top-row {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(280px, 400px) 1fr;
    margin-bottom: 1.5rem;
}

.dashboard-top-row > .empty-state {
    margin: 0;
}

.gauge-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--apr-line);
    border-top: 4px solid var(--apr-accent);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    min-width: 0;
    padding: 1rem 1.5rem;
}

.consumo-card {
    background: #fff;
    border: 1px solid var(--apr-line);
    border-top: 4px solid var(--apr-accent);
    min-width: 0;
    padding: 1.25rem 1.5rem 1.5rem;
}

@media (max-width: 900px) {
    .dashboard-top-row {
        grid-template-columns: 1fr;
    }
}

.consumo-card .dashboard-card-label {
    display: block;
    margin-bottom: .5rem;
}

#consumo-chart {
    margin: 0 -0.5rem;
}

.gauge-info {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.gauge-pct {
    font-size: 1.6rem;
}

.gauge-nivel {
    font-weight: 700;
}

.gauge-nivel-good { color: #0ca30c; }
.gauge-nivel-warning { color: #a17400; }
.gauge-nivel-critical { color: #d03b3b; }

.gauge-detail {
    color: var(--apr-muted);
}

.drilldown-panel {
    margin-top: 1rem;
}

.dashboard-card-label,
.dashboard-card a {
    display: block;
}

.dashboard-card-label {
    color: var(--apr-muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.dashboard-card a,
.filter-list a {
    color: var(--apr-accent);
}

.page-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.search-form {
    align-items: flex-end;
    display: flex;
    gap: .75rem;
    margin-bottom: 1.5rem;
    max-width: 480px;
}

.search-form label {
    margin-bottom: 0;
    white-space: nowrap;
}

.search-form > div {
    flex: 1;
    margin-bottom: 0;
}

.search-form input[type="search"] {
    margin-bottom: 0;
}

.filter-list {
    border-bottom: 1px solid var(--apr-line);
    display: flex;
    flex-wrap: wrap;
    gap: .8rem 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.filter-active {
    font-weight: 700;
    text-decoration: underline;
}

.table-wrap {
    background: #fff;
    border: 1px solid var(--apr-line);
    overflow-x: auto;
    padding: 0 1.5rem;
}

.status {
    color: var(--apr-muted);
    font-size: .9em;
    font-weight: 700;
}

.status-ok {
    color: #227c4d;
}

.status-sospechoso,
.status-foto_erronea {
    color: #b54708;
}

.empty-state {
    background: #fff;
    border: 1px dashed var(--apr-line);
    color: var(--apr-muted);
    padding: 2rem;
}

fieldset {
    border-top: 1px solid var(--apr-line);
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
}

.help-text {
    color: var(--apr-muted);
    font-size: .85rem;
    margin-top: -.5rem;
}

.login-body {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.login-main {
    padding: 1.5rem;
    width: 100%;
}

.login-card {
    background: #fff;
    border: 1px solid var(--apr-line);
    border-top: 4px solid var(--apr-accent);
    margin: 0 auto;
    max-width: 380px;
    padding: 2.5rem 2rem;
}

.login-brand {
    color: var(--apr-ink);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: .5rem;
    text-align: center;
}

.login-brand span {
    color: var(--apr-accent);
}

.login-subtitle {
    color: var(--apr-muted);
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (max-width: 600px) {
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}