:root {
    --dash-sidebar-width: 256px;
    --dash-sidebar-mini: 64px;
    --dash-rightbar-width: var(--dash-sidebar-width);
    --dash-rightbar-mini: var(--dash-sidebar-mini);
    --dash-header-height: 64px;
    --dash-accent: #8b5cf6;
    --dash-footer-height: 48px;
    --dash-bg: #0b1120;
    --dash-surface: #111827;
    --dash-border: #1f2937;
}

/* ---- Escala tipográfica por breakpoint (raíz de los rem) ---- */
html {
    font-size: 87.5%; /* xs, sm, md: 1rem = 14px */
}

@media (min-width: 992px) {
    html {
        font-size: 90%; /* lg: 1rem = 14.4px */
    }
}

@media (min-width: 1200px) {
    html {
        font-size: 93.75%; /* xl y xxl: 1rem = 15px */
    }
}

/* ---- Interlineado compacto: la línea mide ~15% más que la letra (14px → ~16px) ---- */
body {
    --bs-body-line-height: 1.15;
    line-height: 1.15;
    background: var(--dash-bg);
}

/* ---- Sidebar (izquierda) ---- */
.dash-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--dash-sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #111827 0%, #0b1120 100%);
    border-right: 1px solid var(--dash-border);
    z-index: 1040;
    transition: transform 0.2s ease;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: var(--dash-header-height);
    padding: 0 1.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f9fafb;
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

.dash-brand-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
}

.dash-brand-logo {
    max-height: calc(var(--dash-header-height) - 1rem);
    max-width: 100%;
    object-fit: contain;
}

.dash-brand-dot {
    color: var(--dash-accent);
}

.dash-nav-label {
    padding: 0.9rem 1.5rem 0.25rem;
    color: #6b7280;
    letter-spacing: 0.08em;
}

.dash-nav {
    padding: 0.25rem 0.75rem 0.75rem;
    gap: 0.15rem;
    flex: 1;
    flex-wrap: nowrap;
    overflow-y: auto;
    overflow-x: hidden;
}

.dash-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #9ca3af;
    border-radius: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-left: 2px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dash-nav .nav-link:hover {
    background: rgb(139 92 246 / 0.08);
    color: #e5e7eb;
}

.dash-nav .nav-link.active {
    background: rgb(139 92 246 / 0.16);
    border-left-color: var(--dash-accent);
    color: #ede9fe;
}

.dash-sidebar-footer {
    display: flex;
    align-items: center;
    height: var(--dash-footer-height);
    padding: 0 1.25rem;
    border-top: 1px solid var(--dash-border);
    flex-shrink: 0;
    color: #6b7280;
}

/* ---- Columna central ---- */
.dash-main {
    margin-left: var(--dash-sidebar-width);
    margin-right: var(--dash-rightbar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dash-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--dash-header-height);
    background: var(--dash-surface);
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

.dash-topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f9fafb;
}

.dash-content {
    flex: 1;
}

.dash-footer {
    height: var(--dash-footer-height);
    flex-shrink: 0;
    border-top: 1px solid var(--dash-border);
    color: #6b7280;
}

.dash-content .card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
}

.dash-content .progress {
    background: #1f2937;
}

.dash-content .progress-bar {
    background: var(--dash-accent);
}

/* ---- Botones de icono de la topbar ---- */
.dash-iconbtn {
    position: relative;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--dash-border);
    background: transparent;
    color: #9ca3af;
    padding: 0;
    text-decoration: none;
}

.dash-iconbtn:hover {
    background: rgb(139 92 246 / 0.16);
    color: #f9fafb;
}

/* Estado activo del botón de Debug (#btnDebuger): barra de depuración encendida. */
.dash-iconbtn.is-active,
.dash-iconbtn.is-active:hover {
    background: var(--dash-accent);
    border-color: var(--dash-accent);
    color: #fff;
}

.dash-iconbtn.dropdown-toggle::after {
    display: none;
}

.dash-badge {
    position: absolute;
    top: -0.4rem;
    right: -0.4rem;
    min-width: 1.1rem;
    padding: 0 0.3em;
    border-radius: 999px;
    background: var(--dash-accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.7;
    text-align: center;
}

.dash-badge-danger {
    background: #ef4444;
}

/* ---- Avatares ---- */
.dash-avatar {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: rgb(139 92 246 / 0.2);
    color: #c4b5fd;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dash-avatar-lg {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 0.9rem;
}

/* ---- Rightbar (derecha) ---- */
.dash-rightbar {
    position: fixed;
    inset: 0 0 0 auto;
    width: var(--dash-rightbar-width);
    display: flex;
    flex-direction: column;
    background: var(--dash-surface);
    border-left: 1px solid var(--dash-border);
    z-index: 1030;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.dash-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--dash-header-height);
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--dash-border);
    color: #f9fafb;
    flex-shrink: 0;
}

.dash-rightbar-label {
    flex-shrink: 0;
}

.dash-contacts {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ---- Formulario de acceso para visitantes (rightbar) ---- */
.dash-login {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    color: #d1d5db;
}

.dash-login-hint {
    color: #9ca3af;
}

.dash-profile .fw-semibold {
    font-size: 0.9rem;
    line-height: 1.2;
}

.dash-profile .badge {
    font-size: 0.65rem;
}

.dash-rightbar-label {
    padding: 0.9rem 1.25rem 0.35rem;
    color: #6b7280;
    letter-spacing: 0.08em;
}

.dash-contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
}

.dash-contact:hover {
    background: rgb(139 92 246 / 0.08);
}

.dash-contact-info {
    min-width: 0;
}

.dash-contact-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-contact-status {
    font-size: 0.75rem;
    color: #6b7280;
}

.dash-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #374151;
    margin-left: auto;
    flex-shrink: 0;
}

.dash-dot.online {
    background: #22c55e;
}

/* ---- Modo iconificado (colapso a mínimo) ---- */
.dash-sidebar,
.dash-rightbar {
    transition: transform 0.2s ease, width 0.2s ease;
}

.dash-main {
    transition: margin 0.2s ease;
}

@media (min-width: 992px) {
    body.dash-mini-left .dash-sidebar {
        width: var(--dash-sidebar-mini);
    }

    body.dash-mini-left .dash-main {
        margin-left: var(--dash-sidebar-mini);
    }

    body.dash-mini-left .dash-brand {
        justify-content: center;
        padding: 0;
    }

    body.dash-mini-left .dash-brand-text,
    body.dash-mini-left .dash-nav-text,
    body.dash-mini-left .dash-nav-label,
    body.dash-mini-left .dash-sidebar-footer {
        display: none;
    }

    body.dash-mini-left .dash-nav .nav-link {
        justify-content: center;
        padding: 0.55rem;
        border-left: none;
    }
}

@media (min-width: 1400px) {
    body.dash-mini-right .dash-rightbar {
        width: var(--dash-rightbar-mini);
    }

    body.dash-mini-right .dash-main {
        margin-right: var(--dash-rightbar-mini);
    }

    body.dash-mini-right .dash-profile {
        justify-content: center;
        padding: 0;
    }

    body.dash-mini-right .dash-profile-info,
    body.dash-mini-right .dash-rightbar-label,
    body.dash-mini-right .dash-contact-info,
    body.dash-mini-right .dash-login,
    body.dash-mini-right .dash-dot {
        display: none;
    }

    body.dash-mini-right .dash-contact {
        justify-content: center;
        padding: 0.5rem 0;
    }
}

/* ---- Responsive ---- */
@media (max-width: 1399.98px) {
    .dash-rightbar {
        transform: translateX(100%);
    }

    .dash-rightbar.show {
        transform: none;
        box-shadow: 0 0 40px rgb(0 0 0 / 0.6);
    }

    .dash-main {
        margin-right: 0;
    }
}

@media (max-width: 991.98px) {
    .dash-sidebar {
        transform: translateX(-100%);
    }

    .dash-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 40px rgb(0 0 0 / 0.6);
    }

    .dash-main {
        margin-left: 0;
    }
}

/* ---- Menú de módulo inyectado en la barra lateral (dato de vista module_menu) ---- */
.dash-nav .sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    flex-shrink: 0;
    color: #9ca3af;
    border-radius: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dash-nav .sidebar-item:hover {
    background: rgb(139 92 246 / 0.08);
    color: #e5e7eb;
}

.dash-nav .sidebar-item.active {
    background: rgb(139 92 246 / 0.16);
    border-left-color: var(--dash-accent);
    color: #ede9fe;
}

.dash-nav .sidebar-item i {
    width: 18px;
    font-size: 0.95rem;
    text-align: center;
    color: #6b7280;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.dash-nav .sidebar-item:hover i {
    color: #d1d5db;
}

.dash-nav .sidebar-item.active i {
    color: var(--dash-accent);
}

.dash-nav .sidebar-svg {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    /* Silueta clara sobre fondo oscuro, sea cual sea el color original del SVG */
    filter: brightness(0) invert(0.72);
    transition: filter 0.15s ease;
}

.dash-nav .sidebar-item:hover .sidebar-svg,
.dash-nav .sidebar-item.active .sidebar-svg {
    filter: brightness(0) invert(0.95);
}

/* ---- Grupos plegables del menú (acordeón, ver get_NavAccordion) ---- */
.dash-nav-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    flex-shrink: 0;
}

.dash-nav .sidebar-group {
    width: 100%;
}

.dash-nav .sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #9ca3af;
    border-radius: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-left: 2px solid transparent;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dash-nav .sidebar-group-toggle:hover {
    background: rgb(139 92 246 / 0.08);
    color: #e5e7eb;
}

.dash-nav .sidebar-group-toggle i {
    width: 18px;
    font-size: 0.95rem;
    text-align: center;
    color: #6b7280;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.dash-nav .sidebar-group-toggle:hover i {
    color: #d1d5db;
}

.dash-nav .sidebar-group-toggle .sidebar-group-chevron {
    margin-left: auto;
    width: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease, color 0.15s ease;
}

.dash-nav .sidebar-group-toggle[aria-expanded="true"] {
    color: #ede9fe;
}

.dash-nav .sidebar-group-toggle[aria-expanded="true"] i {
    color: var(--dash-accent);
}

.dash-nav .sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
    transform: rotate(180deg);
}

/* Submenú indentado con guía vertical alineada bajo el icono del grupo */
.dash-nav .sidebar-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-left: 1.05rem;
    padding: 0.15rem 0 0.15rem 0.6rem;
    border-left: 1px solid var(--dash-border);
}

@media (min-width: 992px) {
    body.dash-mini-left .dash-nav .sidebar-group-toggle {
        justify-content: center;
        padding: 0.55rem;
    }

    body.dash-mini-left .dash-nav .sidebar-group-chevron {
        display: none;
    }

    body.dash-mini-left .dash-nav .sidebar-group-items {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }
}

@media (min-width: 992px) {
    body.dash-mini-left .dash-nav .sidebar-text {
        display: none;
    }

    body.dash-mini-left .dash-nav .sidebar-item {
        justify-content: center;
        padding: 0.55rem;
        border-left: none;
    }
}

/* ---- Breadcrumb de módulo bajo el topbar (dato de vista module_breadcrumb) ---- */
.dash-breadcrumb {
    padding: 0.65rem 1.5rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.06);
}

.dash-breadcrumb .breadcrumb {
    margin: 0;
    padding: 0;
    border: 0 !important;
    background: transparent;
    font-size: 0.9rem;
}

.dash-breadcrumb .breadcrumb-item,
.dash-breadcrumb .breadcrumb-item a {
    color: #9ca3af;
    text-decoration: none;
}

.dash-breadcrumb .breadcrumb-item a:hover {
    color: #e5e7eb;
}

.dash-breadcrumb .breadcrumb-item:last-child a {
    color: #ede9fe;
}

/* ---- Shortcuts (accesos directos del módulo en la columna central
        y en el modal de Módulos Disponibles) ---- */
.dash-content .shortcuts .shortcut,
#higgs-options-modules .shortcuts .shortcut {
    display: block;
    padding: 1.25rem 1rem;
    border-radius: 0.5rem;
    background: var(--dash-surface);
    color: #d1d5db;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.dash-content .shortcuts .shortcut:hover,
#higgs-options-modules .shortcuts .shortcut:hover {
    border-color: var(--dash-accent) !important;
    color: #ede9fe;
    box-shadow: 0 0 0 1px var(--dash-accent);
}

.dash-content .shortcuts .container-icon,
#higgs-options-modules .shortcuts .container-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: var(--dash-accent);
}

.dash-content .shortcuts h5,
#higgs-options-modules .shortcuts h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.shortcuts .container-icon .icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
