/* ============================================================
   Monitor de Gestión - Municipalidad de Plottier
   Hoja de estilos principal. Paleta institucional (paleta.jpg).
   Mobile-first, sin frameworks.
   ============================================================ */

:root {
    /* Paleta institucional */
    --teal:        #056D84;
    --teal-dark:   #044f60;
    --naranja:     #F39302;
    --magenta:     #DB2A54;
    --crema:       #F1ECE2;
    --oscuro:      #0D212F;

    /* Derivados de uso */
    --bg:          #f5f3ee;
    --card:        #ffffff;
    --texto:       #0D212F;
    --texto-suave: #5b6b76;
    --borde:       #e3ddd1;
    --sombra:      0 2px 10px rgba(13, 33, 47, 0.08);
    --sombra-fuerte: 0 8px 30px rgba(13, 33, 47, 0.18);
    --radio:       14px;

    /* Semáforo de estados (RULES §6) */
    --estado-pendiente: var(--teal);
    --estado-en_curso:  var(--naranja);
    --estado-cumplida:  #2e9e6b;
    --estado-vencida:   var(--magenta);

    --sidebar-w: 256px;
    --sidebar-collapsed: 76px;
}

/* Programas: filtros y lectura mobile */
.programas-filtros {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(200px, 1fr) minmax(160px, .7fr) auto;
    gap: 12px;
    align-items: end;
    margin: 14px 0 18px;
}
.programas-filtros__acciones {
    display: flex;
    gap: 8px;
    align-items: center;
}
.programas-mobile-list {
    display: none;
}
.programas-mobile-card {
    border: 1px solid var(--borde);
    border-left: 6px solid var(--teal);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    box-shadow: var(--sombra);
}
.programas-mobile-card strong {
    display: block;
    font-size: 1.05rem;
    color: var(--oscuro);
}
.programas-mobile-card small {
    display: block;
    margin-top: 4px;
    color: var(--texto-suave);
    font-weight: 700;
}
.programas-mobile-card p {
    margin: 10px 0 0;
    color: var(--texto-suave);
}
.programas-mobile-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .bottom-nav { display: none !important; }
    .bottom-more { display: none !important; }
    .bottom-nav-v2 {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 95;
        min-height: 76px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: 1fr 1fr 76px 1fr 1fr;
        align-items: end;
        gap: 4px;
        background: #fff;
        border-top: 1px solid var(--borde);
        box-shadow: 0 -8px 26px rgba(13, 33, 47, .12);
    }
    .bottom-nav-v2__item {
        min-width: 0;
        min-height: 58px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        color: #58665f;
        font-size: .76rem;
        font-weight: 900;
        text-align: center;
        text-decoration: none;
    }
    .bottom-nav-v2__item i { font-size: 1.25rem; }
    .bottom-nav-v2__item span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .bottom-nav-v2__item.is-active {
        color: var(--teal-dark);
    }
    .bottom-nav-v2__center {
        width: 72px;
        height: 72px;
        align-self: center;
        justify-self: center;
        margin-top: -34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--teal);
        color: #fff;
        border: 6px solid #fff;
        box-shadow: 0 8px 22px rgba(5, 109, 132, .32);
        font-size: 1.75rem;
        text-decoration: none;
    }
    .bottom-nav-v2__center.is-active,
    .bottom-nav-v2__center:hover {
        background: var(--teal-dark);
        color: #fff;
        text-decoration: none;
    }
    .programas-filtros {
        grid-template-columns: 1fr;
    }
    .programas-filtros__acciones {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .programas-filtros__acciones .btn {
        justify-content: center;
    }
    .programas-listado .tabla-scroll {
        display: none;
    }
    .programas-mobile-list {
        display: grid;
        gap: 12px;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', system-ui, sans-serif;
    background: var(--bg);
    color: var(--texto);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Badges de rol (compartidos) */
.rol--admin { background: var(--magenta) !important; }
.rol--editor { background: var(--naranja) !important; }

/* Chip genérico (pill) para roles/etiquetas fuera del sidebar */
.chip {
    display: inline-block; font-size: .68rem; text-transform: uppercase;
    letter-spacing: .5px; font-weight: 800; color: #fff;
    padding: 3px 10px; border-radius: 20px; background: var(--teal);
}
.chip.rol--visualizacion { background: var(--teal); }

/* ----------------------------- Sidebar (estilo RRHH) ----------------------------- */
/* Botón flotante para abrir el menú en mobile (no hay topbar). */
.nav-fab {
    position: fixed; top: 14px; left: 14px; z-index: 70;
    width: 44px; height: 44px; border: 0; border-radius: 12px;
    background: var(--teal); color: #fff; font-size: 1.15rem; cursor: pointer;
    box-shadow: var(--sombra-fuerte); display: none;
}

.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w);
    background: var(--oscuro); color: #fff;
    display: flex; flex-direction: column;
    z-index: 60; overflow: hidden;
    transition: width .2s ease, transform .25s ease;
}

/* Header: logo + colapsar */
.sidebar__header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.sidebar__logo img { width: 40px; height: 40px; object-fit: cover; display: block; }
.sidebar__brandtext { font-weight: 800; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__collapse {
    margin-left: 4px; background: transparent; border: 0; color: #8fa0ab;
    cursor: pointer; font-size: 1.1rem; padding: 6px; border-radius: 8px; flex: 0 0 auto;
}
.sidebar__collapse:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Campana de notificaciones */
.sidebar__bell { position: relative; margin-left: auto; background: transparent; border: 0; color: #cfd8de; cursor: pointer; font-size: 1.1rem; padding: 6px; border-radius: 8px; flex: 0 0 auto; }
.sidebar__bell:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__bell-badge {
    position: absolute; top: -1px; right: -1px; background: var(--magenta); color: #fff;
    font-size: .62rem; font-weight: 800; min-width: 17px; height: 17px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--oscuro);
}
.nav-collapsed .sidebar__bell { display: none; }

.notif-panel {
    position: fixed; top: 64px; left: 14px; width: 340px; max-width: calc(100vw - 28px);
    background: #fff; border: 1px solid var(--borde); border-radius: 14px;
    box-shadow: var(--sombra-fuerte); z-index: 80; overflow: hidden;
    display: flex; flex-direction: column; max-height: 76vh;
}
.notif-panel[hidden] { display: none; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--borde); color: var(--oscuro); }
.notif-panel__head strong { font-size: .95rem; }
.notif-panel__head i { color: var(--teal); margin-right: 6px; }
.notif-panel__close { background: transparent; border: 0; color: var(--texto-suave); cursor: pointer; font-size: 1rem; padding: 4px; }
.notif-panel__body { overflow-y: auto; padding: 6px; }
.notif-resumen { padding: 8px 10px; font-size: .8rem; font-weight: 700; }
.notif-resumen span { padding: 2px 8px; border-radius: 20px; color: #fff; }
.notif-item {
    display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 10px;
    color: var(--texto); border: 1px solid transparent;
}
.notif-item:hover { background: var(--crema); text-decoration: none; }
.notif-item__ico { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; }
.notif-item--vencida .notif-item__ico { background: var(--magenta); }
.notif-item--proxima .notif-item__ico { background: var(--naranja); }
.notif-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-item__body strong { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item__body small { color: var(--texto-suave); font-size: .76rem; }
.notif-item__tag { font-size: .65rem; font-weight: 800; text-transform: uppercase; color: var(--texto-suave); }
.notif-empty { text-align: center; color: var(--texto-suave); padding: 26px 16px; font-size: .88rem; }
.notif-empty i { color: var(--estado-cumplida); font-size: 1.6rem; display: block; margin-bottom: 8px; }
.notif-panel__foot { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--borde); font-weight: 700; font-size: .85rem; }

/* Buscador */
.sidebar__search { position: relative; padding: 12px 14px; }
.sidebar__search i { position: absolute; left: 26px; top: 50%; transform: translateY(-50%); color: #8fa0ab; font-size: .85rem; pointer-events: none; }
.sidebar__search input {
    width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06);
    color: #fff; font-family: inherit; font-size: .85rem;
}
.sidebar__search input::placeholder { color: #7c8b96; }
.sidebar__search input:focus { outline: none; border-color: var(--teal); background: rgba(255,255,255,.1); box-shadow: none; }

/* Tarjeta de usuario */
.sb-user {
    display: flex; align-items: center; gap: 10px;
    margin: 4px 12px 8px; padding: 10px; border-radius: 12px;
    background: rgba(255,255,255,.05);
}
.sb-user__link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; }
.sb-user__link:hover { text-decoration: none; opacity: .9; }
.sb-user__avatar {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
    background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.sb-user__meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sb-user__meta strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user__rol {
    align-self: flex-start; font-size: .65rem; text-transform: uppercase; letter-spacing: .5px;
    padding: 2px 8px; border-radius: 20px; font-weight: 800; background: rgba(255,255,255,.18); color: #fff;
}
.sb-user__logout { color: #8fa0ab; font-size: 1.05rem; padding: 6px; flex: 0 0 auto; }
.sb-user__logout:hover { color: var(--magenta); text-decoration: none; }

/* Navegación con secciones */
.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.sidebar__section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .8px;
    color: #6f7e89; font-weight: 800; padding: 14px 12px 6px; white-space: nowrap;
}
.sidebar__link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; margin-bottom: 3px;
    color: #cfd8de; border-radius: 10px;
    font-weight: 600; transition: background .15s, color .15s; white-space: nowrap;
}
.sidebar__link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar__link.is-active { background: var(--teal); color: #fff; }
.sidebar__link i { width: 22px; text-align: center; flex: 0 0 22px; font-size: 1rem; }
.sidebar__noresults { color: #6f7e89; font-size: .8rem; padding: 10px 12px; }

.sidebar__footer {
    padding: 12px 16px; font-size: .72rem; color: #6f7e89;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; flex-direction: column; gap: 2px; white-space: nowrap;
}

.sidebar__backdrop { position: fixed; inset: 0; background: rgba(13,33,47,.5); z-index: 55; display: none; }

.bottom-nav,
.bottom-more,
.bottom-nav-v2 { display: none; }

/* Estado colapsado: rail de íconos (escritorio) */
.nav-collapsed .sidebar { width: var(--sidebar-collapsed); }
.nav-collapsed .sidebar__brandtext,
.nav-collapsed .sidebar__search,
.nav-collapsed .sb-user__meta,
.nav-collapsed .sb-user__logout,
.nav-collapsed .sidebar__section,
.nav-collapsed .sidebar__link span,
.nav-collapsed .sidebar__footer { display: none; }
.nav-collapsed .sidebar__header { justify-content: center; padding: 16px 0; }
.nav-collapsed .sidebar__collapse { margin-left: 0; }
.nav-collapsed .sidebar__collapse i { transform: rotate(180deg); }
.nav-collapsed .sb-user { justify-content: center; padding: 10px 0; background: transparent; }
.nav-collapsed .sidebar__link { justify-content: center; padding: 11px 0; }
.nav-collapsed .sidebar__link i { width: auto; }
.nav-collapsed .content { margin-left: var(--sidebar-collapsed); }

/* ----------------------------- Content ----------------------------- */
.content {
    margin-left: var(--sidebar-w);
    padding: 24px;
    min-height: 100vh;
    transition: margin-left .2s ease;
}
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.5rem; color: var(--oscuro); }
.page-head p { margin: 0; color: var(--texto-suave); }

/* ----------------------------- Botones ----------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--teal); color: #fff; border: 0;
    padding: 10px 16px; border-radius: 10px;
    font-family: inherit; font-weight: 700; font-size: .9rem;
    cursor: pointer; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--teal-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--naranja { background: var(--naranja); }
.btn--naranja:hover { background: #d97f02; }
.btn--teal { background: var(--teal); }
.btn--teal:hover { background: var(--teal-dark); }
.btn--magenta { background: var(--magenta); }
.btn--magenta:hover { background: #be1f45; }
.btn--ghost { background: transparent; color: var(--teal); border: 1px solid var(--borde); }
.btn--ghost:hover { background: var(--crema); color: var(--teal-dark); }
.btn--sm { padding: 6px 10px; font-size: .8rem; }

/* ----------------------------- Tarjetas ----------------------------- */
.card {
    background: var(--card); border: 1px solid var(--borde);
    border-radius: var(--radio); box-shadow: var(--sombra);
    padding: 18px;
}

/* ----------------------- Organigrama (Vista A) ---------------------- */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 2px dashed var(--borde); }
.tree__node { margin: 6px 0; }
.tree__row {
    display: flex; align-items: center; gap: 10px;
    background: var(--card); border: 1px solid var(--borde);
    border-radius: 10px; padding: 10px 12px;
    box-shadow: var(--sombra); cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.tree__row:hover { border-color: var(--teal); }
.tree__row.has-no-children { cursor: default; }
.tree__caret {
    width: 22px; height: 22px; flex: 0 0 22px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--teal); transition: transform .2s;
}
.tree__node.is-open > .tree__row > .tree__caret { transform: rotate(90deg); }
.tree__node.has-no-children > .tree__row > .tree__caret { visibility: hidden; }
.tree__name { font-weight: 700; color: var(--oscuro); }
.tree__badge {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .4px;
    background: var(--crema); color: var(--teal-dark);
    padding: 2px 8px; border-radius: 20px; font-weight: 700; white-space: nowrap;
}

/* Colores por tipo de nodo (replica el esquema del organigrama en PDF).
   Azul=Secretaría/Intendencia · Verde=Subsecretaría/Gerencia · Amarillo=Coordinación
   · Violeta=Dirección/Departamento · Gris=Área */
.tipo--intendencia,
.tipo--secretaria       { border-left: 5px solid #5b8fd0; }
.tipo--subsecretaria,
.tipo--gerencia         { border-left: 5px solid #8bbf6a; }
.tipo--coordinacion     { border-left: 5px solid #e6b800; }
.tipo--direccion,
.tipo--direccion_general,
.tipo--departamento     { border-left: 5px solid #b47fd0; }
.tipo--area,
.tipo--programa         { border-left: 5px solid #b8b8b8; }

.tipo--intendencia .tree__badge,
.tipo--secretaria .tree__badge       { background: #dbe8f7; color: #274b78; }
.tipo--subsecretaria .tree__badge,
.tipo--gerencia .tree__badge         { background: #dcefce; color: #38622a; }
.tipo--coordinacion .tree__badge     { background: #fbedb6; color: #7a5c00; }
.tipo--direccion .tree__badge,
.tipo--direccion_general .tree__badge,
.tipo--departamento .tree__badge     { background: #ecdcf6; color: #533072; }
.tipo--area .tree__badge,
.tipo--programa .tree__badge         { background: #e9e9e9; color: #4a4a4a; }

/* Leyenda de colores del organigrama */
.org-leyenda { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 16px; padding: 4px 2px; }
.org-leyenda__item { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 700; color: var(--texto-suave); }
.org-leyenda__punto { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.tree__count {
    margin-left: auto; font-size: .78rem; font-weight: 700;
    background: var(--teal); color: #fff;
    min-width: 22px; text-align: center;
    padding: 2px 8px; border-radius: 20px;
}
.tree__count.is-zero { background: var(--borde); color: var(--texto-suave); }
.tree__children { display: none; }
.tree__node.is-open > .tree__children { display: block; }

/* Objetivo / funciones del área (cuando está activado en Configuración) */
.tree__objetivo {
    margin: 6px 0 6px 22px; padding: 8px 12px;
    background: var(--crema); border-radius: 8px;
    color: var(--teal-dark); font-size: .86rem; font-weight: 600;
    border-left: 3px solid var(--naranja);
}
.tree__objetivo i { margin-right: 6px; color: var(--naranja); }

/* Acciones dentro de un nodo */
.acciones { padding-left: 22px; margin: 6px 0; }
.accion {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--borde);
    border-left: 4px solid var(--teal);
    border-radius: 8px; padding: 8px 12px; margin: 5px 0;
    font-size: .9rem;
}
.accion--pendiente { border-left-color: var(--estado-pendiente); }
.accion--en_curso  { border-left-color: var(--estado-en_curso); }
.accion--cumplida  { border-left-color: var(--estado-cumplida); }
.accion--vencida   { border-left-color: var(--estado-vencida); }
.accion__titulo { font-weight: 700; }
.accion__desc { color: var(--texto-suave); }
.accion__fecha { margin-left: auto; font-weight: 700; color: var(--oscuro); white-space: nowrap; }
.accion__estado {
    font-size: .68rem; text-transform: uppercase; font-weight: 700;
    padding: 2px 8px; border-radius: 20px; color: #fff;
}
.estado--pendiente { background: var(--estado-pendiente); }
.estado--en_curso  { background: var(--estado-en_curso); }
.estado--cumplida  { background: var(--estado-cumplida); }
.estado--vencida   { background: var(--estado-vencida); }
.programa-estado--pendiente { background: var(--teal); }
.programa-estado--en_curso { background: var(--naranja); }
.programa-estado--demorado { background: var(--magenta); }
.programa-estado--cumplido { background: var(--estado-cumplida); }

/* ----------------------- Feed cronológico (Vista B) ----------------- */
.feed-filtros {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
    margin-bottom: 18px;
}
.feed-filtros__campo { display: flex; flex-direction: column; gap: 6px; }
.feed-filtros__campo .lbl { font-weight: 700; font-size: .78rem; color: var(--oscuro); display: flex; align-items: center; gap: 6px; }
.feed-filtros__campo > select, .feed-filtros__campo input[type=month] { min-width: 190px; }
.feed-filtros__campo--ancho { flex: 1; min-width: 240px; }
.feed-filtros__acciones { display: flex; gap: 8px; }
@media (max-width: 680px) {
    .feed-filtros__campo, .feed-filtros__campo--ancho { width: 100%; flex: 1 1 100%; }
}

/* Combobox con buscador (áreas) — funciona en PWA/mobile */
.combo { position: relative; }
.combo__input { width: 100%; }
.combo__list {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
    background: #fff; border: 1px solid var(--borde); border-radius: 10px;
    box-shadow: var(--sombra-fuerte); max-height: 280px; overflow-y: auto;
    margin: 0; padding: 4px; list-style: none;
}
.combo__list[hidden] { display: none; }
.combo__item {
    padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: .9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo__item:hover, .combo__item.is-active { background: var(--crema); }
.combo__item[hidden] { display: none; }
.combo__empty { padding: 10px 12px; color: var(--texto-suave); font-size: .85rem; }
.combo__empty[hidden] { display: none; }
.feed-mes { margin: 22px 0 10px; font-size: 1.1rem; color: var(--teal-dark); font-weight: 800;
    border-bottom: 2px solid var(--borde); padding-bottom: 6px; }
.feed-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); border: 1px solid var(--borde);
    border-radius: 12px; padding: 12px 16px; margin-bottom: 10px;
    box-shadow: var(--sombra);
}
.feed-item__icono {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--crema); color: var(--teal); font-size: 1.1rem;
}
.feed-item__body { flex: 1; min-width: 0; }
.feed-item__ruta { font-size: .75rem; color: var(--texto-suave); }
.feed-item__titulo { font-weight: 800; color: var(--oscuro); }
.feed-item__desc { font-size: .85rem; color: var(--texto-suave); }
.feed-item__fecha {
    text-align: right; white-space: nowrap;
    font-weight: 800; color: var(--oscuro);
}
.feed-item__fecha small { display: block; font-weight: 700; }

/* ----------------------- Panel Intendenta ----------------------- */
.panel-intendenta {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.panel-hero {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 28px;
    border-radius: 8px;
    background: var(--oscuro);
    color: #fff;
}
.panel-hero__eyebrow {
    display: block;
    margin-bottom: 8px;
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #9ed9e7;
}
.panel-hero h1 {
    margin: 0;
    font-size: 2.4rem;
    line-height: 1.05;
    letter-spacing: 0;
}
.panel-hero p {
    margin: 10px 0 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #d7e5eb;
}
.panel-hero__count {
    min-width: 150px;
    min-height: 116px;
    border-radius: 8px;
    background: #fff;
    color: var(--oscuro);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.panel-hero__count strong {
    font-size: 3rem;
    line-height: 1;
}
.panel-hero__count span {
    font-size: .95rem;
    font-weight: 800;
    color: var(--texto-suave);
}
/* Semáforo (resumen por estado) */
.semaforo {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.semaforo__card {
    display: flex; flex-direction: column; gap: 4px;
    background: #fff; border: 1px solid var(--borde); border-left: 6px solid var(--borde);
    border-radius: 10px; padding: 16px 18px; box-shadow: var(--sombra); color: var(--oscuro);
    font-family: inherit; text-align: left; width: 100%; cursor: pointer;
}
.semaforo__card:hover:not(:disabled) { text-decoration: none; border-color: var(--teal); }
.semaforo__card:disabled { cursor: default; opacity: .55; }
.semaforo__num { font-size: 2rem; font-weight: 900; line-height: 1; }
.semaforo__lbl { font-size: .82rem; font-weight: 800; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .4px; }
.semaforo__lbl i { margin-right: 5px; }
.semaforo__card--vencida   { border-left-color: var(--magenta); }
.semaforo__card--vencida   .semaforo__num { color: var(--magenta); }
.semaforo__card--en_curso  { border-left-color: var(--naranja); }
.semaforo__card--en_curso  .semaforo__num { color: var(--naranja); }
.semaforo__card--pendiente { border-left-color: var(--teal); }
.semaforo__card--pendiente .semaforo__num { color: var(--teal); }
.semaforo__card--cumplida  { border-left-color: var(--estado-cumplida); }
.semaforo__card--cumplida  .semaforo__num { color: var(--estado-cumplida); }

/* Bloque "Requiere atención" (alertas/notificaciones en el panel) — colapsable */
.panel-alertas { padding-top: 16px; padding-bottom: 16px; }
.panel-alertas__summary { cursor: pointer; align-items: center; gap: 10px; list-style: none; }
.panel-alertas__summary::-webkit-details-marker { display: none; }
.panel-alertas__summary h2 { flex: 1; }
.panel-alertas__caret { color: var(--texto-suave); transition: transform .2s; }
.panel-alertas[open] .panel-alertas__caret { transform: rotate(180deg); }
.panel-alertas .alertas-lista { margin-top: 14px; }
.panel-alertas .panel-bloque__head span {
    background: var(--magenta); color: #fff; font-weight: 800; font-size: .85rem;
    min-width: 26px; text-align: center; padding: 2px 9px; border-radius: 20px;
}
.alertas-lista { display: grid; gap: 8px; }
.alerta-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px;
    border: 1px solid var(--borde); border-radius: 10px; color: var(--texto); background: #fff;
}
.alerta-item:hover { background: var(--crema); text-decoration: none; }
.alerta-item__ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; }
.alerta-item--vencida .alerta-item__ico { background: var(--magenta); }
.alerta-item--proxima .alerta-item__ico { background: var(--naranja); }
.alerta-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.alerta-item__body strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alerta-item__body small { color: var(--texto-suave); font-size: .78rem; }
.alerta-item__tag { font-size: .66rem; font-weight: 800; text-transform: uppercase; color: var(--texto-suave); }

/* Modal del semáforo (lista de actividades por estado) */
.semaforo-modal { position: fixed; inset: 0; z-index: 130; display: flex; align-items: flex-end; justify-content: center; }
.semaforo-modal[hidden] { display: none; }
.semaforo-modal__backdrop { position: absolute; inset: 0; background: rgba(13,33,47,.55); }
.semaforo-modal__panel {
    position: relative; background: #fff; width: 100%; max-width: 560px; max-height: 86vh;
    display: flex; flex-direction: column; border-radius: 18px 18px 0 0;
    box-shadow: var(--sombra-fuerte); overflow: hidden;
}
@media (min-width: 700px) {
    .semaforo-modal { align-items: center; }
    .semaforo-modal__panel { border-radius: 18px; }
}
.semaforo-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--borde); }
.semaforo-modal__head h2 { margin: 0; font-size: 1.1rem; color: var(--oscuro); }
.semaforo-modal__close { background: transparent; border: 0; font-size: 1.25rem; color: var(--texto-suave); cursor: pointer; padding: 4px; }
.semaforo-modal__body { overflow-y: auto; padding: 8px 18px 16px; }
.semaforo-modal__mes { font-size: .76rem; text-transform: uppercase; letter-spacing: .5px; color: var(--teal-dark); font-weight: 800; margin: 16px 0 6px; }
.semaforo-modal__item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--borde); }
.semaforo-modal__item:last-child { border-bottom: 0; }
.semaforo-modal__dot { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; }
.semaforo-dot--vencida { background: var(--magenta); }
.semaforo-dot--en_curso { background: var(--naranja); }
.semaforo-dot--pendiente { background: var(--teal); }
.semaforo-dot--cumplida { background: var(--estado-cumplida); }
.programa-dot--pendiente { background: var(--teal); }
.programa-dot--en_curso { background: var(--naranja); }
.programa-dot--demorado { background: var(--magenta); }
.programa-dot--cumplido { background: var(--estado-cumplida); }

/* Grilla de filtros (lista de actividades) */
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

/* Importador */
.import-ayuda {
    background: var(--oscuro); color: #d7e3ea; border-radius: 10px;
    padding: 14px 16px; font-size: .82rem; line-height: 1.55; overflow-x: auto;
    margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre;
}
.import-tips { font-size: .85rem; color: var(--texto-suave); margin: 12px 0 0; line-height: 1.6; }
.import-tips code, .card__title code { background: var(--crema); color: var(--teal-dark); padding: 1px 6px; border-radius: 5px; font-size: .85em; }
.import-area { border-top: 1px solid var(--borde); padding-top: 14px; margin-top: 14px; }
.import-area:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.import-area h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; font-size: 1.05rem; }
.import-prog { margin: 12px 0 16px; padding-left: 6px; border-left: 3px solid var(--borde); padding-left: 12px; }
.import-prog__desc { color: var(--texto-suave); font-size: .86rem; margin-top: 4px; }
.programa-estado--pendiente { background: var(--teal); }
.programa-estado--en_curso { background: var(--naranja); }
.programa-estado--demorado { background: var(--magenta); }
.programa-estado--cumplido { background: var(--estado-cumplida); }
.semaforo-modal__ibody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.semaforo-modal__ibody strong { font-size: .92rem; color: var(--oscuro); }
.semaforo-modal__ibody small { color: var(--texto-suave); font-size: .78rem; }
.semaforo-modal__ifecha { font-weight: 800; color: var(--oscuro); white-space: nowrap; font-size: .85rem; }
.semaforo-modal__empty { text-align: center; color: var(--texto-suave); padding: 32px 16px; }
.semaforo-modal__foot { display: block; text-align: center; padding: 14px; border-top: 1px solid var(--borde); font-weight: 700; font-size: .88rem; }

/* Modal "imagen completa" del organigrama (poster) — ancho, con scroll en ambos ejes */
.poster-modal { position: fixed; inset: 0; z-index: 140; display: flex; align-items: center; justify-content: center; padding: 3vh 2vw; }
.poster-modal[hidden] { display: none; }
.poster-modal__backdrop { position: absolute; inset: 0; background: rgba(13,33,47,.7); }
.poster-modal__panel {
    position: relative; background: #fff; width: 100%; height: 100%; max-width: 1400px;
    border-radius: 16px; box-shadow: var(--sombra-fuerte); overflow: hidden;
    display: flex; flex-direction: column;
}
.poster-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--borde); flex-wrap: wrap; }
.poster-modal__head h2 { margin: 0; font-size: 1.1rem; color: var(--oscuro); }
.poster-modal__head h2 i { color: var(--naranja); margin-right: 6px; }
.poster-modal__acciones { display: flex; align-items: center; gap: 10px; }
.poster-modal__close { background: transparent; border: 0; font-size: 1.25rem; color: var(--texto-suave); cursor: pointer; padding: 4px; }
.poster-modal__hint { margin: 10px 18px 0; font-size: .82rem; color: var(--texto-suave); }
.poster-modal__body {
    flex: 1; overflow: auto; margin: 12px 18px 18px; border: 1px solid var(--borde); border-radius: 12px;
    background: repeating-conic-gradient(#f5f3ee 0% 25%, #efece4 0% 50%) 50% / 18px 18px; cursor: grab;
}
.poster-modal__body.is-dragging { cursor: grabbing; }
.poster-cargando {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    height: 100%; min-height: 220px; color: var(--texto-suave);
    font-weight: 700; font-size: .95rem;
}
.poster-cargando i { color: var(--teal); font-size: 1.2rem; }
.poster-modal__body svg { display: block; }
@media (max-width: 700px) {
    .poster-modal { padding: 0; }
    .poster-modal__panel { border-radius: 0; max-width: none; }
}

@media (max-width: 680px) {
    .semaforo { grid-template-columns: repeat(2, 1fr); }
    .semaforo__num { font-size: 1.7rem; }
}

.panel-bloque {
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 8px;
    padding: 22px;
    box-shadow: var(--sombra);
}
.panel-bloque__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.panel-bloque__head h2 {
    margin: 0;
    font-size: 1.55rem;
    color: var(--oscuro);
}
.panel-bloque__head span {
    font-size: .95rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.semana-lista {
    display: grid;
    gap: 12px;
}
.semana-card {
    display: grid;
    grid-template-columns: 96px 1fr;
    min-height: 112px;
    border: 2px solid var(--borde);
    border-left-width: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.semana-card[style*="--area-color"] { border-left-color: var(--area-color); }
.semana-card--pendiente:not([style*="--area-color"]) { border-left-color: var(--teal); }
.semana-card--en_curso:not([style*="--area-color"]) { border-left-color: var(--naranja); }
.semana-card--cumplida:not([style*="--area-color"]) { border-left-color: var(--estado-cumplida); }
.semana-card--vencida:not([style*="--area-color"]) { border-left-color: var(--magenta); }
.semana-card__fecha {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f7f3;
    border-right: 1px solid var(--borde);
}
.semana-card__fecha strong {
    font-size: 1rem;
    color: var(--teal-dark);
}
.semana-card__fecha span {
    font-size: 2.35rem;
    line-height: 1;
    font-weight: 900;
    color: var(--oscuro);
}
.semana-card__fecha small {
    font-size: .86rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.area-date-icon,
.area-date-icons i {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--area-color, var(--teal));
    color: #fff;
    font-size: .95rem;
    box-shadow: 0 4px 12px rgba(13, 33, 47, .14);
}
.semana-card__body {
    padding: 18px 20px;
    min-width: 0;
}
.semana-card__area {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 900;
    color: var(--teal-dark);
}
.semana-card h3 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.18;
    color: var(--oscuro);
}
.semana-card p {
    margin: 8px 0 0;
    font-size: 1rem;
    color: var(--texto-suave);
}
.programa-mini {
    color: var(--teal-dark) !important;
    font-weight: 900;
}
.programa-help {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border: 0;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    vertical-align: middle;
}
.programa-help:hover {
    background: var(--teal-dark);
}
.panel-empty {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--texto-suave);
    text-align: center;
}
.panel-empty i {
    font-size: 2.4rem;
    color: var(--teal);
}
.panel-empty strong {
    font-size: 1.2rem;
    color: var(--oscuro);
}
.panel-empty--compact {
    min-height: 120px;
}
.panel-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: -4px 0 14px;
}
.panel-filtros {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}
.panel-filtros__area {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.panel-filtros__area span {
    font-size: .9rem;
    font-weight: 900;
    color: var(--oscuro);
}
.panel-filtros__area select,
.panel-area-search {
    min-height: 52px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 1.02rem;
    font-weight: 800;
}
.panel-area-search {
    padding-left: 14px;
}
.panel-filtros__ver {
    min-height: 52px;
}
.panel-filtros__global {
    min-height: 52px;
    white-space: nowrap;
}
.panel-filtros__global.is-active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}
.panel-filtros__modal {
    width: 52px;
    height: 52px;
    justify-content: center;
    padding: 0;
    font-size: 1.12rem;
}
.range-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    margin: 8px 0 14px;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.range-tab {
    flex: 0 0 auto;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 2px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    color: var(--oscuro);
    font-weight: 900;
}
.range-tab:hover {
    border-color: var(--teal);
    text-decoration: none;
}
.range-tab.is-active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}
.area-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scrollbar-width: thin;
}
.area-tab {
    flex: 0 0 auto;
    max-width: 260px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 2px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    color: var(--oscuro);
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.area-tab:hover {
    border-color: var(--teal);
    text-decoration: none;
}
.area-tab.is-active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}
.area-ruta {
    margin: 4px 0 14px;
    font-size: .96rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.area-ruta i {
    color: var(--naranja);
    margin-right: 6px;
}
.programas-resumen {
    margin: 14px 0 18px;
}
.programas-resumen__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.programas-resumen__head h3 {
    margin: 0;
    font-size: 1.18rem;
    color: var(--oscuro);
}
.programas-resumen__head a {
    font-size: .9rem;
    font-weight: 900;
}
.programa-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}
.programa-card {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 14px 16px;
    border: 2px solid var(--borde);
    border-left: 7px solid var(--teal);
    border-radius: 8px;
    background: #fff;
    color: var(--oscuro);
}
.programa-card:hover {
    border-color: var(--teal);
    text-decoration: none;
}
.programa-card.is-active {
    background: #e4f1f5;
    border-color: var(--teal);
}
.programa-card--en_curso { border-left-color: var(--naranja); }
.programa-card--demorado { border-left-color: var(--magenta); }
.programa-card--cumplido { border-left-color: var(--estado-cumplida); }
.programa-card strong {
    font-size: 1.12rem;
    line-height: 1.18;
}
.programa-card__area,
.programa-card__meta {
    font-size: .86rem;
    font-weight: 900;
    color: var(--texto-suave);
}
.programa-card__area {
    color: var(--teal-dark);
}
.area-agenda {
    display: grid;
    gap: 12px;
}
.agenda-dia {
    display: grid;
    grid-template-columns: 96px 1fr;
    border: 2px solid var(--borde);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.agenda-dia__fecha {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 18px 8px;
    background: #f8f7f3;
    border-right: 1px solid var(--borde);
}
.agenda-dia__fecha strong {
    font-size: 1rem;
    color: var(--teal-dark);
}
.agenda-dia__fecha span {
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 900;
    color: var(--oscuro);
}
.agenda-dia__fecha small {
    font-size: .86rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.area-date-icons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.area-date-icons i {
    width: 30px;
    height: 30px;
    margin-top: 0;
    background: var(--area-color, var(--teal));
}
.agenda-dia__items {
    display: grid;
    gap: 10px;
    padding: 12px;
}
.agenda-hit {
    border-left: 6px solid var(--area-color, var(--teal));
    border-radius: 8px;
    background: #f8f7f3;
    padding: 14px 16px;
}
.agenda-hit__area {
    display: block;
    margin-bottom: 5px;
    font-size: .86rem;
    font-weight: 900;
    color: var(--teal-dark);
}
.agenda-hit--en_curso:not([style*="--area-color"]) { border-left-color: var(--naranja); }
.agenda-hit--cumplida:not([style*="--area-color"]) { border-left-color: var(--estado-cumplida); }
.agenda-hit--vencida:not([style*="--area-color"]) { border-left-color: var(--magenta); }
.agenda-hit h3 {
    margin: 0;
    font-size: 1.22rem;
    line-height: 1.2;
    color: var(--oscuro);
}
.agenda-hit p {
    margin: 7px 0 0;
    font-size: .98rem;
    color: var(--texto-suave);
}
.modal-open {
    overflow: hidden;
}
.programa-info-modal[hidden] {
    display: none;
}
.programa-info-modal {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.programa-info-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 33, 47, .56);
}
.programa-info-modal__panel {
    position: relative;
    width: min(560px, 100%);
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-shadow: var(--sombra-fuerte);
    overflow: hidden;
}
.programa-info-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--borde);
}
.programa-info-modal__head h2 {
    margin: 0;
    font-size: 1.45rem;
    color: var(--oscuro);
}
.programa-info-modal__close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--crema);
    color: var(--oscuro);
    cursor: pointer;
    font-size: 1.1rem;
}
.programa-info-modal__panel p {
    margin: 0;
    padding: 20px;
    font-size: 1.12rem;
    line-height: 1.45;
    color: var(--oscuro);
}
.area-modal[hidden] {
    display: none;
}
.area-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.area-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 33, 47, .56);
}
.area-modal__panel {
    position: relative;
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--borde);
    box-shadow: var(--sombra-fuerte);
    overflow: hidden;
}
.area-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--borde);
}
.area-modal__head h2 {
    margin: 0;
    font-size: 1.45rem;
    color: var(--oscuro);
}
.area-modal__close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--crema);
    color: var(--oscuro);
    cursor: pointer;
    font-size: 1.1rem;
}
.area-modal__search {
    position: relative;
    padding: 16px 20px 10px;
}
.area-modal__search i {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-32%);
    color: var(--teal);
}
.area-modal__search input {
    min-height: 52px;
    padding-left: 42px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 1.02rem;
    font-weight: 800;
}
.area-modal__list {
    overflow-y: auto;
    display: grid;
    gap: 10px;
    padding: 10px 20px 20px;
}
.area-modal__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    min-height: 72px;
    padding: 14px 16px;
    border: 2px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    color: var(--oscuro);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.area-modal__item:hover {
    border-color: var(--teal);
}
.area-modal__item.is-active {
    border-color: var(--teal);
    background: #e4f1f5;
}
.area-modal__item strong {
    font-size: 1.08rem;
    line-height: 1.2;
}
.area-modal__item span {
    font-size: .88rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.timeline-x {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 260px);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
}
.timeline-week {
    min-height: 230px;
    border: 2px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    scroll-snap-align: start;
}
.timeline-week header {
    min-height: 54px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--borde);
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.timeline-week header strong {
    font-size: 1.2rem;
    color: var(--oscuro);
}
.timeline-week header span {
    font-size: .92rem;
    font-weight: 800;
    color: var(--texto-suave);
}
.timeline-week.is-empty {
    background: #faf9f6;
}
.timeline-week__empty {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a969e;
    font-weight: 800;
}
.timeline-hit {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 5px solid var(--teal);
    background: #f8f7f3;
}
.timeline-hit--en_curso { border-left-color: var(--naranja); }
.timeline-hit--cumplida { border-left-color: var(--estado-cumplida); }
.timeline-hit--vencida { border-left-color: var(--magenta); }
.timeline-hit span {
    font-size: .82rem;
    font-weight: 900;
    color: var(--teal-dark);
}
.timeline-hit strong {
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--oscuro);
}

/* ------------------- Contenedor centrado (pantallas anchas) ------------------- */
.wrap { max-width: 1040px; margin: 0 auto; }

/* ----------------------- Encabezado de tarjeta ----------------------- */
.card__title {
    display: flex; align-items: center; gap: 12px;
    margin: 0 0 18px; padding-bottom: 14px;
    border-bottom: 1px solid var(--borde);
    font-size: 1.05rem; font-weight: 800; color: var(--oscuro);
}
.card__title .ico {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
    background: var(--crema); color: var(--teal);
    display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.card__title small { display: block; font-weight: 600; font-size: .78rem; color: var(--texto-suave); }

/* ----------------------- Formularios modernos (2 columnas) ----------------------- */
.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form2 .col-full { grid-column: 1 / -1; }
.form2 .form-actions {
    grid-column: 1 / -1; display: flex; gap: 10px; padding-top: 6px;
    border-top: 1px solid var(--borde); margin-top: 4px; padding-top: 16px;
}
@media (max-width: 680px) { .form2 { grid-template-columns: 1fr; } }

.field2 { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field2 > .lbl { font-weight: 700; font-size: .82rem; color: var(--oscuro); display: flex; align-items: center; gap: 6px; }
.field2 .req { color: var(--magenta); font-weight: 800; }
.field2 .hint { font-weight: 600; font-size: .72rem; color: var(--texto-suave); }

.input-icon { position: relative; display: block; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--teal); font-size: .92rem; pointer-events: none; }
/* padding-left para dejar lugar al ícono. input[type] sube la especificidad para
   ganarle a la regla base input[type=text]{padding:...} (mismo peso, definida después). */
.input-icon > input[type], .input-icon > select { padding-left: 38px; }

/* Fila con switch (configuración) */
.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 16px 4px; border-bottom: 1px solid var(--borde); cursor: pointer;
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-row__info { display: flex; align-items: center; gap: 14px; }
.switch-row__ico {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px;
    background: var(--crema); color: var(--teal);
    display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.switch-row__info strong { display: block; color: var(--oscuro); font-size: .95rem; }
.switch-row__info small { display: block; color: var(--texto-suave); font-size: .82rem; margin-top: 2px; }

.switch { position: relative; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    display: block; width: 50px; height: 28px; border-radius: 20px;
    background: #c9d2d8; transition: background .2s; position: relative;
}
.switch__thumb {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
    border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .switch__track { background: var(--teal); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(5,109,132,.25); }

/* ----------------------------- Formularios (base) ----------------------------- */
.form-grid { display: grid; gap: 14px; max-width: 560px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .85rem; color: var(--oscuro); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=month], input[type=number], input[type=search], input[type=tel],
select, textarea {
    font-family: inherit; font-size: .95rem;
    padding: 10px 12px; border: 1px solid var(--borde);
    border-radius: 10px; background: #fff; color: var(--texto);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(5,109,132,.15);
}
textarea { resize: vertical; min-height: 70px; }

/* ----------------------------- Tablas ----------------------------- */
.tabla { width: 100%; border-collapse: collapse; background: var(--card);
    border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.tabla th, .tabla td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--borde); }
.tabla th { background: var(--oscuro); color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr:hover td { background: var(--crema); }

/* Contenedor con scroll horizontal: evita que las tablas rompan el layout en PWA/mobile */
.tabla-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radio); }
.tabla-scroll .tabla { box-shadow: none; }
@media (max-width: 900px) {
    .tabla-scroll .tabla { min-width: 560px; }
}

/* ----------------------------- Alertas ----------------------------- */
.alerta { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.alerta--ok { background: #e3f5ec; color: #1d6b48; border: 1px solid #b6e3cc; }
.alerta--error { background: #fde4ea; color: #a01838; border: 1px solid #f6b9c8; }
.alerta--info { background: #e4f1f5; color: var(--teal-dark); border: 1px solid #bfe0ea; }

.vacio { text-align: center; color: var(--texto-suave); padding: 40px 20px; }
.vacio i { font-size: 2.4rem; color: var(--borde); display: block; margin-bottom: 10px; }

/* ----------------------------- Login ----------------------------- */
.login-body {
    min-height: 100vh; margin: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--oscuro), var(--teal));
    padding: 20px;
}
.login-card {
    background: var(--card); border-radius: 20px;
    box-shadow: var(--sombra-fuerte);
    width: 100%; max-width: 400px; padding: 36px 30px; text-align: center;
}
.login-card__logo {
    width: 170px; height: 104px; margin: 0 auto 16px;
    background: transparent; border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 14px; box-sizing: border-box;
}
.login-card__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 4px; color: var(--oscuro); }
.login-card p.sub { color: var(--texto-suave); margin: 0 0 22px; font-size: .9rem; }
.login-install {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 0 0 18px;
    border: 2px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    color: var(--teal-dark);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 900;
    cursor: pointer;
}
.login-install.is-ready {
    border-color: var(--teal);
    background: #e4f1f5;
}
.password-field {
    position: relative;
    display: block;
}
.password-field input {
    padding-right: 48px;
}
.password-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--teal-dark);
    font-size: 1rem;
    cursor: pointer;
}
.password-eye:hover {
    background: var(--crema);
}
.login-card .form-grid { max-width: none; text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.login-foot { margin-top: 18px; font-size: .78rem; color: var(--texto-suave); }

/* ----------------------- Vista de Red (organigrama) ----------------------- */
.viewswitch { display: inline-flex; gap: 4px; background: var(--crema); border: 1px solid var(--borde); border-radius: 12px; padding: 4px; }
.viewswitch__btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 0; background: transparent; color: var(--texto-suave);
    font-family: inherit; font-weight: 700; font-size: .85rem;
    padding: 7px 14px; border-radius: 9px; cursor: pointer;
}
.viewswitch__btn:hover { color: var(--teal-dark); }
.viewswitch__btn.is-active { background: var(--teal); color: #fff; box-shadow: var(--sombra); }

.redbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--borde); background: #fbfaf7;
}
.redbar__group { display: flex; gap: 6px; }
.redbar__hint { margin-left: auto; font-size: .78rem; color: var(--texto-suave); }

.red-canvas {
    width: 100%; height: 72vh; min-height: 420px;
    background:
        radial-gradient(circle, #e7e1d4 1px, transparent 1px) 0 0 / 22px 22px,
        var(--bg);
    overflow: hidden; position: relative; touch-action: none; cursor: grab;
}
.red-canvas svg { display: block; }
.red-node text { user-select: none; -webkit-user-select: none; }

/* Pantalla completa de la red */
#redCard:fullscreen { width: 100vw; height: 100vh; border-radius: 0; border: 0; background: #fff; display: flex; flex-direction: column; }
#redCard:fullscreen .red-canvas { flex: 1; height: auto; min-height: 0; }
#redCard:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; background: #fff; display: flex; flex-direction: column; }
#redCard:-webkit-full-screen .red-canvas { flex: 1; height: auto; min-height: 0; }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 900px) {
    /* En mobile el sidebar es off-canvas; se abre desde la barra inferior. */
    .nav-fab { display: none; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--sombra-fuerte); width: var(--sidebar-w) !important; }
    .nav-open .sidebar { transform: translateX(0); }
    .nav-open .sidebar__backdrop { display: block; }
    /* El colapso de escritorio no aplica en mobile. */
    .content,
    .nav-collapsed .content { margin-left: 0; padding: 16px; padding-top: 18px; padding-bottom: 104px; }
    /* Reset de estilos de rail por si quedó colapsado. */
    .nav-collapsed .sidebar__brandtext,
    .nav-collapsed .sidebar__search,
    .nav-collapsed .sb-user__meta,
    .nav-collapsed .sb-user__logout,
    .nav-collapsed .sidebar__section,
    .nav-collapsed .sidebar__link span,
    .nav-collapsed .sidebar__footer { display: revert; }
    .nav-collapsed .sidebar__link { justify-content: flex-start; padding: 11px 12px; }
    .accion { flex-wrap: wrap; }
    .accion__fecha { margin-left: 0; }
    .panel-hero { align-items: stretch; flex-direction: column; padding: 22px; }
    .panel-hero h1 { font-size: 2rem; }
    .panel-hero__count { min-width: 0; min-height: 96px; }
    .panel-bloque { padding: 16px; }
    .panel-bloque__head { align-items: flex-start; flex-direction: column; gap: 4px; }
    .semana-card { grid-template-columns: 76px 1fr; min-height: 104px; }
    .semana-card__fecha span { font-size: 1.9rem; }
    .semana-card__body { padding: 14px; }
    .semana-card h3 { font-size: 1.18rem; }
    .area-tab { max-width: 220px; min-height: 46px; }
    .panel-filtros { grid-template-columns: 1fr; }
    .panel-filtros__modal,
    .panel-filtros__global,
    .panel-filtros__ver { width: 100%; justify-content: center; }
    .panel-quick .btn { flex: 1 1 auto; justify-content: center; }
    .programas-resumen__head { align-items: flex-start; flex-direction: column; }
    .programa-cards { grid-template-columns: 1fr; }
    .range-tab { flex: 0 0 auto; padding: 10px 12px; }
    .agenda-dia { grid-template-columns: 76px 1fr; }
    .agenda-dia__fecha span { font-size: 1.85rem; }
    .agenda-hit { padding: 12px; }
    .agenda-hit h3 { font-size: 1.08rem; }
    .area-modal { padding: 12px; }
    .area-modal__panel { max-height: calc(100vh - 24px); }
    .area-modal__head,
    .area-modal__search,
    .area-modal__list { padding-left: 14px; padding-right: 14px; }
    .timeline-x { grid-auto-columns: minmax(210px, 82vw); }

    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 90;
        min-height: 76px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: 1fr 1fr 74px 1fr 1fr;
        align-items: end;
        gap: 4px;
        background: #fff;
        border-top: 1px solid var(--borde);
        box-shadow: 0 -8px 26px rgba(13, 33, 47, .12);
    }
    .bottom-nav__item {
        min-width: 0;
        min-height: 58px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 0;
        background: transparent;
        color: #58665f;
        font-family: inherit;
        font-size: .76rem;
        font-weight: 900;
        text-align: center;
        cursor: pointer;
    }
    .bottom-nav__item i { font-size: 1.35rem; }
    .bottom-nav__item span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .bottom-nav__item:hover,
    .bottom-nav__item.is-active {
        color: var(--teal-dark);
        text-decoration: none;
    }
    .bottom-nav__add {
        width: 72px;
        height: 72px;
        align-self: center;
        justify-self: center;
        margin-top: -34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--teal);
        color: #fff;
        box-shadow: 0 8px 22px rgba(5, 109, 132, .32);
        border: 6px solid #fff;
        font-size: 2rem;
    }
    .bottom-nav__add:hover {
        color: #fff;
        text-decoration: none;
        background: var(--teal-dark);
    }

    .bottom-more {
        position: fixed;
        inset: 0;
        z-index: 120;
    }
    .bottom-more:not([hidden]) {
        display: block;
    }
    .bottom-more__shade {
        position: absolute;
        inset: 0;
        background: rgba(13, 33, 47, .38);
    }
    .bottom-more__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: calc(92vh - env(safe-area-inset-bottom));
        overflow-y: auto;
        padding: 24px 22px calc(22px + env(safe-area-inset-bottom));
        background: #fff;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -12px 34px rgba(13, 33, 47, .22);
    }
    .bottom-more__head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 18px;
    }
    .bottom-more__head h2 {
        margin: 0;
        font-size: 1.35rem;
        line-height: 1.1;
        color: var(--oscuro);
    }
    .bottom-more__head p {
        margin: 4px 0 0;
        color: var(--texto-suave);
        font-weight: 700;
    }
    .bottom-more__close {
        border: 0;
        background: transparent;
        color: var(--oscuro);
        font-family: inherit;
        font-size: 1rem;
        font-weight: 900;
        cursor: pointer;
        padding: 4px 0;
    }
    .bottom-more__grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
    .bottom-more__card {
        min-height: 116px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 14px 8px;
        border: 1px solid var(--borde);
        border-radius: 14px;
        background: var(--bg);
        color: var(--oscuro);
        text-align: center;
        text-decoration: none;
        box-shadow: var(--sombra);
    }
    .bottom-more__card i {
        font-size: 2rem;
        color: var(--teal);
    }
    .bottom-more__card span {
        max-width: 100%;
        overflow-wrap: anywhere;
        font-size: .9rem;
        line-height: 1.1;
        font-weight: 900;
    }
    .bottom-more__card:hover,
    .bottom-more__card.is-active {
        border-color: var(--teal);
        background: #e4f1f5;
        text-decoration: none;
    }
    .bottom-more__card.is-active i {
        color: var(--naranja);
    }
}

/* Overrides finales: nueva barra PWA sin boton Mas. */
.semana-card[style*="--area-color"],
.agenda-hit[style*="--area-color"] {
    border-left-color: var(--area-color) !important;
}

@media (max-width: 900px) {
    .bottom-nav { display: none !important; }
    .bottom-more { display: none !important; }
    .bottom-nav-v2 { display: grid !important; }
}

/* ---------------- Edición del organigrama (alta/baja/arrastre) ---------------- */
/* Contacto del área dentro del árbol */
.tree__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tree__contacto { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .74rem; color: var(--texto-suave); font-weight: 600; }
.tree__contacto i { color: var(--teal); margin-right: 3px; font-size: .7rem; }

/* Controles: ocultos hasta activar el modo edición */
.tree__handle, .tree__acciones { display: none; }
.org-editando .tree__handle {
    display: inline-flex; align-items: center; color: var(--texto-suave);
    cursor: grab; padding: 0 2px; flex: 0 0 auto;
}
.org-editando .tree__handle:active { cursor: grabbing; }
.org-editando .tree__acciones { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.tree__btn {
    border: 1px solid var(--borde); background: #fff; color: var(--teal);
    width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: .78rem;
}
.tree__btn:hover { background: var(--crema); border-color: var(--teal); }
.tree__btn--del { color: var(--magenta); }
.tree__btn--del:hover { background: #fde4ea; border-color: var(--magenta); }

/* Estado de arrastre y pistas de destino */
.org-editando .tree__row { cursor: grab; }
.tree__node.is-arrastrando { opacity: .45; }
.tree__row.is-drop-dentro {
    outline: 2px dashed var(--teal); outline-offset: 2px; background: #e4f1f5;
}
.tree__row.is-drop-antes { box-shadow: 0 -3px 0 0 var(--naranja); }
.tree__row.is-drop-despues { box-shadow: 0 3px 0 0 var(--naranja); }

.area-msg { font-size: .82rem; font-weight: 700; color: var(--texto-suave); align-self: center; }
.area-msg.is-error { color: var(--magenta); }

@media (max-width: 700px) {
    .tree__contacto { font-size: .7rem; gap: 2px 10px; }
    .tree__btn { width: 32px; height: 32px; }
}

/* Letra identificatoria del área (A, B, C...) en el árbol */
.tree__letra {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 5px;
    background: var(--teal); color: #fff;
    border-radius: 6px; font-size: .74rem; font-weight: 900; letter-spacing: .3px;
}
.tipo--intendencia .tree__letra { background: var(--oscuro); }
