:root {
    --primary-color: #003366;
    --secondary-color: #00509E;
    --background-color: #f4f6f9;
    --text-color: #333333;
    --border-color: #dddddd;
    --card-bg: #ffffff;
    --error-color: #d9534f;
    --success-color: #5cb85c;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.layout-with-sidebar {
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: linear-gradient(180deg, #003366 0%, #0b2743 100%);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    box-shadow: 6px 0 24px rgba(15, 23, 42, 0.16);
    transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1030;
}

.sidebar-header,
.sidebar-footer {
    padding: 1rem 1rem 1.25rem;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #ffffff;
    text-decoration: none;
}

.sidebar-brand:hover,
.sidebar-brand:focus-visible {
    color: #ffffff;
    text-decoration: none;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 10px;
    background: #ffffff;
    padding: 0.35rem;
}

.sidebar-brand-text {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(226, 232, 240, 0.75);
    padding: 0 0.75rem 0.75rem;
}

.sidebar-link,
.sidebar-sublink,
.sidebar-logout {
    width: 100%;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible,
.sidebar-sublink:hover,
.sidebar-sublink:focus-visible,
.sidebar-logout:hover,
.sidebar-logout:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-link.is-active,
.sidebar-sublink.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #93c5fd;
}

.sidebar-link-content {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sidebar-submenu-toggle {
    justify-content: space-between;
}

.sidebar-icon,
.sidebar-subicon {
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-caret {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-submenu-toggle[aria-expanded="true"] .sidebar-caret {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: grid;
    gap: 0.35rem;
    padding: 0.35rem 0 0.5rem 2.75rem;
}

.sidebar-submenu[hidden] {
    display: none;
}

.sidebar-sublink {
    font-size: 0.95rem;
    padding: 0.65rem 0.9rem;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user {
    margin-bottom: 0.85rem;
}

.sidebar-user-name {
    font-weight: 600;
    color: #ffffff;
}

.sidebar-user-role {
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.88rem;
    word-break: break-word;
}

.sidebar-logout {
    justify-content: flex-start;
}

.app-main {
    min-height: 100vh;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #ffffff;
    border-bottom: 1px solid #dbe4ee;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-topbar-left,
.app-topbar-right,
.app-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.app-topbar-brand {
    color: var(--primary-color);
    text-decoration: none;
    min-width: 0;
}

.app-topbar-brand:hover,
.app-topbar-brand:focus-visible {
    text-decoration: none;
}

.app-topbar-title {
    font-weight: 700;
    color: var(--primary-color);
}

.app-topbar-user {
    color: #475569;
    font-weight: 600;
    text-align: right;
}

.sidebar-icon-button {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--primary-color);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-icon-button:hover,
.sidebar-icon-button:focus-visible {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--primary-color);
}

.app-content {
    flex: 1;
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
}

.layout-with-sidebar .alerts {
    max-width: none;
}

body.sidebar-collapsed .app-sidebar {
    width: 92px;
}

body.sidebar-collapsed .app-main {
    margin-left: 92px;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-user,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-caret {
    display: none;
}

body.sidebar-collapsed .sidebar-submenu {
    display: none;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-logout,
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header {
    background-color: #777777; 
    padding: 10px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-bottom: 3px solid var(--secondary-color);
}

.logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 75px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.03);
}

header nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

header nav a, 
header nav button {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s ease;
}

header nav a:hover,
header nav button:hover,
header nav a:focus-visible,
header nav button:focus-visible {
    color: #93c5fd;
    text-decoration: none;
    outline: none;
}

header nav button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* ==========================================================================
   Main Layout
   ========================================================================== */
main {
    flex: 1;
    padding: 40px 5%;
    display: flex;
    flex-direction: column;
}

/* Auth Cards (Tarjetas de login/registro, centradas) */
main > .card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

main > .card h2 {
    color: var(--primary-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* ==========================================================================
   Forms & Inputs (WCAG Compliant)
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #475569;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 80, 158, 0.25); /* Indicador de foco accesible */
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-right: 0.5rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    color: #475569;
    font-size: 0.95rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
    display: inline-block;
    width: 100%;
}

.btn-primary:hover, 
.btn-primary:focus-visible {
    background-color: var(--secondary-color);
    color: #ffffff;
    outline: none;
}

.btn-primary:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alerts {
    margin: 0 auto 1.5rem auto;
    width: 100%;
    max-width: 450px;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-left: 4px solid; /* Borde izquierdo para accesibilidad visual */
}

.alert-danger { background-color: #fee2e2; color: #991b1b; border-color: #ef4444; }
.alert-success { background-color: #dcfce7; color: #166534; border-color: #22c55e; }
.alert-warning { background-color: #fef9c3; color: #854d0e; border-color: #eab308; }
.alert-info { background-color: #e0f2fe; color: #075985; border-color: #0ea5e9; }

.form-errors {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }

/* Enlaces generales */
a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover, a:focus-visible {
    color: var(--primary-color);
    text-decoration: underline;
    outline: none;
}

/* ==========================================================================
   Responsive Adjustments (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    .header-logo {
        height: 60px;
    }

    header nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    header nav a, header nav button {
        font-size: 0.95rem;
    }

    main {
        padding: 20px 15px;
    }

    main > .card {
        padding: 1.5rem;
        border-radius: 8px;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: min(86vw, 320px);
    }

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

    body.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .app-topbar {
        padding: 0.9rem 1rem;
    }

    .app-content {
        padding: 1rem;
    }

    .app-topbar-title,
    .app-topbar-user {
        font-size: 0.95rem;
    }

    .app-topbar-user {
        display: none;
    }
}

/* ==========================================================================\n+   Sistema visual compartido MarIA\n+   ========================================================================== */
:root {
    --maria-primary: #1459d9;
    --maria-primary-dark: #0d3f9f;
    --maria-ink: #16243a;
    --maria-muted: #607089;
    --maria-surface: #ffffff;
    --maria-surface-soft: #f7f9fc;
    --maria-border: #dbe3ef;
    --maria-radius: 14px;
    --maria-radius-sm: 10px;
    --maria-shadow: 0 12px 30px rgba(19, 42, 78, 0.08);
    --maria-focus: 0 0 0 3px rgba(20, 89, 217, 0.18);
}

body {
    background: #f4f7fb;
    color: var(--maria-ink);
}

body.layout-with-sidebar > header,
body.layout-with-sidebar > main {
    background: transparent;
}

body.layout-with-sidebar .app-content {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
}

body.layout-with-sidebar .app-content > .container-fluid,
body.layout-with-sidebar .app-content > .container {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.layout-with-sidebar h1,
body.layout-with-sidebar h2,
body.layout-with-sidebar h3,
body.layout-with-sidebar h4,
body.layout-with-sidebar h5 {
    color: var(--maria-ink);
    letter-spacing: -0.02em;
}

body.layout-with-sidebar .card,
body.layout-with-sidebar .modal-content,
body.layout-with-sidebar .list-group,
body.layout-with-sidebar .table-responsive,
body.layout-with-sidebar .correo-card {
    border-color: var(--maria-border);
    border-radius: var(--maria-radius);
    box-shadow: var(--maria-shadow);
}

body.layout-with-sidebar .form-control,
body.layout-with-sidebar .form-select,
body.layout-with-sidebar textarea,
body.layout-with-sidebar input[type="text"],
body.layout-with-sidebar input[type="email"],
body.layout-with-sidebar input[type="password"],
body.layout-with-sidebar input[type="number"],
body.layout-with-sidebar input[type="date"],
body.layout-with-sidebar input[type="datetime-local"] {
    border-color: var(--maria-border);
    border-radius: var(--maria-radius-sm);
    min-height: 2.7rem;
}

body.layout-with-sidebar .form-control:focus,
body.layout-with-sidebar .form-select:focus,
body.layout-with-sidebar textarea:focus,
body.layout-with-sidebar input:focus {
    border-color: var(--maria-primary);
    box-shadow: var(--maria-focus);
}

body.layout-with-sidebar .btn {
    border-radius: var(--maria-radius-sm);
    font-weight: 600;
    min-height: 2.55rem;
}

body.layout-with-sidebar .btn-primary {
    background: var(--maria-primary);
    border-color: var(--maria-primary);
}

body.layout-with-sidebar .btn-primary:hover,
body.layout-with-sidebar .btn-primary:focus-visible {
    background: var(--maria-primary-dark);
    border-color: var(--maria-primary-dark);
}

body.layout-with-sidebar .table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

body.layout-with-sidebar .table thead th {
    background: var(--maria-surface-soft);
    border-bottom-color: var(--maria-border);
    color: var(--maria-muted);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

body.layout-with-sidebar .table tbody tr {
    transition: background-color 0.18s ease;
}

body.layout-with-sidebar .table tbody tr:hover {
    --bs-table-bg-type: #f8fbff;
}

body.layout-with-sidebar .breadcrumb {
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--maria-border);
    border-radius: var(--maria-radius-sm);
}

body.layout-with-sidebar .alert {
    border-radius: var(--maria-radius-sm);
}

body.layout-with-sidebar :where(button, a, input, select, textarea):focus-visible {
    outline: 3px solid rgba(20, 89, 217, 0.28);
    outline-offset: 2px;
}

/* Evita que las reglas heredadas de la landing alteren el shell autenticado. */
body.layout-with-sidebar > header,
body.layout-with-sidebar > main {
    padding: 0;
    display: block;
}

@media (max-width: 767.98px) {
    .app-topbar-brand .header-logo {
        width: 34px;
        height: 34px;
    }

    .app-topbar-title {
        max-width: 48vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.layout-with-sidebar .app-content {
        padding: 0.8rem 0.75rem 1.5rem;
    }

    body.layout-with-sidebar .modal-dialog {
        margin: 0.5rem;
    }

    body.layout-with-sidebar .modal-body {
        padding: 1rem;
    }

    body.layout-with-sidebar .table-responsive {
        box-shadow: none;
    }
}

/* Consistencia visual y responsive para colaboración y administración */
.chat-workspace {
    max-width: 1500px;
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 2rem);
}

.chat-workspace .page-section-header,
.user-admin-shell > .d-flex:first-child {
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--maria-border);
    border-radius: var(--maria-radius);
    background: linear-gradient(135deg, #fff 0%, #f5f8ff 100%);
    box-shadow: var(--maria-shadow);
}

.chat-page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 1rem 0;
    padding: .5rem;
    border: 1px solid var(--maria-border);
    border-radius: var(--maria-radius-sm);
    background: rgba(255, 255, 255, .82);
}

.chat-page-nav .btn.is-active {
    color: #fff;
    background: var(--maria-primary);
    border-color: var(--maria-primary);
    box-shadow: 0 6px 14px rgba(20, 89, 217, .18);
}

.chat-layout,
.chat-single-layout {
    border: 1px solid var(--maria-border);
    border-radius: var(--maria-radius);
    background: var(--maria-surface);
    box-shadow: var(--maria-shadow);
    overflow: hidden;
}

.chat-single-layout .chat-secondary-section__header {
    padding: 1rem 1.25rem;
    background: var(--maria-surface-soft);
    border-bottom: 1px solid var(--maria-border);
}

.chat-single-layout .chat-secondary-section__body {
    padding: clamp(.75rem, 2vw, 1.5rem);
}

.user-admin-shell .card,
.user-admin-shell .modal-content {
    border: 1px solid var(--maria-border) !important;
    border-radius: var(--maria-radius) !important;
    box-shadow: var(--maria-shadow) !important;
}

.user-admin-shell .card-header,
.user-admin-shell .modal-header {
    background: linear-gradient(135deg, #fff, #f5f8ff) !important;
    border-bottom-color: var(--maria-border);
}

.user-admin-shell .table thead th {
    color: var(--maria-muted);
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.user-admin-shell .table tbody tr { transition: background .18s ease; }
.user-admin-shell .table tbody tr:hover { background: #f7faff; }
.user-admin-shell .modal-body { padding: clamp(1rem, 2vw, 1.5rem); }
.user-admin-shell .imap-account-picker {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--maria-border);
    border-radius: .75rem;
    background: var(--maria-surface, #fff);
}

.user-admin-shell .imap-account-picker__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--maria-border);
    background: #f8faff;
}

.user-admin-shell .imap-account-picker__options {
    display: grid;
    gap: .5rem;
    max-height: 13rem;
    padding: .65rem;
    overflow-y: auto;
}

.user-admin-shell .imap-account-option {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .7rem .8rem;
    border: 1px solid var(--maria-border);
    border-radius: .65rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.user-admin-shell .imap-account-option:hover { background: #f7faff; }
.user-admin-shell .imap-account-option:has(input:checked) {
    border-color: var(--maria-primary);
    background: #eef4ff;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--maria-primary) 20%, transparent);
}
.user-admin-shell .imap-account-option:has(input:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--maria-primary) 30%, transparent);
    outline-offset: 2px;
}
.user-admin-shell .imap-account-option__content { display: grid; min-width: 0; margin-right: auto; }
.user-admin-shell .imap-account-option__name { color: var(--maria-text); font-weight: 600; }
.user-admin-shell .imap-account-option__email { overflow: hidden; color: var(--maria-muted); font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 767.98px) {
    .chat-workspace { padding: .75rem; }
    .chat-workspace .page-section-header { align-items: flex-start; }
    .chat-workspace .page-actions { width: 100%; }
    .chat-workspace .page-actions .btn { width: 100%; }
    .chat-page-nav { overflow-x: auto; flex-wrap: nowrap; }
    .chat-page-nav .btn { flex: 1 0 auto; }
    .user-admin-shell { padding-inline: .75rem !important; }
    .user-admin-shell > .d-flex:first-child .btn { flex: 1 1 100%; }
}

/* Shell público: login, registro y recuperación con la misma identidad visual. */
body:not(.layout-with-sidebar) > header {
    min-height: 74px;
    padding: 0.85rem clamp(1rem, 5vw, 4rem);
    background: linear-gradient(135deg, #07346b 0%, #1459d9 100%);
    border-bottom: 0;
    box-shadow: 0 8px 24px rgba(7, 52, 107, 0.2);
}

body:not(.layout-with-sidebar) > header .header-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #ffffff;
    padding: 0.25rem;
}

body:not(.layout-with-sidebar) > header nav {
    gap: 0.55rem;
}

body:not(.layout-with-sidebar) > header nav a {
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    color: #eef5ff;
}

body:not(.layout-with-sidebar) > header nav a:hover,
body:not(.layout-with-sidebar) > header nav a:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    text-decoration: none;
}

body:not(.layout-with-sidebar) > main {
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 74px);
    padding: clamp(1.25rem, 4vw, 3rem) 1rem;
    background: radial-gradient(circle at top right, rgba(20, 89, 217, 0.08), transparent 38rem);
}

body:not(.layout-with-sidebar) > main > .card {
    max-width: 500px;
    border: 1px solid var(--maria-border);
    border-radius: 18px;
    box-shadow: var(--maria-shadow);
}

body:not(.layout-with-sidebar) > main .alerts {
    max-width: 500px;
}

/* === Módulo Correo Interno (index.html) === */

    .correo-card {
        border-radius: 16px;
        border: 0;
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    }

    .correo-table td,
    .correo-table th {
        vertical-align: middle;
    }

    .mail-preview {
        max-width: 420px;
        white-space: normal;
        color: #5b6472;
    }

/* === Módulo Correo Interno (detail.html) === */

    .correo-detail-card {
        border-radius: 16px;
        border: 0;
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    }

    .correo-body-box {
        white-space: pre-wrap;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 1rem;
        min-height: 220px;
    }

/* === Módulo Correo Interno (editor.html) === */

    /* Estilos Generales del Editor */
    .action-bar {
        background: #ffffff;
        padding: 15px 20px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        border: 1px solid #e2e8f0;
        margin-bottom: 20px;
    }

    .editor-workspace {
        background-color: #f8fafc;
        border-radius: 12px;
        padding: 20px;
        border: 1px solid #e2e8f0;
    }

    /* Hoja de papel (Estilo Documento) */
    .paper-sheet {
        background-color: #ffffff;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05), 0 4px 10px rgba(0, 0, 0, 0.03);
        padding: 40px;
        border-radius: 4px;
        min-height: 60vh;
        border: 1px solid #cbd5e1;
        margin-bottom: 20px;
    }

    .paper-textarea {
        width: 100%;
        min-height: 55vh;
        border: none;
        resize: vertical;
        outline: none;
        font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        font-size: 1.05rem;
        line-height: 1.6;
        color: #1e293b;
        background: transparent;
    }

    .paper-textarea:focus {
        box-shadow: none;
        outline: none;
    }

    /* Caja de Comentarios inferior */
    .comment-box {
        background: #ffffff;
        border-radius: 8px;
        padding: 15px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    /* Vista de Comparación (Diff) */
    .diff-view {
        white-space: pre-wrap;
        font-family: monospace;
        background: #ffffff;
        padding: 0;
        border-radius: 0;
        border: none;
        font-size: 1.05rem;
        line-height: 1.6;
        color: #1e293b;
    }
    .diff-view del { 
        background-color: #fecaca; 
        text-decoration: line-through; 
        padding: 2px 4px;
        border-radius: 3px;
    }
    .diff-view ins { 
        background-color: #bbf7d0; 
        text-decoration: none; 
        padding: 2px 4px;
        border-radius: 3px;
    }

    /* Historial Timeline */
    .version-sidebar {
        max-height: 75vh;
        overflow-y: auto;
        padding-right: 10px;
    }
    
    .version-sidebar::-webkit-scrollbar { width: 6px; }
    .version-sidebar::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
    .version-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

    .timeline {
        position: relative;
        padding-left: 1.5rem;
        margin-top: 1rem;
        border-left: 2px solid #e2e8f0;
    }

    .timeline-item {
        position: relative;
        margin-bottom: 1.5rem;
        padding: 15px;
        background: #ffffff;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02);
        transition: all 0.2s ease;
    }

    .timeline-item:hover {
        border-color: #cbd5e1;
        box-shadow: 0 4px 6px rgba(0,0,0,0.04);
    }

    .timeline-item.active {
        border-color: #3b82f6;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    }

    .timeline-marker {
        position: absolute;
        left: -2.35rem;
        top: 1rem;
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 50%;
        background: #ffffff;
        border: 3px solid #e2e8f0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1;
    }

    .timeline-item.active .timeline-marker {
        border-color: #3b82f6;
        background: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    }

    .timeline-item.active .timeline-marker i { color: white; font-size: 0.7rem; }
    .timeline-marker i { color: #94a3b8; font-size: 0.7rem; }

/* === Dashboard principal (dashboard.html) === */

.dashboard-page {
    padding-top: 0.25rem;
}

.dashboard-hero,
.dashboard-filters,
.dashboard-widget {
    border-radius: 18px;
}

.dashboard-kicker {
    display: inline-block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.dashboard-title {
    color: var(--primary-color);
    font-weight: 700;
}

.dashboard-subtitle {
    max-width: 60rem;
    color: #5b6472;
}

.dashboard-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #dbe4ee;
}

.dashboard-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.dashboard-widget {
    grid-column: span 12;
}

.dashboard-widget[data-widget-id="summary"],
.dashboard-widget[data-widget-id="notifications"] {
    grid-column: span 12;
}

.dashboard-widget-actions {
    display: inline-flex;
    gap: 0.5rem;
}

.dashboard-widget:focus-visible {
    outline: 3px solid rgba(0, 80, 158, 0.28);
    outline-offset: 4px;
}

.dashboard-summary-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard-summary-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 16px;
}

.dashboard-summary-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #dbe4ee;
    font-size: 1.1rem;
}

.dashboard-summary-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #0f172a;
}

.dashboard-summary-label {
    color: #5b6472;
    font-size: 0.92rem;
}

.dashboard-chart-list {
    display: grid;
    gap: 1rem;
}

.dashboard-progress {
    height: 0.7rem;
    background: #e2e8f0;
}

.dashboard-progress .progress-bar {
    background: linear-gradient(90deg, #003366 0%, #00509e 100%);
}

.dashboard-notifications-list {
    display: grid;
    gap: 0.85rem;
}

.dashboard-notification-item {
    background: #f8fafc;
}

.dashboard-loading-state {
    display: none;
}

.dashboard-loading-state.is-visible {
    display: block;
}

.dashboard-loading-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard-skeleton {
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
    border-radius: 16px;
}

.dashboard-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: dashboardShimmer 1.5s infinite;
}

.dashboard-skeleton-card {
    min-height: 120px;
}

.dashboard-skeleton-panel {
    min-height: 260px;
}

@keyframes dashboardShimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (min-width: 1200px) {
    .dashboard-widget[data-widget-id="summary"] {
        grid-column: span 7;
    }

    .dashboard-widget[data-widget-id="notifications"] {
        grid-column: span 5;
    }

    .dashboard-widget[data-widget-id="charts"],
    .dashboard-widget[data-widget-id="recent"] {
        grid-column: span 12;
    }
}

@media (max-width: 767.98px) {
    .dashboard-hero .btn,
    .dashboard-filters .btn {
        width: 100%;
    }

    .dashboard-chip {
        width: 100%;
        justify-content: flex-start;
    }
}

/* === Modulo Chat Interno (chat/) === */

.page-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    color: var(--primary-color);
    font-weight: 700;
}

.eyebrow {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.chat-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
}

.chat-main-stack {
    display: grid;
    gap: 1.5rem;
}

.chat-single-layout {
    display: grid;
    gap: 1.5rem;
}

.chat-navigation-section,
.chat-primary-section,
.chat-secondary-section {
    display: grid;
    gap: 1rem;
    padding: 1.1rem 1.2rem 1.2rem;
    border-radius: 20px;
    border: 1px solid #dbe4ee;
    background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.chat-navigation-section__header,
.chat-primary-section__header,
.chat-secondary-section__header {
    display: grid;
    gap: 0.35rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #dbe4ee;
}

.chat-navigation-section .sidebar-section-title,
.chat-primary-section .sidebar-section-title,
.chat-secondary-section .sidebar-section-title {
    padding: 0;
    color: #475569;
}

.chat-navigation-section__body,
.chat-primary-section__body,
.chat-secondary-section__body {
    display: grid;
    gap: 1rem;
}

.chat-support-nav,
.chat-inline-navigation,
.chat-sidebar-shortcuts,
.chat-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.chat-sidebar-shortcuts {
    padding: 0.85rem 1rem 0;
}

.chat-sidebar-shortcuts .btn,
.chat-inline-navigation .btn,
.chat-support-nav .btn {
    width: auto;
}

.chat-support-panel-slot[hidden] {
    display: none;
}

.chat-panel-intro {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.55;
}

.chat-navigation-section .chat-sidebar,
.chat-primary-section .chat-panel {
    box-shadow: none;
    background: transparent;
}

.chat-secondary-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 991.98px) {
    .chat-secondary-grid {
        grid-template-columns: 1fr;
    }
}

.chat-sidebar,
.chat-panel,
.chat-task-panel,
.chat-calendar-panel {
    border: 0;
    border-radius: 18px;
}

.chat-sidebar-header,
.chat-section-header,
.chat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.chat-panel-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-search-form {
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.chat-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.chat-conversation-list {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.chat-conversation-item {
    display: grid;
    gap: 0.45rem;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid #dbe4ee;
    background: #ffffff;
    color: inherit;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.chat-conversation-item:hover,
.chat-conversation-item:focus-visible {
    color: inherit;
    text-decoration: none;
    border-color: #93c5fd;
    box-shadow: 0 10px 22px rgba(14, 116, 144, 0.08);
}

.chat-conversation-item.is-active {
    border-color: #60a5fa;
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.chat-conversation-item__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.chat-conversation-title {
    font-weight: 700;
    color: #0f172a;
}

.chat-participant-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-participant-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.88rem;
    font-weight: 600;
}

.chat-message-toolbar,
.chat-calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chat-message-list {
    min-height: 360px;
    max-height: 58vh;
    overflow-y: auto;
    display: grid;
    gap: 0.9rem;
    padding: 0.25rem;
}

.chat-message {
    max-width: min(82%, 760px);
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 18px 18px 18px 6px;
    background: #ffffff;
    border: 1px solid #dbe4ee;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.chat-message.is-own {
    margin-left: auto;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
    border-radius: 18px 18px 6px 18px;
}

.chat-message__meta,
.chat-task-card__header,
.chat-task-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chat-message__meta {
    font-size: 0.82rem;
    color: #64748b;
}

.chat-message__reply {
    padding: 0.65rem 0.75rem;
    border-left: 3px solid #60a5fa;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #475569;
    font-size: 0.9rem;
}

.chat-message__body,
.chat-task-card__description {
    margin: 0;
    color: #1e293b;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================
   ESTILOS PARA ELEMENTOS ESTRUCTURADOS EN CHAT
   Soporte para tablas, listas, negritas, cursivas, código
   ============================================ */

/* Contenedor para el contenido HTML renderizado */
.chat-message__body .chat-message-content,
.chat-task-card__description .chat-message-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Tablas responsivas */
.chat-message__body .chat-message-content table,
.chat-task-card__description .chat-message-content table {
    width: auto;
    max-width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.875rem;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-message__body .chat-message-content table thead,
.chat-task-card__description .chat-message-content table thead {
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
}

.chat-message__body .chat-message-content table th,
.chat-task-card__description .chat-message-content table th {
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    color: #334155;
    text-align: left;
    white-space: nowrap;
}

.chat-message__body .chat-message-content table td,
.chat-task-card__description .chat-message-content table td {
    padding: 0.5rem 0.75rem;
    color: #475569;
    border-top: 1px solid #e2e8f0;
    vertical-align: top;
}

.chat-message__body .chat-message-content table tbody tr:hover,
.chat-task-card__description .chat-message-content table tbody tr:hover {
    background: #f8fafc;
}

/* Scroll horizontal para tablas en pantallas pequeñas */
.chat-message__body .chat-message-content .table-wrapper,
.chat-task-card__description .chat-message-content .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75rem 0;
    border-radius: 6px;
}

/* Listas con sangría correcta */
.chat-message__body .chat-message-content ul,
.chat-message__body .chat-message-content ol,
.chat-task-card__description .chat-message-content ul,
.chat-task-card__description .chat-message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    text-align: left;
}

.chat-message__body .chat-message-content ul,
.chat-task-card__description .chat-message-content ul {
    list-style-type: disc;
}

.chat-message__body .chat-message-content ol,
.chat-task-card__description .chat-message-content ol {
    list-style-type: decimal;
}

.chat-message__body .chat-message-content li,
.chat-task-card__description .chat-message-content li {
    margin-bottom: 0.35rem;
    padding-left: 0.25rem;
    line-height: 1.5;
}

.chat-message__body .chat-message-content li::marker,
.chat-task-card__description .chat-message-content li::marker {
    color: #64748b;
    font-weight: 600;
}

/* Listas anidadas */
.chat-message__body .chat-message-content ul ul,
.chat-message__body .chat-message-content ol ol,
.chat-message__body .chat-message-content ul ol,
.chat-message__body .chat-message-content ol ul,
.chat-task-card__description .chat-message-content ul ul,
.chat-task-card__description .chat-message-content ol ol,
.chat-task-card__description .chat-message-content ul ol,
.chat-task-card__description .chat-message-content ol ul {
    margin: 0.25rem 0;
    padding-left: 1.25rem;
}

/* Negritas y cursivas */
.chat-message__body .chat-message-content strong,
.chat-message__body .chat-message-content b,
.chat-task-card__description .chat-message-content strong,
.chat-task-card__description .chat-message-content b {
    font-weight: 700;
    color: #0f172a;
}

.chat-message__body .chat-message-content em,
.chat-message__body .chat-message-content i,
.chat-task-card__description .chat-message-content em,
.chat-task-card__description .chat-message-content i {
    font-style: italic;
}

/* Código en línea */
.chat-message__body .chat-message-content code,
.chat-task-card__description .chat-message-content code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    word-break: break-all;
}

/* Bloques de código */
.chat-message__body .chat-message-content pre,
.chat-task-card__description .chat-message-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-message__body .chat-message-content pre code,
.chat-task-card__description .chat-message-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    word-break: normal;
}

/* Citas/blockquotes */
.chat-message__body .chat-message-content blockquote,
.chat-task-card__description .chat-message-content blockquote {
    border-left: 4px solid #60a5fa;
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    background: #eff6ff;
    color: #475569;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

/* Separadores horizontales */
.chat-message__body .chat-message-content hr,
.chat-task-card__description .chat-message-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1rem 0;
}

/* Enlaces */
.chat-message__body .chat-message-content a,
.chat-task-card__description .chat-message-content a {
    color: #2563eb;
    text-decoration: underline;
    word-break: break-word;
}

.chat-message__body .chat-message-content a:hover,
.chat-task-card__description .chat-message-content a:hover {
    color: #1d4ed8;
}

/* Imágenes responsivas */
.chat-message__body .chat-message-content img,
.chat-task-card__description .chat-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.chat-message__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-attachment-actions {
    display: inline-flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.chat-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #dbe4ee;
    color: #0f172a;
    font-size: 0.88rem;
}

.chat-attachment-chip:hover,
.chat-attachment-chip:focus-visible {
    text-decoration: none;
    color: #0f172a;
    border-color: #93c5fd;
    background: #eff6ff;
}

.chat-message__seen {
    font-size: 0.82rem;
    color: #64748b;
}

.chat-composer {
    display: grid;
    gap: 0.85rem;
}

.chat-composer textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.chat-composer__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chat-composer[aria-busy="true"] {
    opacity: 0.78;
}

.chat-composer__status {
    min-height: 1.25rem;
}

.chat-upload-preview-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:.75rem}.chat-upload-preview{min-width:0;padding:.75rem;border:1px solid #dbe4ee;border-radius:.75rem;background:#f8fafc}.chat-upload-preview__header{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:.5rem;margin-bottom:.65rem}.chat-upload-preview__header strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.82rem}.chat-upload-preview__header span{font-size:.75rem;color:#64748b}.chat-upload-preview img,.chat-upload-preview video,.chat-upload-preview__pdf{display:block;width:100%;max-height:180px;border:0;border-radius:.5rem;background:#fff;object-fit:contain}.chat-upload-preview__pdf{height:180px}.chat-upload-preview audio{width:100%}.chat-upload-preview__text{max-height:180px;margin:0;overflow:auto;white-space:pre-wrap;font-size:.76rem;background:#fff;border-radius:.5rem;padding:.5rem}.chat-audio-recorder{display:inline-flex;align-items:center;gap:.35rem;flex-wrap:wrap}.chat-audio-recorder button{display:inline-flex;align-items:center;gap:.35rem}.chat-audio-recorder__duration{min-width:3rem;font-variant-numeric:tabular-nums;font-size:.8rem}.chat-audio-recorder__level{width:4rem;height:.5rem}@media(max-width:575.98px){.chat-composer__actions{align-items:stretch}.chat-composer__actions>div,.chat-audio-recorder{width:100%}.chat-audio-recorder button{flex:1;justify-content:center}.chat-upload-preview-grid{grid-template-columns:1fr}}

.chat-composer button[data-loading="true"] {
    cursor: wait;
}

.chat-call-preflight-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.chat-call-camera{display:block;width:100%;min-height:180px;border-radius:.75rem;background:#111827;object-fit:cover}.chat-call-readiness-list{display:grid;gap:.5rem;margin:0;padding:0;list-style:none}.chat-call-readiness{padding:.6rem .75rem;border:1px solid #dbe4ee;border-radius:.5rem;font-size:.88rem}.chat-call-readiness.is-disponible{border-color:#86efac;background:#f0fdf4}.chat-call-readiness.is-pendiente{border-color:#93c5fd;background:#eff6ff}.chat-call-readiness.is-en_llamada,.chat-call-readiness.is-desconectado,.chat-call-readiness.is-no_preparado{border-color:#fecaca;background:#fef2f2}@media(max-width:575.98px){.chat-call-preflight-grid{grid-template-columns:1fr}}
.chat-call-invitation{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:0 0 1rem;padding:.75rem 1rem;border:1px solid #bfdbfe;border-radius:.75rem;background:#eff6ff}.chat-call-invitation span{display:block;font-size:.86rem;color:#475569}@media(max-width:575.98px){.chat-call-invitation{align-items:stretch;flex-direction:column}.chat-call-invitation .btn{flex:1}}
.chat-call-remote-videos{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.75rem}.chat-call-remote-videos video{width:100%;min-height:130px;border-radius:.65rem;background:#111827;object-fit:cover}
.chat-call-remote-card{display:grid;gap:.45rem}.chat-call-remote-card__controls{display:flex;gap:.4rem;flex-wrap:wrap}

.chat-audio-message{display:grid;gap:.35rem;min-width:min(100%,20rem);padding:.65rem;border:1px solid #bfdbfe;border-radius:.65rem;background:#eff6ff}.chat-audio-message__label{display:flex;align-items:center;gap:.4rem;color:#1d4ed8;font-size:.8rem;font-weight:700}.chat-audio-message audio{width:100%;min-width:0;height:2.2rem}.chat-my-tasks-panel{margin-top:1rem}.chat-my-task-list{display:grid;gap:.6rem;margin-top:1rem}.chat-my-task-item{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.7rem .8rem;border:1px solid #dbe4ee;border-radius:.65rem;background:#fff}.chat-my-task-item strong,.chat-my-task-item span{display:block}.chat-my-task-item span{margin-top:.15rem;color:#64748b;font-size:.82rem}@media(max-width:575.98px){.chat-my-task-item{align-items:stretch;flex-direction:column}.chat-my-task-item .btn{width:100%}}
.chat-voice-message{display:grid;grid-template-columns:auto auto minmax(9rem,1fr);align-items:center;gap:.6rem;min-width:min(100%,20rem);padding:.6rem .7rem;border:1px solid #bfdbfe;border-radius:1rem;background:linear-gradient(135deg,#eff6ff,#fff)}.chat-voice-message__label{grid-column:1/-1;color:#1d4ed8;font-size:.72rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase}.chat-voice-message__play{display:grid;place-items:center;width:2.5rem;height:2.5rem;padding:0;border:0;border-radius:50%;background:#2563eb;color:#fff;box-shadow:0 .25rem .6rem rgba(37,99,235,.25)}.chat-voice-message__play:hover{background:#1d4ed8}.chat-voice-message__play:focus-visible{outline:3px solid #93c5fd;outline-offset:2px}.chat-voice-message__detail{display:grid;gap:.35rem;min-width:0}.chat-voice-message__timeline{width:100%;height:.75rem;margin:0;accent-color:#2563eb;cursor:pointer;background:repeating-linear-gradient(90deg,#bfdbfe 0 2px,transparent 2px 5px);border-radius:999px}.chat-voice-message__timeline:disabled{cursor:progress;opacity:.55}.chat-voice-message__meta{display:flex;justify-content:space-between;gap:.5rem;color:#64748b;font-size:.72rem}.chat-voice-message__meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:575.98px){.chat-voice-message{grid-template-columns:auto minmax(0,1fr);min-width:100%}.chat-voice-message__detail{grid-column:2}.chat-voice-message__label{grid-column:1/-1}}
.chat-floating-widget{position:fixed;z-index:1060;right:max(1rem,env(safe-area-inset-right));bottom:max(1rem,env(safe-area-inset-bottom));width:min(22rem,calc(100vw - 2rem));font-size:.9rem}.chat-floating-widget__toggle{display:flex;align-items:center;gap:.5rem;margin-left:auto;padding:.7rem 1rem;border:0;border-radius:999px;background:#1d4ed8;color:#fff;font-weight:700;box-shadow:0 .6rem 1.75rem rgba(15,23,42,.25)}.chat-floating-widget__toggle:focus-visible{outline:3px solid #93c5fd;outline-offset:3px}.chat-floating-widget__badge{display:grid;place-items:center;min-width:1.35rem;height:1.35rem;padding:0 .25rem;border-radius:999px;background:#dc2626;color:#fff;font-size:.7rem}.chat-floating-widget__panel{margin-top:.65rem;padding:.85rem;border:1px solid #dbe4ee;border-radius:1rem;background:#fff;box-shadow:0 .9rem 2.5rem rgba(15,23,42,.22)}.chat-floating-widget__panel[hidden]{display:none}.chat-floating-widget__panel header{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem}.chat-floating-widget__panel header strong,.chat-floating-widget__panel header span{display:block}.chat-floating-widget__panel header span{margin-top:.15rem;color:#64748b;font-size:.78rem}.chat-floating-widget__settings{display:grid;grid-template-columns:auto auto 1fr;align-items:center;gap:.45rem;margin:.75rem 0;padding:.55rem 0;border-block:1px solid #e2e8f0;color:#475569;font-size:.78rem}.chat-floating-widget__settings input[type=range]{width:100%;accent-color:#2563eb}.chat-floating-widget__list{display:grid;gap:.5rem;max-height:17rem;overflow:auto}.chat-floating-widget__item{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.5rem;padding:.6rem;border:1px solid #e2e8f0;border-radius:.65rem}.chat-floating-widget__item a{min-width:0;color:inherit;text-decoration:none}.chat-floating-widget__item a:hover strong{text-decoration:underline}.chat-floating-widget__item strong,.chat-floating-widget__item span{display:block}.chat-floating-widget__item span{overflow:hidden;color:#64748b;font-size:.76rem;text-overflow:ellipsis;white-space:nowrap}@media(max-width:575.98px){.chat-floating-widget{bottom:max(.75rem,env(safe-area-inset-bottom));right:max(.75rem,env(safe-area-inset-right));width:calc(100vw - 1.5rem)}}
.chat-floating-widget__conversation{min-width:0;padding:0;border:0;background:transparent;text-align:left}.chat-floating-widget__conversation:hover strong{text-decoration:underline}.chat-floating-widget__unread{display:grid;place-items:center;min-width:1.3rem;height:1.3rem;border-radius:999px;background:#dbeafe!important;color:#1d4ed8!important;font-weight:700}.chat-floating-widget__conversation-header{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.chat-floating-widget__call-actions{display:flex;gap:.3rem}.chat-floating-widget__call-picker{display:grid;gap:.25rem;margin:.35rem 0;padding:.5rem;border:1px solid #dbe4ee;border-radius:.55rem;background:#f8fafc;font-size:.75rem}.chat-floating-widget__call-picker select{min-height:4.75rem}.chat-floating-widget__call-stage{display:grid;gap:.45rem;margin:.45rem 0;padding:.5rem;border:1px solid #bfdbfe;border-radius:.65rem;background:#eff6ff}.chat-floating-widget__call-stage>video{width:100%;max-height:8rem;border-radius:.45rem;background:#0f172a;object-fit:cover}.chat-call-remote-videos{display:grid;gap:.45rem}.chat-floating-widget__messages{display:grid;gap:.45rem;max-height:16rem;margin:.55rem 0;overflow:auto;overscroll-behavior:contain;padding:.1rem}.chat-floating-widget__message{display:grid;gap:.25rem;max-width:88%;padding:.5rem .6rem;border-radius:.65rem;background:#f1f5f9}.chat-floating-widget__message.is-own{justify-self:end;background:#dbeafe}.chat-floating-widget__message strong{font-size:.72rem}.chat-floating-widget__message span{font-size:.8rem;overflow-wrap:anywhere}.chat-floating-widget__attachment{display:flex;flex-wrap:wrap;align-items:center;gap:.15rem;border-top:1px solid #cbd5e1;padding-top:.3rem}.chat-floating-widget__attachment>span{width:100%;font-size:.72rem}.chat-floating-widget__composer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.45rem;align-items:end}.chat-floating-widget__composer textarea{resize:none}.chat-floating-widget__composer-tools{display:flex;gap:.3rem}.chat-floating-widget__audio-preview{grid-column:1/-1;display:grid;grid-template-columns:auto minmax(2rem,1fr) minmax(0,1fr) auto;align-items:center;gap:.35rem;padding:.35rem;border:1px solid #bfdbfe;border-radius:.5rem;background:#eff6ff}.chat-floating-widget__audio-preview audio{width:100%;min-width:0;height:2rem}.chat-floating-widget__audio-preview meter{width:100%;height:.7rem}.chat-floating-widget__preview{width:min(42rem,calc(100vw - 2rem));max-height:min(80vh,44rem);border:0;border-radius:.9rem;padding:0;box-shadow:0 1rem 3rem rgba(15,23,42,.35)}.chat-floating-widget__preview::backdrop{background:rgba(15,23,42,.55)}.chat-floating-widget__preview header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.75rem 1rem;border-bottom:1px solid #e2e8f0}.chat-floating-widget__preview [data-floating-preview-content]{display:grid;place-items:center;min-height:10rem;max-height:65vh;overflow:auto;padding:1rem}.chat-floating-widget__preview img,.chat-floating-widget__preview video{max-width:100%;max-height:58vh}.chat-floating-widget__preview iframe{width:min(100%,38rem);height:55vh;border:1px solid #dbe4ee}.chat-floating-widget__new-form{display:grid;gap:.45rem;margin-top:.45rem}.chat-floating-widget__new-form label{font-size:.78rem;font-weight:600}.chat-floating-widget__view[hidden]{display:none}@media(max-width:575.98px){.chat-floating-widget__audio-preview{grid-template-columns:auto 1fr}.chat-floating-widget__audio-preview audio{grid-column:1/-1}.chat-floating-widget__audio-preview .btn{grid-column:1/-1}.chat-floating-widget__call-actions .btn{padding-inline:.45rem}}

.chat-task-list,
.chat-alert-list {
    display: grid;
    gap: 0.9rem;
}

.chat-task-card,
.chat-alert-card,
.chat-calendar-item {
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid #dbe4ee;
    background: #ffffff;
}

.chat-task-card__meta {
    font-size: 0.88rem;
    color: #475569;
}

.chat-calendar-range {
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

.chat-alert-card {
    background: #fffbeb;
    border-color: #fde68a;
}

.chat-alert-card__title {
    font-weight: 700;
    color: #92400e;
}

.chat-calendar-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.chat-calendar-grid--month {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.chat-calendar-grid__header {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: #64748b;
    padding: 0.2rem 0.35rem;
}

.chat-calendar-column,
.chat-calendar-cell {
    min-height: 180px;
    padding: 0.85rem;
    border-radius: 16px;
    border: 1px solid #dbe4ee;
    background: #f8fafc;
    display: grid;
    gap: 0.6rem;
    align-content: start;
}

.chat-calendar-cell.is-muted {
    opacity: 0.65;
}

.chat-calendar-column__title,
.chat-calendar-cell__title,
.chat-calendar-item__type {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #475569;
}

.chat-calendar-column__empty {
    color: #94a3b8;
    font-size: 0.9rem;
}

.chat-empty-state {
    display: grid;
    place-items: center;
    gap: 0.35rem;
    text-align: center;
    min-height: 180px;
    padding: 1.25rem;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
}

.chat-empty-state__icon {
    font-size: 1.4rem;
    color: #94a3b8;
}

.chat-loading {
    display: grid;
    gap: 0.75rem;
}

.chat-skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: #e2e8f0;
}

.chat-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
    animation: dashboardShimmer 1.4s infinite;
}

.chat-skeleton--line {
    height: 18px;
}

.chat-skeleton--bubble {
    height: 84px;
}

.chat-skeleton--bubble.short {
    max-width: 68%;
}

.chat-modal-user-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.chat-modal-user-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.9rem;
    border-radius: 14px;
    border: 1px solid #dbe4ee;
    background: #f8fafc;
    cursor: pointer;
}

.chat-modal-user-option input {
    margin-top: 0.2rem;
}

.btn-group .btn.is-active {
    background: #003366;
    border-color: #003366;
    color: #ffffff;
}

@media (max-width: 1199.98px) {
    .chat-layout,
    .chat-secondary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .page-section-header,
    .chat-panel-header,
    .chat-section-header,
    .chat-message-toolbar,
    .chat-composer__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-support-nav .btn,
    .chat-inline-navigation .btn,
    .chat-sidebar-shortcuts .btn {
        width: 100%;
    }

    .chat-message {
        max-width: 100%;
    }

    .chat-message-list {
        min-height: 280px;
        max-height: 52vh;
    }

    .chat-composer textarea.form-control {
        min-height: 88px;
    }

    .chat-calendar-grid--month {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-skeleton::after {
        animation: none;
    }
}

/* Módulos de Correo: jerarquía, navegación y lectura responsive */
.correo-module-shell {
    max-width: 1540px;
    margin-inline: auto;
    padding-inline: clamp(.75rem, 1.5vw, 1.5rem);
}

.correo-page-hero,
.correo-report-page > .correo-dashboard-hero,
.correo-config-page > .correo-dashboard-header {
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--maria-border);
    border-radius: var(--maria-radius);
    background: linear-gradient(135deg, #fff 0%, #f3f7ff 100%);
    box-shadow: var(--maria-shadow);
}

.correo-module-shell .correo-card,
.correo-module-shell .correo-dashboard-hero,
.correo-module-shell .correo-filters-card {
    overflow: hidden;
    border: 1px solid var(--maria-border) !important;
    border-radius: var(--maria-radius) !important;
    box-shadow: var(--maria-shadow) !important;
}

.correo-module-shell .card-header,
.correo-module-shell .correo-card-header {
    border-bottom-color: var(--maria-border);
    background: var(--maria-surface-soft) !important;
}

.correo-sent-page .table-responsive,
.correo-report-page .table-responsive,
.correo-automation-page .table-responsive,
.correo-config-page .table-responsive {
    scrollbar-color: #b8c8df transparent;
}

.correo-sent-page .table tbody tr,
.correo-automation-page .table tbody tr,
.correo-config-page .table tbody tr {
    transition: background-color .18s ease, transform .18s ease;
}

.correo-sent-page .table tbody tr:hover,
.correo-automation-page .table tbody tr:hover,
.correo-config-page .table tbody tr:hover {
    background: #f7faff;
}

.correo-report-page .correo-title,
.correo-report-page h1,
.correo-config-page h1 { max-width: 52rem; }

.correo-automation-page .row.g-4 > [class*="col-"] > .correo-card,
.correo-report-page .row.g-4 > [class*="col-"] > .correo-card { height: 100%; }

.correo-automation-page .form-check.form-switch,
.correo-automation-page .rounded-3.border.bg-light { border-radius: var(--maria-radius-sm) !important; }

.correo-module-shell .nav-pills { padding: .35rem; border: 1px solid var(--maria-border); border-radius: var(--maria-radius-sm); background: #fff; }
.correo-module-shell .nav-pills .nav-link { color: var(--maria-muted); border-radius: .6rem; }
.correo-module-shell .nav-pills .nav-link.active { color: #fff; background: var(--maria-primary); }

@media (max-width: 767.98px) {
    .correo-module-shell { padding-inline: .5rem; }
    .correo-page-hero .correo-btn,
    .correo-page-hero .correo-btn-primary,
    .correo-page-hero form { width: 100%; }
    .correo-page-hero .correo-btn,
    .correo-page-hero .correo-btn-primary { justify-content: center; }
    .correo-module-shell .table { min-width: 720px; }
    .correo-module-shell .card-body { padding: 1rem !important; }
    .correo-module-shell .nav-pills { overflow-x: auto; flex-wrap: nowrap; }
    .correo-module-shell .nav-pills .nav-link { white-space: nowrap; }
}
