/* dagdAPP MES — Sidebar + Main Layout */
.sidebar{width:180px;background:#0a0f1a;border-right:1px solid #172240;padding:16px 0;display:flex;flex-direction:column;position:fixed;top:0;left:0;bottom:0;z-index:100;overflow-y:auto}
.sidebar-brand{display:flex;align-items:center;gap:10px;padding:0 16px 20px}
.sidebar-logo{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,#f59e0b,#ef4444);display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:900;color:#000;flex-shrink:0}
.sidebar-title{font-size:15px;font-weight:800;color:#eaeff8}
.sidebar-title span{color:#f59e0b}
.sidebar-sub{font-size:9px;color:#455678;display:block}
.sidebar-nav{flex:1}
.nav-link{display:flex;align-items:center;gap:10px;padding:10px 16px;color:#64748b;text-decoration:none;font-size:13px;font-weight:500;transition:all .2s;border-left:3px solid transparent}
.nav-link:hover{color:#cbd5e1;background:#0f1726}
.nav-link.active{color:#f59e0b;background:#f59e0b10;border-left-color:#f59e0b;font-weight:700}
.nav-link.disabled{opacity:0.4;pointer-events:none;cursor:default}
.nav-icon{font-size:16px;width:20px;text-align:center;flex-shrink:0}
.nav-sep{height:1px;background:#172240;margin:6px 16px}
.nav-label{padding:8px 16px 2px;font-size:9px;font-weight:700;color:#2d3a5c;text-transform:uppercase;letter-spacing:.08em}
.grp-wrap{margin:3px 10px;border:1px solid #172240;border-radius:6px;overflow:hidden}
.grp-btn{display:flex;align-items:center;gap:10px;padding:0 12px;height:44px;color:#64748b;font-size:13px;font-weight:500;border-left:3px solid transparent;cursor:pointer;background:none;border-top:none;border-right:none;border-bottom:none;width:100%;text-align:left;transition:all .2s}
.grp-btn:hover{color:#cbd5e1;background:#0f1726}
.grp-btn.open{color:#94a3b8;border-left-color:#f59e0b;background:#0f1726}
.grp-arrow{margin-left:auto;font-size:11px;color:#2d3a5c;transition:transform .2s}
.grp-items{overflow:hidden;transition:max-height .25s ease}
.grp-items .nav-link{padding-left:28px}
.sidebar-user-info{display:flex;align-items:center;gap:10px;padding:10px 16px;color:#64748b;font-size:13px;font-weight:500;border-left:3px solid transparent;cursor:default}
.sidebar-user-info .nav-icon{font-size:16px;width:20px;text-align:center;flex-shrink:0}
.sidebar-user-name{font-size:12px;font-weight:700;color:#94a3b8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:110px}
.sidebar-user-rol{font-size:10px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:110px}
.sidebar-logout{display:flex;align-items:center;gap:10px;padding:10px 16px;color:#64748b;font-size:13px;font-weight:500;transition:all .2s;border-left:3px solid transparent;cursor:pointer;background:none;border-top:none;border-right:none;border-bottom:none;width:100%;text-align:left}
.sidebar-logout:hover{color:#ef4444;background:#ef444410;border-left-color:#ef4444}
.sidebar-footer{padding:12px 16px;font-size:10px;color:#22c55e}
.sidebar-footer::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:#22c55e;margin-right:6px;animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.3}}
.main{margin-left:180px;flex:1;padding:24px}


/* =========================================================
   SIDEBAR UNIFIED GRID v3
   Todos los items alineados: icono | texto | flecha
   ========================================================= */

/* Sidebar base */
.sidebar {
    box-sizing: border-box !important;
}

/* Marca superior */
.sidebar .sidebar-brand {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    column-gap: 12px !important;
    align-items: center !important;
    text-align: left !important;
}

.sidebar .sidebar-logo {
    grid-column: 1 !important;
    justify-self: center !important;
}

.sidebar .sidebar-brand > div:not(.sidebar-logo) {
    grid-column: 2 !important;
    min-width: 0 !important;
    text-align: left !important;
}

/* Todos los items navegables */
.sidebar a,
.sidebar .grp-btn,
.sidebar .sidebar-user-info,
.sidebar .sidebar-logout {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) 16px !important;
    column-gap: 10px !important;
    align-items: center !important;
    justify-content: stretch !important;
    justify-items: stretch !important;

    width: 100% !important;
    min-height: 42px !important;
    height: auto !important;

    box-sizing: border-box !important;
    text-align: left !important;
}

/* Padding homogéneo para items de primer nivel */
.sidebar > a,
.sidebar #sidebar-nav > a,
.sidebar #sidebar-nav > .grp-btn,
.sidebar .grp-btn,
.sidebar .sidebar-user-info,
.sidebar .sidebar-logout {
    padding: 9px 14px 9px 18px !important;
}

/* Iconos */
.sidebar .nav-icon,
.sidebar a > .nav-icon,
.sidebar .grp-btn > .nav-icon,
.sidebar .sidebar-user-info > .nav-icon,
.sidebar .sidebar-logout > .nav-icon {
    grid-column: 1 !important;

    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    text-align: center !important;
    justify-self: center !important;
    flex: none !important;
}

/* Texto de enlaces normales */
.sidebar a > span:not(.nav-icon):not(.grp-arrow),
.sidebar .grp-btn > span:not(.nav-icon):not(.grp-arrow),
.sidebar .sidebar-logout > span:not(.nav-icon):not(.grp-arrow) {
    grid-column: 2 !important;

    display: block !important;
    width: 100% !important;
    min-width: 0 !important;

    text-align: left !important;
    justify-self: start !important;

    white-space: normal !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* Usuario */
.sidebar .sidebar-user-info > div {
    grid-column: 2 !important;
    min-width: 0 !important;
    text-align: left !important;
    justify-self: start !important;
}

.sidebar .sidebar-user-name,
.sidebar .sidebar-user-rol {
    text-align: left !important;
    max-width: none !important;
    width: 100% !important;
}

/* Flechas de grupos */
.sidebar .grp-arrow {
    grid-column: 3 !important;

    justify-self: end !important;
    align-self: center !important;

    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;

    margin-left: 0 !important;
    text-align: right !important;
    flex: none !important;
}

/* Contenedores de subitems */
.sidebar .grp-items {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Subitems: algo indentados, pero con la misma retícula */
.sidebar .grp-items a {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) 16px !important;
    column-gap: 10px !important;
    align-items: center !important;

    width: 100% !important;
    min-height: 38px !important;
    height: auto !important;

    padding: 8px 14px 8px 30px !important;
    box-sizing: border-box !important;

    text-align: left !important;
}

.sidebar .grp-items a .nav-icon {
    grid-column: 1 !important;
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    text-align: center !important;
    justify-self: center !important;
}

.sidebar .grp-items a span:not(.nav-icon):not(.grp-arrow) {
    grid-column: 2 !important;

    display: block !important;
    min-width: 0 !important;
    width: 100% !important;

    text-align: left !important;
    justify-self: start !important;

    white-space: normal !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* Footer */
.sidebar .sidebar-footer {
    text-align: left !important;
    padding-left: 18px !important;
    padding-right: 14px !important;
}

/* Anulación final de cualquier centrado heredado */
.sidebar,
.sidebar * {
    text-align: left;
}

.sidebar .nav-icon,
.sidebar .sidebar-logo {
    text-align: center !important;
}

/* Evitar que Bootstrap u otros estilos deformen botones */
.sidebar button {
    font-family: inherit !important;
}

.sidebar .grp-btn {
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
}

/* =========================================================
   FIN SIDEBAR UNIFIED GRID v3
   ========================================================= */

