/* ══ SIDEBAR ══ */
.sidebar {
    width: 210px;
    background: #0C0C0C;
    color: white;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
}
.sidebar-logo {
    padding: 26px 22px 18px;
    border-bottom: 1px solid #1d1d1d;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .5px;
}
.sidebar-logo span { font-weight: 300; color: #6B7280; }
.sidebar-nav { padding: 14px 0; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 22px; color: white; cursor: pointer;
    background: rgba(40,167,69,.1);
    border-left: 3px solid #28A745;
    font-size: 14px; font-weight: 500;
    transition: all .2s;
}
.nav-item:hover { background: rgba(40,167,69,.15); }
.sidebar-user {
    padding: 18px 22px;
    border-top: 1px solid #1d1d1d;
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #28A745, #0a0a0a);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; color: white; }
.user-role  { font-size: 11px; color: #6B7280; }

/* ══ MAIN AREA ══ */
.main { flex: 1; margin-left: 210px; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; overflow-x: hidden; }

/* ══ HEADER — fondo blanco ══ */
.header {
    background: #ffffff;
    padding: 14px 28px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky; top: 0; z-index: 10;
    box-shadow: 0 1px 0 #E5E7EB, 0 2px 8px rgba(0,0,0,.06);
    border-bottom: 1px solid #F3F4F6;
}

/* Fila superior: título + acciones */
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.header-brand-title {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -.3px;
    line-height: 1;
}
.header-brand-sub {
    font-size: 11px;
    color: #9CA3AF;
    font-weight: 400;
    margin-top: 2px;
}

/* Fila de filtros pills */
.header-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}
.header-filters::-webkit-scrollbar { display: none; }

/* ── Pill base ── */
.hfilter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 12px;
    background: linear-gradient(145deg, #3ab55e 0%, #1a7a3c 55%, #0d4d23 100%);
    border: none;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: filter .18s, box-shadow .18s, transform .15s;
    box-shadow: 0 2px 6px rgba(13,77,35,.35), inset 0 1px 0 rgba(255,255,255,.15);
    line-height: 1.2;
}
.hfilter:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 12px rgba(13,77,35,.45), inset 0 1px 0 rgba(255,255,255,.15);
    transform: translateY(-1px);
}
/* Pill activo (tiene un valor seleccionado) */
.hfilter.active {
    background: linear-gradient(145deg, #2d9e50 0%, #145f2e 55%, #083318 100%);
    box-shadow: 0 0 0 2px #5de08a, 0 3px 10px rgba(13,77,35,.4), inset 0 1px 0 rgba(255,255,255,.12);
}

/* Icono dentro del pill */
.hfilter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: .85;
}

/* Texto doble dentro del pill */
.hfilter-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0px;
}
.hfilter-label {
    font-size: 9px;
    font-weight: 500;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1;
}
.hfilter-value {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}

/* Chevron a la derecha */
.hfilter-chev {
    margin-left: 2px;
    opacity: .7;
    flex-shrink: 0;
}

/* ── Dropdown panel ── */
.hfilter-dropdown {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.14);
    z-index: 9999;
    min-width: 220px;
    max-width: 320px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
    animation: ddFadeIn .15s ease;
}
@keyframes ddFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hfilter-search-wrap {
    padding: 8px 10px;
    border-bottom: 1px solid #F3F4F6;
    position: relative;
}
.hfilter-search {
    width: 100%;
    padding: 6px 8px 6px 28px;
    border: 1px solid #E5E7EB;
    border-radius: 7px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    color: #1F2937;
    transition: border-color .15s;
}
.hfilter-search:focus { border-color: #28A745; }
.hfilter-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.hfilter-opt-all {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #F9FAFB;
    transition: background .12s;
}
.hfilter-opt-all:hover { background: #F0FDF4; }
.hfilter-opts-list { max-height: 210px; overflow-y: auto; }
.hfilter-opt {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #F9FAFB;
    transition: background .12s;
    color: #1F2937;
}
.hfilter-opt:last-child { border-bottom: none; }
.hfilter-opt:hover  { background: #F0FDF4; }
.hfilter-opt.sel    { background: #F0FDF4; color: #28A745; font-weight: 700; }

/* Botón limpiar filtros */
.hfilter-clear {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid #FCA5A5;
    background: #FEF2F2;
    color: #DC2626;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.hfilter-clear:hover { background: #FEE2E2; border-color: #F87171; }

/* ══ CONTENT ══ */
.content { padding: 22px 28px; flex: 1; min-width: 0; overflow-x: hidden; }

/* Row grids */
.row-hero    { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; min-width: 0; }
.row-metrics { display: grid; grid-template-columns: 1fr 1fr minmax(180px, 240px); gap: 16px; margin-bottom: 18px; align-items: stretch; }

/* ══ TABLA PACING — scrollbar siempre visible ══ */
.table-card > div:has(table) { overflow-x: auto; }
.table-card > div:has(table)::-webkit-scrollbar { height: 8px; }
.table-card > div:has(table)::-webkit-scrollbar-track { background: #F3F4F6; border-radius: 0 0 16px 16px; }
.table-card > div:has(table)::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
.table-card > div:has(table)::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }