:root {
    --sidebar-bg: #1C2B3A;
    --sidebar-width: 240px;
    --accent: #2ECC71;
    --danger: #E74C3C;
    --body-bg: #F8F9FA;
    --topbar-h: 56px;
}

body {
    background-color: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: #fff;
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem 1rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: background .2s, color .2s;
    font-size: .92rem;
}

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

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255,255,255,0.8);
    font-size: .85rem;
    margin-bottom: .5rem;
}

.sidebar-username {
    font-weight: 600;
    color: #fff;
    font-size: .88rem;
}

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-wrapper {
    padding: 1.5rem;
}

/* ── KPI cards ── */
.kpi-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    height: 100%;
}

.kpi-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
    margin-bottom: .35rem;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1C2B3A;
    line-height: 1.1;
}

.kpi-icon {
    font-size: 2rem;
    opacity: .15;
}

/* ── Botones con color propio (evita flash de hover de Bootstrap) ── */
.btn-gerp {
    background-color: #2ECC71;
    border-color: #2ECC71;
    color: #fff;
}
.btn-gerp:hover, .btn-gerp:focus, .btn-gerp:active,
.btn-gerp:focus-visible, .btn-gerp.active {
    background-color: #27ae60;
    border-color: #27ae60;
    color: #fff;
    box-shadow: none;
}

.btn-entrega {
    background-color: #1ABC9C;
    border-color: #1ABC9C;
    color: #fff;
}
.btn-entrega:hover, .btn-entrega:focus, .btn-entrega:active,
.btn-entrega:focus-visible, .btn-entrega.active {
    background-color: #17a589;
    border-color: #17a589;
    color: #fff;
    box-shadow: none;
}

.btn-coord {
    background-color: #8E44AD;
    border-color: #8E44AD;
    color: #fff;
}
.btn-coord:hover, .btn-coord:focus, .btn-coord:active,
.btn-coord:focus-visible, .btn-coord.active {
    background-color: #76359b;
    border-color: #76359b;
    color: #fff;
    box-shadow: none;
}

/* Variantes outline (borde visible, relleno en hover) */
.btn-outline-gerp {
    background: transparent;
    border: 1px solid #2ECC71;
    color: #27ae60;
}
.btn-outline-gerp:hover, .btn-outline-gerp:focus, .btn-outline-gerp:active {
    background-color: #2ECC71;
    border-color: #2ECC71;
    color: #fff;
    box-shadow: none;
}
.btn-outline-entrega {
    background: transparent;
    border: 1px solid #1ABC9C;
    color: #17a589;
}
.btn-outline-entrega:hover, .btn-outline-entrega:focus, .btn-outline-entrega:active {
    background-color: #1ABC9C;
    border-color: #1ABC9C;
    color: #fff;
    box-shadow: none;
}

/* ── Accent color helper ── */
.bg-gerp-accent { background-color: var(--accent) !important; }
.text-gerp-accent { color: var(--accent) !important; }
.bg-gerp-dark { background-color: var(--sidebar-bg) !important; }

/* ── Chart containers ── */
.chart-card {
    background: #fff;
    border-radius: .75rem;
    border: 1px solid #e9ecef;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* ── Badges for order states ── */
.badge-borrador  { background-color: #6c757d; }
.badge-enviada   { background-color: #f0ad00; color: #000; }
.badge-revisada  { background-color: #3498DB; }
.badge-aprobada  { background-color: #2ECC71; }
.badge-firmada   { background-color: #8E44AD; }
.badge-entregada { background-color: #1ABC9C; }
.badge-cancelada { background-color: #E74C3C; }

/* ── Detail sidebar: sticky + scroll propio ── */
.detail-sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + .75rem);
    max-height: calc(100vh - var(--topbar-h) - 1.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px; /* evita que el scrollbar se corte */
}
.detail-sidebar .kpi-card {
    height: auto; /* anula el height:100% del kpi-card base */
}
.detail-sidebar::-webkit-scrollbar { width: 4px; }
.detail-sidebar::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 4px; }

/* ── Timeline ── */
.timeline { display:flex; flex-direction:column; gap:.75rem; }
.tl-item  { display:flex; align-items:flex-start; gap:.6rem; font-size:.83rem; }
.tl-item i { margin-top:2px; flex-shrink:0; font-size:.75rem; }
.tl-item.done i { color:#2ECC71; }
.tl-item:not(.done) i { color:#dee2e6; }

/* ── Tables ── */
.table-card {
    background: #fff;
    border-radius: .75rem;
    border: 1px solid #e9ecef;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.table-card .table {
    margin-bottom: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* ── Login page ── */
.login-card {
    max-width: 420px;
    margin: 6rem auto;
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--sidebar-bg);
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}
