:root {
    /* Refined Premium Palette */
    --primary: #FF4A8C;
    /* Pink */
    --primary-hover: #E03575;
    --primary-light: #FFEBF4;
    --secondary: #FF9B42;
    /* Orange */
    --tertiary: #42D9C8;
    /* Teal */
    --accent: #9D4EDD;
    /* Purple */
    --yellow: #FFD166;

    /* Semantic Backgrounds */
    --bg-main: #F7F9FB;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-hover: #F1F4F9;
    --bg-input: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-chat: #FFF5F9;

    /* Text System */
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    /* Elevation & Depth */
    --border: #E2E8F0;
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --glass-blur: blur(12px);

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------------------------
   USERS ADMIN PANEL
--------------------------------- */
.users-admin-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.user-admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: var(--transition);
}

.user-admin-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.user-admin-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-admin-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
}

.user-admin-info {
    display: flex;
    flex-direction: column;
}

.user-admin-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.user-admin-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-admin-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-select-admin {
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.role-select-admin:focus {
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .user-admin-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .user-admin-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ---------------------------------
   USER SELECTION LIST (MODALS)
--------------------------------- */
.user-selection-list {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-input);
    border-radius: 16px;
    padding: 0.5rem;
    border: 1.5px solid var(--border);
    margin-top: 0.5rem;
}

.user-selection-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    transition: var(--transition);
    cursor: pointer;
}

.user-selection-item:hover {
    background: var(--bg-surface);
}

.user-selection-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.user-selection-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.user-selection-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ---------------------------------
   CHAT DROPDOWN MENU
--------------------------------- */
.chat-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    animation: slideIn 0.2s ease-out;
}

.chat-dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item.danger {
    color: #EF4444;
}

.dropdown-item.danger:hover {
    background: #FEF2F2;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    line-height: 1.5;
}

#app {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-main);
}


/* ---------------------------------
   LOGIN VIEW
--------------------------------- */
.login-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at top right, rgba(255, 74, 140, 0.1), transparent 400px),
        radial-gradient(circle at bottom left, rgba(255, 149, 0, 0.1), transparent 400px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.login-view.active {
    display: flex;
}

.login-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 420px;
    padding: 3.5rem 2.5rem;
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.login-logo {
    width: 220px;
    height: auto;
    margin-bottom: 2.5rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.05));
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.btn-google {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 1rem 2rem;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    box-shadow: var(--shadow-soft);
}

.btn-google:hover {
    background-color: #F8F9FA;
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
}

.google-icon {
    width: 18px;
    height: 18px;
}

/* ---------------------------------
   UTILITIES
--------------------------------- */
.text-primary {
    color: var(--primary) !important;
}

.bg-purple {
    background: linear-gradient(135deg, var(--accent), #C77DFF) !important;
}

.bg-orange {
    background: linear-gradient(135deg, var(--secondary), #F97316) !important;
}

.bg-primary {
    background: var(--primary) !important;
}

.bg-secondary {
    background: var(--secondary) !important;
}

.bg-tertiary {
    background: var(--tertiary) !important;
}

.bg-accent {
    background: var(--accent) !important;
}

.bg-dark {
    background: var(--dark) !important;
}

.bg-error {
    background: var(--danger) !important;
}

/* ---------------------------------
   LIST PANEL (Sidebar)
--------------------------------- */
.list-panel {
    width: 320px;
    min-width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    position: relative;
    box-shadow: 4px 0 10px -5px rgba(0, 0, 0, 0.02);
}

@media (max-width: 768px) {
    .list-panel {
        width: 100%;
        min-width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
    }

    .hide-on-mobile {
        display: none !important;
    }

    /* .hide-on-desktop is shown by default on mobile */

    .back-btn {
        display: block;
    }
}

@media (min-width: 769px) {
    .hide-on-desktop {
        display: none !important;
    }

    .list-panel {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: var(--bg-chat);
}

.sidebar-logo {
    height: 60px;
    width: auto;
}

.sidebar-date {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg-chat);
}

.user-info {
    display: flex;
    flex-direction: column;
    margin-left: 0.75rem;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.panel-header {
    padding: 2rem 1.5rem 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.mobile-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-chat);
}

.mobile-logo {
    height: 48px;
    object-fit: contain;
}

.mobile-logo-header {
    height: 32px;
    object-fit: contain;
    display: none;
}

@media (max-width: 768px) {
    .mobile-logo-header {
        display: block !important;
    }
}

.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 12px;
}

.user-profile:hover {
    background: var(--bg-hover);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.role-badge {
    position: absolute;
    bottom: -5px;
    right: -10px;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    color: white;
    border: 1.5px solid white;
}

.badge-admin {
    background-color: var(--primary);
}

.badge-profesor {
    background-color: var(--tertiary);
    position: relative;
    bottom: auto;
    right: auto;
    margin-left: 0.5rem;
}



.header-actions .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

.header-actions .icon-btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 74, 140, 0.3);
}

/* ---------------------------------
   SEARCH BAR
--------------------------------- */
.search-bar {
    animation: fadeIn 0.3s ease;
}

.search-input-wrapper {
    background: var(--bg-input);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    height: 40px;
}

.search-icon-inner {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-right: 0.75rem;
}

#chat-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    flex: 1;
    width: 100%;
}

.clear-search {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.clear-search:hover {
    color: var(--primary);
}

.list-item.hidden-chat {
    display: none !important;
}

.message-group.hidden-message {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------
   CHANNEL LIST
--------------------------------- */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
    padding-bottom: 5rem;
    /* Space for bottom nav */
}

.list-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1rem 0.75rem 1rem;
    margin-top: 0.5rem;
}

.list-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 12px;
    margin: 0.25rem 0.75rem;
}

.list-item:hover {
    background-color: var(--bg-hover);
    transform: translateX(4px);
}

.list-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.list-item.active .item-title {
    color: var(--primary);
}

.list-item.active .item-preview {
    color: var(--primary);
    opacity: 0.8;
}

.item-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    margin-right: 1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

.channel-icon {
    background: linear-gradient(135deg, var(--tertiary), #2DD4BF);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
}

.role-prof {
    background-color: var(--tertiary);
}

.role-part {
    background-color: var(--accent);
}

.item-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 0.5rem;
}

.item-meta .time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.unread-badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: 0.25rem;
}

/* ---------------------------------
   TASKS MODULE
--------------------------------- */
.view-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--bg-main);
}

.view-panel.active {
    display: flex;
}

.tasks-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-input);
    padding: 0.4rem;
    border-radius: 14px;
    margin-bottom: 2rem;
    align-self: flex-start;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inner);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.tasks-tabs::-webkit-scrollbar {
    display: none;
}

.task-tab {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.task-tab:active {
    transform: scale(0.97);
}

.task-tab:hover:not(.active) {
    background: var(--bg-hover);
}

.task-tab.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding-bottom: 6rem;
}

.task-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--text-muted);
}

/* Status Accents */
.task-card[data-status="Pendiente"]::before {
    background: var(--secondary);
}

.task-card[data-status="En proceso"]::before {
    background: var(--accent);
}

.task-card[data-status="Hecho"]::before {
    background: #10B981;
}

.task-card.blocked::before {
    background: #EF4444;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-family {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.task-card.family-horario .task-family {
    background: #E0F2FE;
    color: #0369A1;
}

.task-card.family-material .task-family {
    background: #FEF3C7;
    color: #92400E;
}

.task-card.family-informacion .task-family {
    background: #F1F5F9;
    color: #475569;
}

.task-card.family-incidencias .task-family {
    background: #FEE2E2;
    color: #B91C1C;
}

.task-card.family-clases-prueba .task-family {
    background: #F0FDF4;
    color: #15803D;
}

.task-card.family-matriculas .task-family {
    background: #FAF5FF;
    color: #7E22CE;
}

.task-card.family-profesores .task-family {
    background: #E0E7FF;
    color: #3730A3;
}

.task-card.family-administracion .task-family {
    background: #FFEDD5;
    color: #9A3412;
}


.task-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.task-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.task-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #F1F5F9;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.task-meta i {
    font-size: 0.9rem;
}

.task-assignees {
    display: flex;
    align-items: center;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--bg-card);
    margin-left: -8px;
    box-shadow: var(--shadow-soft);
}

.avatar-sm:first-child {
    margin-left: 0;
}

/* ---------------------------------
   BOTTOM NAV (Mobile Navigation)
--------------------------------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-up);
    z-index: 4000;
    /* Super high to ensure it displays */
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-item.active {
    color: var(--primary);
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: 5px;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
}

/* ---------------------------------
   SIDEBAR NAV (Desktop)
--------------------------------- */
.sidebar-nav {
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    opacity: 0.7;
}

.sidebar-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-nav-item.active i {
    opacity: 1;
}

/* ---------------------------------
   CHAT VIEW (Thread / Conversation)
--------------------------------- */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
    position: relative;
    z-index: 5;
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.04);
}

.chat-header {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.chat-title-info h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.chat-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.chat-actions .icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-left: 1rem;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background-color: var(--bg-chat);
}

.date-divider {
    text-align: center;
    position: relative;
    margin: 1rem 0;
}

.date-divider span {
    background: var(--bg-chat);
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
    z-index: 0;
}

/* Messages */
.message-group {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    margin-bottom: 0.5rem;
}

.message-group.is-me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-top: auto;
}

.message-content {
    display: flex;
    flex-direction: column;
    position: relative;
}

.message-group.is-me .message-content {
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    margin-left: 0.5rem;
}

.message-group.is-me .message-header {
    margin-left: 0;
    margin-right: 0.5rem;
    flex-direction: row-reverse;
}

.message-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.message-info .role-badge {
    position: static;
    display: inline-block;
    vertical-align: middle;
}

.message-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-bubble {
    background: var(--bg-surface);
    padding: 0.75rem 1rem;
    border-radius: 1rem 1rem 1rem 0;
    box-shadow: var(--shadow-sm);
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.message-group.is-me .message-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, #FF6B6B 100%);
    color: white;
    border-radius: 1rem 1rem 0 1rem;
}

.message-reactions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.reaction {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
}

/* Exclusivo Admin Action Trigger on Messages */
.message-actions-trigger {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    display: none;
    z-index: 10;
    border: 1px solid var(--border);
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    transform: translate(50%, -50%);
}

.message-group.is-me .message-actions-trigger {
    right: auto;
    left: 0;
    transform: translate(-50%, -50%);
}

.message-group:hover .message-actions-trigger {
    display: flex;
}

/* Reactions Bar under bubble */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.reaction-badge:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Reply Styling */
.reply-quoted {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    max-width: 100%;
}

.message-group.is-me .reply-quoted {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: white;
}

.reply-quoted-author {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

/* Reply Preview Bar at bottom */
.reply-preview-container {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: none;
    /* Shown via JS */
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.3s ease;
}

.reply-preview-content {
    flex: 1;
    border-left: 3px solid var(--primary);
    padding-left: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary);
}

.reply-preview-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cancel-reply {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dropdown Menu for Task Creation */
.message-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    width: 200px;
    padding: 0.5rem 0;
}

.message-dropdown.show {
    display: block;
}

.message-group.is-me .message-dropdown {
    right: auto;
    left: 0;
}

.dashboard-bar-clickable {
    transition: background 0.2s ease, transform 0.1s ease;
}

.dashboard-bar-clickable:hover {
    background-color: var(--bg-hover);
    transform: translateX(4px);
}

.dashboard-bar-clickable .chart-val {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background-color: var(--bg-hover);
}

.dropdown-item.text-primary {
    font-weight: 600;
}

.message-dropdown hr {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* System Message (e.g., Task Created) */
.message-system {
    align-self: center;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.message-system a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

/* Attachments */
.message-attachment {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    min-width: 250px;
}

.attachment-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Chat Input Area */
.chat-input-area {
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface);
    border-top: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 10;
}

.input-actions-top {
    display: flex;
    gap: 1rem;
    padding-left: 0.5rem;
}

.icon-circular {
    background: var(--bg-input);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface);
    border-radius: 24px;
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

#chat-input {
    flex: 1;
    border: none;
    background: none;
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: 1.05rem;
    outline: none;
    color: var(--text-primary);
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
}

.input-actions button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.25rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-pulse {
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.send-btn {
    background-color: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(255, 74, 140, 0.3);
}

/* ---------------------------------
   DASHBOARD MODULE
--------------------------------- */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.kpi-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.kpi-card {
    background: var(--bg-surface);
    padding: 1.75rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 260px;
    height: 160px;
    flex: 0 0 auto;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.kpi-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.kpi-icon {
    font-size: 1.5rem;
    opacity: 0.2;
    transition: var(--transition);
}

.kpi-card:hover .kpi-icon {
    opacity: 0.6;
    transform: scale(1.1);
}

.kpi-value {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-top: auto;
}

.kpi-clickable {
    cursor: pointer;
    transition: var(--transition);
}

.kpi-clickable:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* KPI Variations */
.kpi-card.danger {
    border-bottom: 4px solid #EF4444;
}

.kpi-card.danger .kpi-icon {
    color: #EF4444;
}

.kpi-card.warning {
    border-bottom: 4px solid var(--secondary);
}

.kpi-card.warning .kpi-icon {
    color: var(--secondary);
}

.kpi-card.dark {
    border-bottom: 4px solid var(--dark);
}

.kpi-card.dark .kpi-icon {
    color: var(--dark);
}

.kpi-card.info {
    border-bottom: 4px solid var(--tertiary);
}

.kpi-card.info .kpi-icon {
    color: var(--tertiary);
}

.kpi-card.primary {
    border-bottom: 4px solid var(--primary);
}

.kpi-card.primary .kpi-icon {
    color: var(--primary);
}

.kpi-card.tertiary {
    border-bottom: 4px solid var(--tertiary);
}

.kpi-card.tertiary .kpi-icon {
    color: var(--tertiary);
}

.kpi-card.accent {
    border-bottom: 4px solid var(--accent);
}

.kpi-card.accent .kpi-icon {
    color: var(--accent);
}

.kpi-card.secondary {
    border-bottom: 4px solid var(--secondary);
}

.kpi-card.secondary .kpi-icon {
    color: var(--secondary);
}

.dashboard-section {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
}

.dashboard-section h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-bar:hover {
    box-shadow: var(--shadow-soft);
    border-color: var(--primary-light);
    transform: translateX(6px);
}

.chart-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-track {
    height: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
}

.chart-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-val {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------------------------------
   MOBILE RESPONSIVENESS (Mobile First logic applied backwards)
--------------------------------- */
@media (max-width: 768px) {
    .list-panel {
        width: 100%;
        position: absolute;
        height: 100%;
    }

    .chat-view {
        width: 100%;
        position: absolute;
        height: 100%;
        z-index: 5000;
        /* Superpone el chat al nav-bar inferior */
        padding-bottom: env(safe-area-inset-bottom);
    }

    .hide-on-mobile {
        display: none !important;
    }

    .back-btn {
        display: block;
    }
}

/* ---------------------------------
   PROFILE MODAL
--------------------------------- */
.profile-modal-content {
    max-width: 450px;
}

.profile-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.profile-large-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
    box-shadow: var(--shadow-md);
}

.profile-basic-info h3 {
    margin: 0.5rem 0 0.25rem 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.profile-tasks-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.profile-tasks-section h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.profile-task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--bg-input);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.profile-task-item:hover {
    border-color: var(--primary-light);
    background: var(--bg-surface);
    transform: translateX(4px);
}

.profile-task-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.profile-task-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-task-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-task-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.status-pendiente {
    background: #FFF7ED;
    color: var(--secondary);
}

.status-proceso {
    background: #F3E8FF;
    color: var(--accent);
}

.status-hecho {
    background: #F0FDF4;
    color: #10B981;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

#task-modal {
    z-index: 6000;
    /* Ensure task modal appears above mobile chat and profile modal */
}

.modal-content {
    background: var(--bg-surface);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    /* Add max height to ensure it fits the viewport */
    overflow-y: auto;
    /* Enable vertical scrolling */
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -0.03em;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.form-row {
    display: flex;
    gap: 1.25rem;
}

.form-row .half {
    flex: 1;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background-color: var(--bg-input);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    color: var(--text-primary);
}


.form-control:focus {
    border-color: var(--primary);
    background-color: var(--bg-surface);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.tags-container {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn {
    padding: 0.85rem 1.75rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(255, 74, 140, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -3px rgba(255, 74, 140, 0.5);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: #FEF2F2;
    color: #EF4444;
}

.btn-danger:hover {
    background: #FEE2E2;
}

.w-100 {
    width: 100%;
}

/* ---------------------------------
   DASHBOARD PENDING TASKS
--------------------------------- */
.dashboard-pending-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.dashboard-pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.dashboard-pending-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.pending-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pending-item-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pending-item-family {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

.pending-item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-status-action {
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-dashboard-pendiente {
    background: #FFFBEB;
    color: #F59E0B;
}

.btn-dashboard-pendiente:hover {
    background: #FEF3C7;
}

.btn-dashboard-proceso {
    background: #F3E8FF;
    color: #A855F7;
    cursor: default;
}

.btn-en-proceso {
    background: #FFFBEB;
    color: #F59E0B;
}

.btn-en-proceso:hover {
    background: #FEF3C7;
}

.btn-hecho {
    background: #ECFDF5;
    color: #10B981;
}

.btn-hecho:hover {
    background: #D1FAE5;
}

/* ---------------------------------
   SCHEDULE PANEL
--------------------------------- */

#schedule-table-container {
    flex: 1;
    overflow: auto !important;
    position: relative;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: none;
    background: var(--bg-surface);
    display: none; /* Se activa por JS */
}

.schedule-table {
    width: 100% !important; /* Forzar que ocupe todo */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.75rem; /* Fuente reducida */
    text-align: left;
    table-layout: auto;
}

.schedule-table th,
.schedule-table td {
    padding: 0.3rem 0.25rem !important;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.schedule-td-hora {
    font-weight: 800;
    color: var(--primary);
    background-color: var(--primary-light) !important;
    border-right: 2px solid var(--primary) !important;
    font-size: 0.7rem;
    width: 60px !important; /* Ancho fijo para las horas */
    white-space: nowrap;
    text-align: center;
}

.schedule-td-dia {
    min-width: 140px; /* Asegurar un mínimo de espacio para los días en PC */
    width: 18%; /* Aproximadamente proporcional para 5 días */
}

/* Columna especial derecha */
.col-dia-th {
    font-size: 0.8rem !important;
}

.schedule-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.65rem;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 2px solid var(--primary) !important;
}

/* Bloques horizontales (Divisores de Aulas) */
.schedule-row-divider td {
    border-top: 2px solid var(--primary) !important;
    background-color: #fff1f5 !important;
    font-weight: 800;
    padding: 0.4rem 0.25rem !important;
    letter-spacing: 0.05em;
    text-align: center;
}

.schedule-cell-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.05;
}

.schedule-cell-aula {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 600;
    background: var(--bg-input);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

/* ---------------------------------
   RESIZER (SPLIT PANELS)
--------------------------------- */
.resizer {
    width: 6px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    z-index: 50;
    flex-shrink: 0;
    transition: background 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.resizer:hover,
.resizer.is-resizing {
    background: var(--border);
}

.resizer-handle {
    width: 4px;
    height: 40px;
    background: #d1d5db;
    /* gray-300 */
    border-radius: 4px;
    transition: background 0.2s;
}

.resizer:hover .resizer-handle,
.resizer.is-resizing .resizer-handle {
    background: var(--primary-light);
}

body.is-resizing {
    cursor: col-resize;
    user-select: none;
}

.filter-bubble {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    margin: 2px;
}

.filter-bubble:hover:not(.active) {
    background: var(--bg-hover);
}

.filter-bubble.active {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* ---------------------------------
   SCHEDULE OPTIMIZATION (iPhone)
--------------------------------- */
.schedule-main-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.schedule-day-selector {
    display: flex;
    justify-content: space-around;
    padding: 0.4rem 0.5rem; /* Reducido */
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.day-bubble {
    width: 34px; /* Más pequeño */
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.day-bubble:active, .day-bubble.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(0.9);
    box-shadow: 0 4px 12px rgba(255, 74, 140, 0.3);
}

.schedule-aula-selector {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    width: 100%;
    z-index: 90;
}

.aula-btn {
    width: 38px; /* Más pequeño */
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.aula-btn:active, .aula-btn.active {
    background: var(--tertiary);
    color: white;
    border-color: var(--tertiary);
    transform: scale(0.9);
}

/* Redefine schedule table container for better scrolling control */
#schedule-table-container {
    flex: 1;
    overflow: auto !important;
    position: relative;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: none;
    display: none; /* Will be shown by JS */
}

/* Redundant block removed to use unified styles above */

.schedule-row-divider {
    scroll-margin-top: 55px;
}

.day-column-target {
    scroll-margin-left: 100px;
}

@media (min-width: 769px) {
    .schedule-aula-selector,
    .schedule-day-selector {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .view-panel {
        padding: 0.5rem 0.5rem 6rem 0.5rem !important; /* General reduction for all panels */
    }
    .panel-header {
        padding: 0.5rem 0.5rem 1rem 0.5rem !important;
    }
    .panel-header h2 {
        font-size: 1.4rem;
    }
    
    #view-schedule.view-panel {
        padding: 0 0 6rem 0 !important;
    }
    #view-schedule .panel-header {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 1rem !important;
    }
    
    .schedule-table {
        table-layout: fixed !important;
        font-size: 0.95rem !important; /* Aumentado para mejor legibilidad */
    }
    .schedule-table th,
    .schedule-table td {
        padding: 0.5rem 0.2rem !important;
    }
    .col-hora-th,
    .schedule-td-hora {
        width: 33.33% !important;
        max-width: 33.33% !important;
        min-width: 33.33% !important;
        font-size: 0.8rem !important; /* Aumentado */
    }
    .col-dia-th,
    .schedule-td-dia {
        width: 66.67% !important;
        min-width: 66.67% !important;
        max-width: 66.67% !important;
        font-size: 0.95rem !important; /* Aumentado */
    }
    .schedule-aula-selector {
        justify-content: center !important;
    }
    .aula-btn {
        flex-shrink: 0;
    }
    
    /* Aumentar tamaño tareas dashboard en móvil */
    .dashboard-pending-item {
        padding: 1.25rem !important;
    }
    .pending-item-title {
        font-size: 1.15rem !important;
        white-space: normal !important;
    }
    .pending-item-family {
        font-size: 0.9rem !important;
        margin-top: 0.2rem;
    }
    .btn-status-action {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.2rem !important;
    }
}

