/* --- MENÚ MÓVIL --- */
.mobile-menu-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 2001;
    background: #232946;
    color: #eebbc3;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 2px 8px rgba(44,62,80,0.10);
    transition: background 0.2s, color 0.2s;
}
.mobile-menu-btn:active, .mobile-menu-btn:focus {
    outline: none;
    background: #eebbc3;
    color: #232946;
}
@media (min-width: 992px) {
    .mobile-menu-btn {
        display: none !important;
    }
}

/* Sidebar animación móvil */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100vw;
        height: 100vh;
        width: 80vw;
        max-width: 320px;
        min-width: 0;
        border-radius: 0 18px 18px 0;
        box-shadow: 2px 0 16px rgba(44,62,80,0.13);
        background: #fff;
        z-index: 2000;
        transition: left 0.3s cubic-bezier(.4,2,.6,1);
    }
    .sidebar.show-mobile {
        left: 0;
    }
    .main-flex {
        flex-direction: column;
    }
    .content, .content.expanded {
        margin: 1rem auto;
        padding: 1.2rem 0.7rem;
        width: 100%;
        max-width: 100vw;
    }
}
/* --- FIN MENÚ MÓVIL --- */
/* Estilos principales para el CRM Académico */

/* --- INICIO CAMBIO: barra lateral adaptable y textos visibles --- */
.sidebar {
    min-height: 100vh;
    width: 236px;
    max-width: 90vw;
    background: #fff;
    border-right: none;
    box-shadow: 2px 0 12px rgba(44,62,80,0.07);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-left: 0;
    padding-right: 0;
    transition: width 0.3s cubic-bezier(.4,2,.6,1), min-width 0.3s cubic-bezier(.4,2,.6,1), padding 0.3s;
}
.sidebar-scroll {
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
    padding-right: 0.2rem;
}
.sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #d9e2ec;
    border-radius: 999px;
}
.sidebar-brand {
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #eef2f7;
}
.sidebar-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1f2937;
}
.sidebar-brand-subtitle {
    font-size: 0.82rem;
    color: #6b7280;
}
.sidebar-nav {
    gap: 0.15rem;
}
.sidebar .nav-link {
    color: #36506b;
    font-weight: 600;
    font-size: 0.96rem;
    border-radius: 12px;
    margin-bottom: 0.05rem;
    padding: 0.28rem 0.85rem;
    min-width: 38px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.sidebar .nav-link i {
    font-size: 1.05rem;
    margin-right: 0.1rem;
    min-width: 1.2rem;
    text-align: center;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active,
.nav-link-toggle.active {
    background: #edf6ff;
    color: #0f5cc0;
    box-shadow: inset 0 0 0 1px #d7e8ff;
}
.nav-link-toggle {
    width: 100%;
    border: none;
    background: transparent;
}
.nav-link-main {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}
.nav-link-toggle .nav-caret {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: #8a94a6;
}
.nav-group.open .nav-caret {
    transform: rotate(180deg);
}
.nav-submenu {
    display: none;
    margin: 0.2rem 0 0.4rem 0.7rem;
    padding-left: 0.9rem;
    border-left: 1px solid #e7eef7;
}
.nav-group.open .nav-submenu {
    display: block;
}
.nav-sublink {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.52rem 0.75rem;
    margin: 0.08rem 0;
    border-radius: 10px;
    color: #5b6777;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}
.nav-sublink i {
    min-width: 1rem;
    text-align: center;
}
.nav-sublink:hover,
.nav-sublink.active {
    background: #f5f9ff;
    color: #0f5cc0;
}
.sidebar.collapsed {
    width: 54px !important;
    min-width: 54px !important;
    overflow: hidden;
    padding: 0 !important;
    border: none;
}
.sidebar.collapsed .nav-link span {
    display: none;
}
@media (max-width: 991px) {
    .sidebar {
        width: 100vw;
        min-width: 0;
        max-width: 100vw;
        border-radius: 0 0 18px 18px;
    }
    .sidebar-scroll {
        max-height: calc(100vh - 1rem);
    }
}
/* --- FIN CAMBIO --- */

/* --- FIX: Forzar que el contenido principal ocupe el espacio correcto al lado de la barra lateral --- */
.main-flex {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100vw;
}
.sidebar {
    flex-shrink: 0;
}
.content, .content.expanded {
    flex: 1 1 0%;
    min-width: 0;
    width: auto;
    max-width: 100vw;
    background: #fff;
    border-radius: 18px;
    margin: 2.5rem auto;
    padding: 2.5rem 2rem 2rem 2.5rem;
    min-height: 80vh;
    box-shadow: 0 4px 32px rgba(44,62,80,0.08);
    transition: margin 0.3s cubic-bezier(.4,2,.6,1), width 0.3s cubic-bezier(.4,2,.6,1);
}
@media (max-width: 991px) {
    .main-flex {
        flex-direction: column;
    }
    .sidebar {
        width: 100vw;
        min-width: 0;
        max-width: 100vw;
        border-radius: 0 0 18px 18px;
    }
    .content, .content.expanded {
        margin: 1rem auto;
        padding: 1.2rem 0.7rem;
        width: 100%;
        max-width: 100vw;
    }
}
/* --- FIN FIX --- */

.content {
    background: #fff;
    border-radius: 18px;
    margin: 2.5rem auto;
    padding: 2.5rem 2rem 2rem 2.5rem;
    min-height: 80vh;
    box-shadow: 0 4px 32px rgba(44,62,80,0.08);
    width: 100%;
    max-width: 1100px;
    transition: margin 0.3s cubic-bezier(.4,2,.6,1), width 0.3s cubic-bezier(.4,2,.6,1);
}
.content.expanded {
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100%;
}

.global-search-bar {
    max-width: 560px;
    position: relative;
}

.global-search-bar .input-group-text,
.global-search-bar .form-control,
.global-search-bar .btn {
    height: 48px;
}

.global-search-bar .input-group-text {
    border-radius: 14px 0 0 14px;
}

.global-search-bar .form-control {
    border-radius: 0;
}

.global-search-bar .btn {
    border-radius: 0 14px 14px 0;
    padding-inline: 1.15rem;
}

.global-search-suggestions {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(44,62,80,0.12);
    overflow: hidden;
    z-index: 1100;
}

.global-search-item,
.global-search-footer {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #eef2f7;
}

.global-search-item:hover,
.global-search-footer:hover {
    background: #f8fbff;
}

.global-search-type {
    min-width: 76px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #2d7ff9;
}

.global-search-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.global-search-main strong {
    font-size: 0.95rem;
    color: #1f2937;
}

.global-search-main small {
    color: #6b7280;
}

.global-search-empty {
    padding: 0.9rem 1rem;
    color: #6b7280;
}

.global-search-footer {
    justify-content: center;
    font-weight: 600;
    color: #2d7ff9;
    border-bottom: none;
}

.dashboard-stat-card {
    min-height: 190px;
}

.dashboard-highlight-card {
    min-height: 170px;
}

.dashboard-stat-card .card-title,
.dashboard-highlight-card .card-title {
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.dashboard-stat-card h2,
.dashboard-highlight-card h2 {
    margin-bottom: 0;
    line-height: 1.1;
}

.agenda-panel-body {
    max-height: 560px;
    overflow-y: auto;
}

.agenda-panel-body-wide {
    max-height: 420px;
}

.agenda-panel-body::-webkit-scrollbar {
    width: 10px;
}

.agenda-panel-body::-webkit-scrollbar-thumb {
    background: #cfd8e3;
    border-radius: 999px;
}

.agenda-panel-body::-webkit-scrollbar-track {
    background: #f5f7fb;
    border-radius: 999px;
}

@media (max-width: 767px) {
    .dashboard-stat-card,
    .dashboard-highlight-card {
        min-height: auto;
    }

    .agenda-panel-body,
    .agenda-panel-body-wide {
        max-height: none;
        overflow: visible;
    }
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    gap: 1rem;
    align-items: start;
}

.kanban-column {
    background: #f8fafc;
    border: 1px solid #e6edf5;
    border-radius: 18px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 1rem 1rem 0.75rem 1rem;
    border-bottom: 1px solid #e6edf5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.kanban-card {
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 14px;
    padding: 0.9rem;
    box-shadow: 0 6px 18px rgba(44,62,80,0.05);
}

.kanban-card-danger {
    border-color: #f5b5bb;
    background: #fff8f8;
}

.kanban-card-warning {
    border-color: #f2d38b;
    background: #fffdf5;
}

.kanban-empty {
    color: #7d8795;
    font-size: 0.95rem;
    padding: 0.5rem 0.25rem;
}

@media (max-width: 1400px) {
    .kanban-board {
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }
}

@media (max-width: 991px) {
    .kanban-board {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 767px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 991px) {
    .main-flex {
        flex-direction: column;
    }
    .sidebar {
        min-height: auto;
        border-radius: 0 0 18px 18px;
    }
    .content {
        margin: 1rem auto;
        padding: 1.2rem 0.7rem;
        width: 100%;
    }
}

.mensajes-panel-body {
    max-height: 72vh;
    overflow-y: auto;
}

.mensajes-chat-body {
    min-height: 72vh;
}

.mensajes-chat-stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    max-height: 52vh;
    padding-right: 0.35rem;
}

.mensaje-conversacion-item {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e9eef5;
    border-radius: 14px;
    padding: 0.95rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.mensaje-conversacion-item:hover,
.mensaje-conversacion-item.active {
    border-color: #2d7ff9;
    background: #f7fbff;
    box-shadow: 0 8px 24px rgba(45, 127, 249, 0.08);
}

.mensaje-burbuja {
    max-width: 82%;
    border-radius: 18px;
    padding: 0.9rem 1rem;
    box-shadow: 0 8px 20px rgba(44,62,80,0.08);
}

.mensaje-burbuja.propio {
    align-self: flex-end;
    background: #e9f2ff;
    border: 1px solid #cfe0ff;
}

.mensaje-burbuja.ajeno {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e9eef5;
}

.mensaje-asunto {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.mensaje-meta {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.55rem;
}

.mensaje-flag {
    font-size: 0.78rem;
    font-weight: 700;
    color: #9a6700;
    margin-bottom: 0.45rem;
}

.mensaje-recordatorio-item {
    border: 1px solid #e9eef5;
    border-radius: 14px;
    padding: 0.95rem;
    margin-bottom: 0.75rem;
    background: #fff;
}

.mensaje-recordatorio-item.vencido {
    border-color: #f2b8b5;
    background: #fff6f5;
}

.app-live-toast {
    background: #1f2937;
    color: #fff;
}

.app-live-toast .toast-header {
    background: #111827;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-live-toast .btn-close {
    filter: invert(1);
}

.floating-inbox-toggle {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    background: #2d7ff9;
    color: #fff;
    font-size: 1.45rem;
    box-shadow: 0 18px 40px rgba(45, 127, 249, 0.28);
    z-index: 2050;
}

.floating-inbox-count {
    position: absolute;
    top: -4px;
    right: -3px;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
}

.floating-inbox-panel {
    position: fixed;
    right: 26px;
    bottom: 102px;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(44,62,80,0.18);
    z-index: 2045;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s, transform 0.2s;
}

.floating-inbox-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.floating-inbox-header,
.floating-inbox-footer {
    padding: 0.95rem 1rem;
    background: #f8fbff;
    border-bottom: 1px solid #eef2f7;
}

.floating-inbox-footer {
    border-bottom: none;
    border-top: 1px solid #eef2f7;
}

.floating-inbox-body {
    max-height: 58vh;
    overflow-y: auto;
    padding: 1rem;
}

.floating-inbox-section + .floating-inbox-section {
    margin-top: 1rem;
}

.floating-inbox-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 0.6rem;
}

.floating-inbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.floating-inbox-item {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e9eef5;
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}

.floating-inbox-item:hover {
    border-color: #2d7ff9;
    background: #f8fbff;
}

.floating-inbox-item-warning {
    border-color: #f1d59a;
    background: #fffdf5;
}

.alumno-actividad-panel {
    max-height: 420px;
    overflow-y: auto;
}

@media (max-width: 767px) {
    .floating-inbox-toggle {
        right: 18px;
        bottom: 18px;
    }

    .floating-inbox-panel {
        right: 12px;
        left: 12px;
        bottom: 90px;
        width: auto;
        max-width: none;
    }
}

.territorial-map {
    width: 100%;
    height: min(70vh, 620px);
    min-height: 520px;
    border-radius: 0 0 18px 18px;
}

.territorial-summary-strip {
    margin-bottom: 0.75rem !important;
}

.territorial-summary-strip .card-body {
    padding: 0.8rem 0.95rem;
}

.territorial-summary-strip .fs-3 {
    font-size: 1.55rem !important;
}

.territorial-filter-panel {
    max-height: none;
    overflow: visible;
}

.territorial-layout {
    display: grid;
    grid-template-columns: minmax(0, calc(100% - 300px)) 284px;
    gap: 1rem;
    align-items: start;
    width: 100%;
}

.territorial-panel {
    position: sticky;
    top: 1rem;
    max-height: 82vh;
    overflow: hidden;
    width: 100%;
}

.territorial-panel-body {
    max-height: calc(82vh - 58px);
    overflow-y: auto;
}

.territorial-panel-body .territorial-panel-empty {
    display: grid;
    gap: 0.3rem;
    padding: 0.8rem;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #475569;
    background: #f8fafc;
}

.territorial-panel-body .territorial-panel-empty span {
    font-size: 0.92rem;
}

.territorial-center {
    min-width: 0;
    width: 100%;
}

.territorial-map-card,
.territorial-map-shell {
    width: 100%;
    max-width: none;
}

.territorial-toolbar-card {
    overflow: hidden;
}

.territorial-secondary-tabs {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 0.9rem;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.territorial-section-tabs {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.territorial-section-tabs button {
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-weight: 700;
    font-size: 0.92rem;
}

.territorial-section-tabs button.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 8px 18px rgba(13, 110, 253, 0.18);
}

.territorial-tab-pane {
    display: none;
}

.territorial-tab-pane.active {
    display: block;
}

.territorial-tab-pane > .card,
.territorial-tab-pane > .row {
    margin-bottom: 0 !important;
}

.territorial-tab-pane .card-body {
    max-height: 52vh;
    overflow-y: auto;
}

.territorial-toolbar-compact .card-header {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.territorial-toolbar-compact .card-body {
    padding-top: 0.9rem;
}

.territorial-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.territorial-filter-grid .mb-3,
.territorial-filter-grid .row.g-2 {
    margin-bottom: 0 !important;
}

.territorial-filter-grid .form-label {
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.territorial-filter-grid .form-select,
.territorial-filter-grid .form-control {
    font-size: 0.92rem;
}

.territorial-filter-grid .btn {
    white-space: nowrap;
}

.territorial-mini-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.territorial-mini-stats > div {
    margin: 0 !important;
}

.territorial-map-shell {
    position: relative;
}

.territorial-map-controls {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 500;
    display: flex;
    gap: 0.5rem;
}

.territorial-map-controls .btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.territorial-map-legend {
    position: absolute;
    left: 0.85rem;
    bottom: 1rem;
    z-index: 500;
    width: min(320px, calc(100% - 1.7rem));
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 0.8rem 0.85rem;
    backdrop-filter: blur(8px);
}

.territorial-map-legend-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.territorial-map-legend-body {
    display: grid;
    gap: 0.8rem;
}

.territorial-legend-group {
    display: grid;
    gap: 0.45rem;
}

.territorial-legend-title {
    margin-bottom: 0.1rem;
}

.territorial-legend-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    color: #1f2937;
}

.territorial-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.territorial-legend-icon {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    flex: 0 0 auto;
}

body.territorial-fullscreen .sidebar,
body.territorial-fullscreen .mobile-menu-btn,
body.territorial-fullscreen .global-search-bar,
body.territorial-fullscreen .floating-inbox-toggle,
body.territorial-fullscreen .floating-inbox-panel {
    display: none !important;
}

body.territorial-fullscreen .main-flex,
body.territorial-fullscreen .content {
    margin: 0;
    padding: 0;
    max-width: none;
    width: 100%;
}

body.territorial-fullscreen .territorial-map-shell {
    background: #fff;
}

body.territorial-fullscreen .territorial-map {
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
}

.territorial-panel-card .form-label {
    font-size: 0.85rem;
}

.territorial-history-list {
    max-height: 260px;
    overflow-y: auto;
}

.territorial-marker-wrapper {
    background: transparent;
    border: none;
}

.territorial-marker-dot {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.18);
}

.territorial-alert-icon-wrapper {
    background: transparent;
    border: none;
}

.territorial-alert-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2), 0 3px 10px rgba(15, 23, 42, 0.25);
    font-size: 0.92rem;
}

@media (max-width: 991px) {
    .territorial-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .territorial-layout {
        grid-template-columns: 1fr;
    }

    .territorial-panel {
        position: static;
        max-height: none;
    }

    .territorial-map {
        height: 64vh;
        min-height: 460px;
    }

    .territorial-map-legend {
        width: min(280px, calc(100% - 1.7rem));
    }

    .territorial-panel-body {
        max-height: none;
    }
}

@media (max-width: 767px) {
    .territorial-filter-grid {
        grid-template-columns: 1fr;
    }

    .territorial-mini-stats {
        grid-template-columns: 1fr;
    }

    .territorial-map-legend {
        left: 0.7rem;
        right: 0.7rem;
        bottom: 0.7rem;
        width: auto;
        padding: 0.7rem 0.75rem;
    }

    .territorial-map-legend-header {
        margin-bottom: 0.6rem;
    }
}

.crm-course-shell {
    display: grid;
    gap: 1rem;
}

.crm-course-hero {
    padding: 1.4rem 1.5rem;
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.crm-course-title {
    font-size: clamp(1.9rem, 2.8vw, 2.55rem);
    color: #0f172a;
}

.crm-course-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.48rem 0.9rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.crm-course-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.1rem;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.crm-course-toolbar-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #475569;
    font-size: 0.84rem;
    font-weight: 600;
}

.crm-course-panel-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    position: sticky;
    top: 12px;
    z-index: 10;
}

.crm-course-panel-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #334155;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.crm-course-panel-link:hover,
.crm-course-panel-link.is-current {
    color: #0f172a;
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.18);
}

.crm-course-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.crm-course-kpi-card {
    border-width: 1px !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05) !important;
}

.crm-course-kpi-card .card-body {
    padding: 1.15rem 1.2rem;
}

.crm-course-table-card,
.crm-form-card {
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.05) !important;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
}

.crm-form-section-card {
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), #fff);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.crm-form-hint {
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.crm-course-fold,
.crm-course-module,
.crm-course-subfold {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.crm-course-fold > summary,
.crm-course-module > summary,
.crm-course-subfold > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.crm-course-fold > summary::-webkit-details-marker,
.crm-course-module > summary::-webkit-details-marker,
.crm-course-subfold > summary::-webkit-details-marker {
    display: none;
}

.crm-course-fold > summary {
    padding: 1rem 1.1rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
}

.crm-course-module > summary,
.crm-course-subfold > summary {
    padding: 0.85rem 1rem;
    background: rgba(248, 250, 252, 0.92);
}

.crm-course-fold > summary strong,
.crm-course-module > summary strong,
.crm-course-subfold > summary {
    color: #0f172a;
}

.crm-course-fold > summary span,
.crm-course-module > summary span {
    display: block;
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.9rem;
}

.crm-course-fold-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb !important;
    font-weight: 700;
    font-size: 0.82rem !important;
}

.crm-course-fold-body {
    padding: 1rem 1.1rem 1.15rem;
}

.crm-course-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.crm-course-lms-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
    gap: 1rem;
    align-items: start;
}

.crm-course-progress-panel {
    max-height: 70vh;
    overflow-y: auto;
}

.crm-course-followup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.crm-course-subfold > summary {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
}

.lms-config-shell {
    display: grid;
    gap: 1rem;
}

.lms-config-shell > .d-flex.justify-content-between.align-items-start.flex-wrap.gap-3.mb-4 {
    display: none !important;
}

.lms-config-hero {
    padding: 1.35rem 1.5rem;
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(220, 38, 38, 0.1), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
    border: 1px solid rgba(220, 38, 38, 0.12);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}

.lms-config-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.46rem 0.88rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(220, 38, 38, 0.14);
    color: #7f1d1d;
    font-weight: 700;
    font-size: 0.88rem;
}

.lms-config-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.lms-config-kpi-card,
.lms-config-side-card,
.lms-config-main-card {
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.05) !important;
}

.lms-config-kpi-card .card-body {
    padding: 1.15rem 1.2rem;
}

@media (max-width: 1199px) {
    .crm-course-kpis,
    .crm-course-top-grid,
    .crm-course-followup-grid,
    .lms-config-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-course-lms-grid {
        grid-template-columns: 1fr;
    }

    .crm-course-progress-panel {
        max-height: none;
    }
}

@media (max-width: 767px) {
    .crm-course-kpis,
    .crm-course-top-grid,
    .crm-course-followup-grid,
    .lms-config-kpis {
        grid-template-columns: 1fr;
    }

    .crm-course-fold > summary,
    .crm-course-module > summary {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Panel instructor LMS */
.lms-instructor-summary-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.lms-instructor-priority-main {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.lms-instructor-metric-card,
.lms-instructor-priority-card,
.lms-instructor-feed-card,
.lms-instructor-followup-card,
.lms-instructor-followup-column,
.lms-instructor-followup-item,
.lms-instructor-feed-item {
    background: #fff;
    border-color: #e7eef7 !important;
}

.lms-instructor-metric-card {
    padding: 1rem !important;
    box-shadow: 0 8px 22px rgba(15, 92, 192, 0.05);
}

.lms-instructor-metric-card .h3 {
    font-weight: 800;
    color: #1f2937;
}

.lms-instructor-priority-card {
    padding: 1rem !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lms-instructor-priority-card:hover,
.lms-instructor-feed-item:hover,
.lms-instructor-followup-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
}

.lms-instructor-feed-card,
.lms-instructor-followup-card,
.lms-instructor-followup-column {
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.lms-instructor-feed-item,
.lms-instructor-followup-item {
    padding: 0.85rem !important;
}

.lms-instructor-count-badge {
    border: 1px solid #dbe5f0;
    color: #334155 !important;
    font-weight: 700;
    background: #f8fafc !important;
}

.lms-instructor-activity-item {
    border-color: #edf2f7 !important;
}

.lms-instructor-action-row .btn,
.lms-instructor-inline-form .btn {
    min-width: 88px;
}

.lms-instructor-inline-form .form-control-sm {
    border-radius: 10px;
}

.lms-instructor-followup-column .fw-semibold,
.lms-instructor-feed-card .fw-semibold {
    color: #16263a;
}

@media (max-width: 991px) {
    .lms-instructor-metric-card,
    .lms-instructor-priority-card,
    .lms-instructor-feed-card,
    .lms-instructor-followup-card,
    .lms-instructor-followup-column {
        padding: 0.9rem !important;
    }

    .lms-instructor-action-row .btn,
    .lms-instructor-inline-form .btn {
        min-width: 0;
    }
}
