/* Material 3 Expressive Design System - Dinámico */
:root {
    /* Los colores se establecen dinámicamente por JavaScript */
    /* Valores NEUTROS como fallback - NO más morados */

    /* Primary - NEUTRAL (se sobrescribe por JS) */
    --md-sys-color-primary: #5F5F5F;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #E0E0E0;
    --md-sys-color-on-primary-container: #1C1C1C;

    /* Secondary - NEUTRAL */
    --md-sys-color-secondary: #6B6B6B;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8E8E8;
    --md-sys-color-on-secondary-container: #1F1F1F;

    /* Tertiary - NEUTRAL */
    --md-sys-color-tertiary: #757575;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #ECECEC;
    --md-sys-color-on-tertiary-container: #2A2A2A;

    /* Error - Fijo */
    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;

    /* Success - Fijo */
    --md-sys-color-success: #2E7D32;
    --md-sys-color-on-success: #FFFFFF;
    --md-sys-color-success-container: #C8E6C9;
    --md-sys-color-on-success-container: #1B5E20;

    /* Surface - NEUTRAL para modo claro */
    --md-sys-color-surface: #FEFEFE;
    --md-sys-color-surface-variant: #E7E7E7;
    --md-sys-color-on-surface: #1C1C1C;
    --md-sys-color-on-surface-variant: #48484F;
    --md-sys-color-outline: #787781;
    --md-sys-color-shadow: #000000;
    --md-sys-color-background: #FEFEFE;

    /* Typography */
    --md-sys-typescale-display-small-font: 'Roboto', sans-serif;
    --md-sys-typescale-display-small-size: 36px;
    --md-sys-typescale-display-small-weight: 400;
    --md-sys-typescale-display-small-line-height: 44px;

    --md-sys-typescale-headline-large-size: 32px;
    --md-sys-typescale-headline-large-weight: 400;
    --md-sys-typescale-headline-large-line-height: 40px;

    --md-sys-typescale-title-large-size: 22px;
    --md-sys-typescale-title-large-weight: 500;
    --md-sys-typescale-title-large-line-height: 28px;

    --md-sys-typescale-body-large-size: 16px;
    --md-sys-typescale-body-large-weight: 400;
    --md-sys-typescale-body-large-line-height: 24px;

    --md-sys-typescale-body-medium-size: 14px;
    --md-sys-typescale-label-large-size: 14px;
    --md-sys-typescale-label-large-weight: 500;

    /* Shape */
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-large: 20px;
    --md-sys-shape-corner-medium: 16px;
    --md-sys-shape-corner-small: 12px;

    /* Elevation */
    --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15);

    /* Motion */
    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-duration-medium: 300ms;
    --md-sys-motion-duration-long: 500ms;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--md-sys-typescale-display-small-font);
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-surface);
    line-height: 1.6;
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Typography Classes */
.display-small {
    font-size: var(--md-sys-typescale-display-small-size);
    font-weight: var(--md-sys-typescale-display-small-weight);
    line-height: var(--md-sys-typescale-display-small-line-height);
}

.headline-large {
    font-size: var(--md-sys-typescale-headline-large-size);
    font-weight: var(--md-sys-typescale-headline-large-weight);
    line-height: var(--md-sys-typescale-headline-large-line-height);
}

.headline-medium {
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
}

.headline-small {
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
}

.title-large {
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: var(--md-sys-typescale-title-large-weight);
    line-height: var(--md-sys-typescale-title-large-line-height);
}

.title-medium {
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
}

.body-large,
.body-medium,
.label-large,
.label-medium,
.label-small {
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: var(--md-sys-typescale-body-large-weight);
    line-height: var(--md-sys-typescale-body-large-line-height);
}

.body-medium {
    font-size: var(--md-sys-typescale-body-medium-size);
}

.label-large {
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: var(--md-sys-typescale-label-large-weight);
}

.label-medium {
    font-size: 12px;
}

.label-small {
    font-size: 11px;
}

.body-small {
    font-size: 12px;
    opacity: 0.7;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 40px;
    box-shadow: var(--md-sys-elevation-3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: var(--md-sys-color-primary);
    margin-bottom: 8px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-field {
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-medium);
    font-size: var(--md-sys-typescale-body-large-size);
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

.text-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
}

/* Buttons - Material 3 Expressive */
.btn-filled,
.btn-text,
.btn-outlined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: var(--md-sys-typescale-label-large-weight);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
    text-decoration: none;
}

.btn-filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.btn-filled:hover {
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-2px);
}

.btn-large {
    padding: 16px 32px;
    width: 100%;
    font-size: 16px;
}

.btn-text {
    background: transparent;
    color: var(--md-sys-color-primary);
}

.btn-text:hover {
    background: var(--md-sys-color-primary-container);
}

.btn-icon {
    padding: 8px;
    min-width: auto;
}

.btn-icon:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

/* Top App Bar */
.top-app-bar {
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.app-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    grid-column: 1;
}

.header-logo {
    height: 56px;
    width: auto;
    max-width: 200px;
    display: block;
    object-fit: contain;
    grid-column: 2;
    justify-self: center;
}

.app-bar-title {
    min-width: 0;
    grid-column: 1;
}

.app-bar-title h1 {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 18px;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: 3;
    justify-self: end;
}

/* Hamburger Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle:hover {
    background: var(--md-sys-color-surface-variant);
}

.menu-toggle .material-icons {
    font-size: 24px;
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-3);
    border-radius: 12px;
    margin-top: 8px;
    margin-right: 16px;
    min-width: 200px;
    flex-direction: column;
    z-index: 101;
}

.mobile-menu.show {
    display: flex;
}

.mobile-menu-item {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-menu-item:hover {
    background: var(--md-sys-color-surface-variant);
}

.mobile-menu-item .material-icons {
    font-size: 20px;
}

/* User Info Section */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name {
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.user-role {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .app-bar-content {
        padding: 12px;
        grid-template-columns: auto 1fr auto;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        grid-column: 1;
        order: 1;
    }

    .header-logo {
        height: 56px;
        max-width: 200px;
        grid-column: 2;
        justify-self: center;
        order: 2;
        margin-left: 32px;
    }

    .app-bar-left {
        display: none !important;
    }

    .app-bar-title {
        display: none !important;
    }

    .app-bar-title h1 {
        font-size: 18px;
        display: none !important;
    }

    .desktop-actions {
        display: none;
    }

    .app-bar-actions {
        gap: 4px;
    }

    .section-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
    }

    .section-header h2 {
        width: 100%;
    }

    .section-header .btn-filled {
        display: flex !important;
        visibility: visible !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .fab {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .app-bar-content {
        padding: 8px;
        grid-template-columns: auto 1fr auto;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        grid-column: 1;
        order: 1;
    }

    .header-logo {
        height: 56px;
        max-width: 200px;
        grid-column: 2;
        justify-self: center;
        order: 2;
        margin-left: 32px;
    }

    .app-bar-left {
        display: none !important;
    }

    .app-bar-title {
        display: none !important;
    }

    .app-bar-title h1 {
        font-size: 16px;
        display: none !important;
    }

    .user-info {
        gap: 8px;
    }

    .user-info-text {
        display: none;
    }

    .mobile-menu {
        margin-right: 8px;
    }

    .fab {
        bottom: 20px;
        right: 16px;
        z-index: 50;
        display: none !important;
    }

    .section-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
    }

    .section-header h2 {
        width: 100%;
    }

    .section-header .btn-filled {
        display: flex !important;
        visibility: visible !important;
        align-items: center !important;
        gap: 8px !important;
    }
}

.badge-role {
    padding: 4px 12px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 12px;
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 24px;
    border-radius: var(--md-sys-shape-corner-large);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.stat-card:hover {
    transform: scale(1.02);
}

.stat-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
}

/* Plans Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.plan-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 24px;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.plan-card:hover {
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-4px);
    border-color: var(--md-sys-color-primary);
}

.card-header {
    margin-bottom: 12px;
}

.card-description {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta .material-icons {
    font-size: 18px;
}

/* Progress Bar - Expressive */
.progress-bar {
    height: 8px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 999px;
    transition: width var(--md-sys-motion-duration-long) var(--md-sys-motion-easing-emphasized);
    position: relative;
    overflow: hidden;
}

/* Colores de progreso según rango */
.progress-fill.progress-low {
    background: #D32F2F; /* Rojo 0-25% */
}

.progress-fill.progress-medium {
    background: #FBC02D; /* Amarillo 25-75% */
}

.progress-fill.progress-high {
    background: #388E3C; /* Verde 75-100% */
}

.progress-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    to {
        left: 100%;
    }
}

/* Alert */
.alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-medium);
    margin: 0 auto 24px auto;
    width: fit-content;
    max-width: 90%;
}
}

.alert-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.alert-success {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

/* Activity Notifications */
.activity-notification {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-medium);
    margin-bottom: 16px;
    font-size: 14px;
    animation: slideInDown 0.3s ease-out;
}

.activity-notification.success {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.activity-notification.error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.activity-notification.info {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Sections */
.form-plan {
    max-width: 900px;
    margin: 0 auto;
}

.form-section {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 32px;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

.textarea {
    resize: vertical;
    font-family: inherit;
    min-height: 100px;
}

select.text-field {
    cursor: pointer;
}

/* Activity Form Cards */
.activity-form-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 24px;
    margin-bottom: 16px;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
    position: relative;
    overflow: hidden;
}

.activity-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 4px 0 0 4px;
}

.activity-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.activity-form-header .material-icons {
    color: var(--md-sys-color-primary);
}

.activity-form-header h3 {
    flex: 1;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
}

/* Plan Info */
.plan-info {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 24px;
    border-radius: var(--md-sys-shape-corner-large);
    margin-bottom: 32px;
}

.plan-info p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* Activities Timeline */
.activities-timeline {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-height: 75vh;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar para el timeline */
.activities-timeline::-webkit-scrollbar {
    width: 8px;
}

.activities-timeline::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-variant);
    border-radius: 4px;
}

.activities-timeline::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.activities-timeline::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline-variant);
}

.day-section {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 24px;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--md-sys-color-primary);
}

.badge-count {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 6px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 12px;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Activity Cards */
.activity-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.activity-card.completed {
    background: var(--md-sys-color-success-container);
    border: 2px solid var(--md-sys-color-success);
}

.activity-card:hover {
    transform: translateX(8px);
    box-shadow: -4px 0 0 0 var(--md-sys-color-primary),
        0 4px 12px rgba(0, 0, 0, 0.1);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.badge-priority {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}

.priority-baja {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.priority-media {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.priority-alta {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.completion-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--md-sys-color-success);
    font-weight: 500;
}

.completion-badge .material-icons {
    font-size: 20px;
}

.activity-description {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

/* Progress Control - Material 3 Expressive */
.progress-control {
    margin-top: 16px;
    background: var(--md-sys-color-primary-container);
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-medium);
}

.progress-control-readonly {
    margin-top: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    padding: 4px 12px;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-small);
}

.progress-bar-large {
    height: 12px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill-animated {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Slider mejorado */
.progress-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(to right,
            var(--md-sys-color-primary) 0%,
            var(--md-sys-color-primary) var(--slider-value, 0%),
            var(--md-sys-color-surface-variant) var(--slider-value, 0%),
            var(--md-sys-color-surface-variant) 100%);
    outline: none;
    transition: all var(--md-sys-motion-duration-medium);
    cursor: pointer;
}

.progress-slider:hover {
    transform: scaleY(1.1);
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--md-sys-color-primary);
    border: 3px solid white;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.progress-slider::-webkit-slider-thumb:active {
    transform: scale(1.5);
}

.progress-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px var(--md-sys-color-primary);
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.progress-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
}

.progress-slider::-moz-range-thumb:active {
    transform: scale(1.5);
}

.progress-indicator {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
}

.progress-indicator span {
    padding: 2px 6px;
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border-radius: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Snackbar - Notificaciones (CORREGIDO: SÓLIDO) */


.helper-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 6px;
}

.helper-text .material-icons {
    font-size: 16px;
}

.creator-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    padding: 6px 12px;
    border-radius: var(--md-sys-shape-corner-small);
    margin-top: 8px;
}

.creator-badge .material-icons {
    font-size: 18px;
}

/* Configuración de Tema */
.config-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-section {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 32px;
    display: flex;
    gap: 24px;
}

.section-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: var(--md-sys-color-primary-container);
    border-radius: var(--md-sys-shape-corner-large);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon .material-icons {
    font-size: 32px;
    color: var(--md-sys-color-primary);
}

.section-content {
    flex: 1;
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--md-sys-color-surface-variant);
    border: 2px solid transparent;
    border-radius: var(--md-sys-shape-corner-large);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn:hover {
    background: var(--md-sys-color-primary-container);
    transform: translateY(-4px);
}

.mode-btn.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.mode-btn .material-icons {
    font-size: 32px;
    color: var(--md-sys-color-on-surface);
}

/* Color Presets */
.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.color-preset {
    width: 56px;
    height: 56px;
    border-radius: var(--md-sys-shape-corner-large);
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-preset:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.color-preset:active {
    transform: scale(0.95);
}

/* Custom Color Picker */
.custom-color-picker {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.custom-color-picker input[type="color"] {
    width: 80px;
    height: 56px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    cursor: pointer;
}

/* Theme Preview */
.theme-preview {
    margin-top: 20px;
}

.preview-card {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 24px;
    border-radius: var(--md-sys-shape-corner-large);
    text-align: center;
    transition: transform 0.3s ease;
}

.preview-card h3 {
    color: var(--md-sys-color-on-primary-container);
    margin-bottom: 8px;
}

.preview-card p {
    color: var(--md-sys-color-on-primary-container);
    margin-bottom: 16px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

.fab:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

.fab:active {
    transform: scale(0.95);
}

.fab .material-icons {
    font-size: 24px;
}

/* Dark Mode Styles - CORREGIDO */
body.dark-mode {
    background: #1C1B1F;
    color: #E6E1E5;
}

body.dark-mode .top-app-bar {
    background: #2B2930;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.dark-mode .plan-card,
body.dark-mode .config-section,
body.dark-mode .day-section,
body.dark-mode .form-section {
    background: #2B2930;
    border-color: #49454F;
}

body.dark-mode .activity-card {
    background: #3D3846;
}

body.dark-mode .stat-card {
    background: #3D3846;
}

body.dark-mode .text-field,
body.dark-mode .textarea,
body.dark-mode select.text-field {
    background: #2B2930;
    color: #E6E1E5;
    border-color: #79747E;
}

body.dark-mode .text-field:focus {
    border-color: var(--md-sys-color-primary);
    background: #3D3846;
}

body.dark-mode .empty-state {
    color: #CAC4D0;
}

body.dark-mode .badge-role {
    background: #3D3846;
    color: #E8DEF8;
}

body.dark-mode .section-icon {
    background: var(--md-sys-color-primary-container);
}

body.dark-mode .section-icon .material-icons {
    color: var(--md-sys-color-primary);
}

body.dark-mode .material-icons {
    color: #CAC4D0;
}

body.dark-mode .mode-btn {
    background: #3D3846;
    color: #E6E1E5;
}

body.dark-mode .mode-btn:hover {
    background: #49454F;
}

body.dark-mode .mode-btn.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

body.dark-mode .color-preset {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode .preview-card {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

body.dark-mode input[type="color"] {
    background: #2B2930;
    border: 1px solid #49454F;
}

body.dark-mode .activity-form-card {
    background: #3D3846;
}

body.dark-mode .activity-form-header {
    border-bottom-color: #49454F;
}

body.dark-mode .login-card {
    background: #2B2930;
}

body.dark-mode .login-header h1 {
    color: var(--md-sys-color-primary);
}

body.dark-mode .alert-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

body.dark-mode .alert-success {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

body.dark-mode .fab {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Responsive */
@media (max-width: 768px) {

    .app-bar-content,
    .main-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .activity-header {
        flex-direction: column;
        gap: 12px;
    }

    .section-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
        margin-bottom: 24px;
    }

    .section-header h2 {
        margin: 0;
        padding: 0;
        width: 100%;
    }

    .section-header .btn-filled {
        display: flex !important;
        visibility: visible !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .section-header .btn-filled span {
        display: inline !important;
    }

    .form-section {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .form-actions .btn-filled,
    .form-actions .btn-text {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .day-section {
        padding: 16px;
    }

    .activity-card {
        padding: 16px;
    }

    .plan-card {
        padding: 16px;
    }
}

@media (min-width: 769px) {
    .fab {
        display: none;
    }
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Transiciones */
body,
.top-app-bar,
.plan-card,
.config-section,
.activity-card,
.day-section,
.stat-card,
.text-field,
.badge-role,
.section-icon,
.mode-btn,
.preview-card,
.activity-form-card {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* MODO OSCURO MEJORADO */
body.dark-mode {
    background: #1C1B1F !important;
    color: #E6E1E5 !important;
}

body.dark-mode .plan-info {
    background: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
}

body.dark-mode .activity-card {
    background: #3D3846 !important;
}

body.dark-mode .progress-control {
    background: var(--md-sys-color-primary-container) !important;
}

body.dark-mode .progress-indicator span {
    background: #49454F !important;
    color: #CAC4D0 !important;
}

/* ==========================================
   MODO OSCURO - CORRECCIONES FINALES
   ========================================== */

/* Plan Info en modo oscuro */
body.dark-mode .plan-info {
    background: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
}

body.dark-mode .plan-info .material-icons {
    color: var(--md-sys-color-on-primary-container) !important;
}

body.dark-mode .plan-info p {
    color: var(--md-sys-color-on-primary-container) !important;
}

/* Tarjetas de día en modo oscuro */
body.dark-mode .day-section {
    background: #2B2930 !important;
    border-color: #49454F !important;
}

body.dark-mode .day-header {
    border-bottom-color: var(--md-sys-color-primary) !important;
}

body.dark-mode .badge-count {
    background: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
}

/* Activity cards en modo oscuro */
body.dark-mode .activity-card {
    background: #3D3846 !important;
    color: #E6E1E5 !important;
}

body.dark-mode .activity-card.completed {
    background: var(--md-sys-color-success-container) !important;
    border-color: var(--md-sys-color-success) !important;
}

body.dark-mode .activity-description {
    color: #CAC4D0 !important;
}

/* Progress control en modo oscuro */
body.dark-mode .progress-control {
    background: var(--md-sys-color-primary-container) !important;
}

body.dark-mode .progress-value {
    background: #2B2930 !important;
    color: var(--md-sys-color-primary) !important;
}

body.dark-mode .progress-slider {
    background: linear-gradient(to right,
            var(--md-sys-color-primary) 0%,
            var(--md-sys-color-primary) var(--slider-value, 0%),
            #49454F var(--slider-value, 0%),
            #49454F 100%) !important;
}

body.dark-mode .progress-indicator span {
    background: #3D3846 !important;
    color: #938F99 !important;
}

/* Empty state en modo oscuro */
body.dark-mode .empty-state {
    color: #938F99 !important;
}

body.dark-mode .empty-state .material-icons {
    color: #49454F !important;
}

/* Headers y títulos en modo oscuro */
body.dark-mode .headline-small,
body.dark-mode .headline-medium,
body.dark-mode .headline-large,
body.dark-mode .title-large,
body.dark-mode .title-medium {
    color: #E6E1E5 !important;
}

/* Badge de prioridad en modo oscuro - asegurar que se vean bien */
body.dark-mode .badge-priority.priority-baja {
    background: rgba(76, 175, 80, 0.2) !important;
    color: #A5D6A7 !important;
}

body.dark-mode .badge-priority.priority-media {
    background: rgba(255, 152, 0, 0.2) !important;
    color: #FFB74D !important;
}

body.dark-mode .badge-priority.priority-alta {
    background: rgba(244, 67, 54, 0.2) !important;
    color: #EF5350 !important;
}

/* Completion badge en modo oscuro */
body.dark-mode .completion-badge {
    color: #A5D6A7 !important;
}

body.dark-mode .completion-badge .material-icons {
    color: #A5D6A7 !important;
}

/* Progress bar readonly en modo oscuro */
body.dark-mode .progress-bar-large {
    background: #49454F !important;
}

body.dark-mode .progress-fill-animated {
    background: var(--md-sys-color-primary) !important;
}

/* Asegurar que todos los textos sean legibles */
body.dark-mode .body-large,
body.dark-mode .body-medium,
body.dark-mode .body-small,
body.dark-mode .label-large,
body.dark-mode .label-medium,
body.dark-mode .label-small {
    color: #E6E1E5;
}

/* Top bar en modo oscuro */
body.dark-mode .top-app-bar {
    background: #2B2930 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .app-bar-actions .body-medium {
    color: #E6E1E5 !important;
}

/* Botones en modo oscuro */
body.dark-mode .btn-text {
    color: var(--md-sys-color-primary) !important;
}

body.dark-mode .btn-text:hover {
    background: rgba(208, 188, 255, 0.1) !important;
}

body.dark-mode .btn-filled {
    background: var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-on-primary) !important;
}

/* Gráfico de Gantt - Material 3 Expressive */
.gantt-container {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--md-sys-elevation-1);
    overflow: auto;
}

.gantt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.gantt-header h2 {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.gantt-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.gantt-filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--md-sys-color-outline);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--md-sys-motion-duration-medium);
    color: var(--md-sys-color-on-surface);
}

.gantt-filter-btn:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.gantt-filter-btn.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}

.gantt-chart {
    width: 100%;
    min-height: 400px;
    position: relative;
}

.gantt-row {
    display: flex;
    margin-bottom: 16px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    transition: all var(--md-sys-motion-duration-medium);
}

.gantt-row:hover {
    background: var(--md-sys-color-primary-container);
    transform: translateX(4px);
}

.gantt-row-label {
    min-width: 200px;
    flex-shrink: 0;
}

.gantt-row-label h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.gantt-row-label p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.gantt-timeline {
    flex: 1;
    position: relative;
    height: 40px;
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    overflow: hidden;
    min-width: 300px;
    display: flex;
    align-items: center;
}

.gantt-bar {
    height: 100%;
    border-radius: var(--md-sys-shape-corner-small);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-primary);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--md-sys-motion-duration-medium);
    cursor: pointer;
    min-width: 40px;
}

.gantt-bar:hover {
    filter: brightness(1.1);
    transform: scaleY(1.1);
}

.gantt-bar-25 {
    background: #D32F2F;
}

.gantt-bar-50 {
    background: #FBC02D;
}

.gantt-bar-75 {
    background: #FBC02D;
}

.gantt-bar-100 {
    background: #388E3C;
}

.gantt-bar-0 {
    background: var(--md-sys-color-surface-variant);
}

.gantt-tooltip {
    position: absolute;
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 8px 12px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--md-sys-elevation-3);
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gantt-legend {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-surface-variant);
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.gantt-legend-color {
    width: 24px;
    height: 16px;
    border-radius: 4px;
}

/* Detalles expandibles del Gantt */
.gantt-detalles-plan {
    margin-top: 24px;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-2);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.gantt-detalles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
}

.gantt-detalles-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.gantt-detalles-close {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.gantt-detalles-close:hover {
    background-color: var(--md-sys-color-outline-variant);
}

.gantt-detalles-close .material-icons {
    font-size: 24px;
}

.gantt-detalles-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 12px;
}

/* Scrollbar personalizada para detalles del Gantt */
.gantt-detalles-content::-webkit-scrollbar {
    width: 8px;
}

.gantt-detalles-content::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-variant);
    border-radius: 4px;
}

.gantt-detalles-content::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.gantt-detalles-content::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline-variant);
}

.gantt-actividad {
    background: var(--md-sys-color-surface-dim);
    border-left: 4px solid var(--md-sys-color-primary);
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-medium);
    animation: slideInLeft 0.3s ease-out;
}

.gantt-actividad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 16px;
}

.gantt-actividad-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    flex: 1;
}

.gantt-actividad-progreso {
    flex: 1;
    min-width: 250px;
}

.gantt-mini-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    height: 40px;
    padding: 0 12px;
    position: relative;
    overflow: hidden;
    --progress: 0%;
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-primary);
}

.gantt-mini-progress::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress);
    background: var(--md-sys-color-primary);
    border-radius: var(--md-sys-shape-corner-small);
    z-index: -1;
    transition: width 0.3s ease;
}

.gantt-mini-progress span {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-primary);
    position: relative;
    z-index: 1;
}

.gantt-subtareas {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding: 12px;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-small);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.gantt-subtarea {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    border-left: 4px solid var(--md-sys-color-primary);
    transition: background-color 0.2s;
}

.gantt-subtarea:hover {
    background: var(--md-sys-color-surface-bright);
}

.gantt-subtarea-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.gantt-subtarea-titulo {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.gantt-subtarea-prioridad {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 500;
}

.prioridad-baja {
    background-color: #E8F5E9;
    color: #1B5E20;
}

.prioridad-media {
    background-color: #FFF3E0;
    color: #E65100;
}

.prioridad-alta {
    background-color: #FFEBEE;
    color: #B71C1C;
}

.gantt-subtarea-barra {
    width: 100%;
    height: 32px;
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    position: relative;
    overflow: hidden;
    --progress: 0%;
}

.gantt-subtarea-barra::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress);
    border-radius: var(--md-sys-shape-corner-small);
    z-index: 1;
    transition: width 0.3s ease;
}

.gantt-subtarea-barra-0::before {
    background: var(--md-sys-color-surface-variant);
}

.gantt-subtarea-barra-25::before {
    background: #D32F2F;
}

.gantt-subtarea-barra-50::before {
    background: #FBC02D;
}

.gantt-subtarea-barra-75::before {
    background: #FBC02D;
}

.gantt-subtarea-barra-100::before {
    background: #388E3C;
}

.gantt-subtarea-barra span {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-primary);
    z-index: 2;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dark mode */
body.dark-mode .gantt-container {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .gantt-row {
    background: rgba(255, 255, 255, 0.02);
}

body.dark-mode .gantt-row:hover {
    background: rgba(208, 188, 255, 0.08);
}

body.dark-mode .gantt-timeline {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .gantt-filter-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Responsive */
@media (max-width: 768px) {
    .gantt-container {
        padding: 16px;
    }

    .gantt-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .gantt-row-label {
        min-width: 100%;
    }

    .gantt-timeline {
        width: 100%;
        min-width: auto;
        min-height: 40px;
        height: 40px;
    }
    
    .gantt-bar {
        min-height: 40px !important;
    }

    .gantt-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .gantt-filters {
        width: 100%;
    }

    #exportarGanttPdf {
        width: 100%;
    }
}

/* ============================================
   ESTILOS PARA SUBTAREAS - Material 3 Expressive
   ============================================ */

/* Contenedor de subtareas en formulario de creación */
.subtareas-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tarjeta de subtarea en formulario de creación */
.subtarea-form-card {
    background: linear-gradient(135deg, var(--md-sys-color-surface-variant) 0%, rgba(127, 127, 127, 0.05) 100%);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subtarea-form-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: var(--md-sys-color-primary);
}

.subtarea-form-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.subtarea-form-header h4 {
    flex: 1;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 13px;
    font-weight: 500;
}

/* Tarjeta de subtarea en visualización */
.subtarea-display-card {
    background: var(--md-sys-color-surface);
    border-left: 4px solid var(--md-sys-color-primary);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-out;
}

.subtarea-display-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.subtarea-display-card.completed {
    opacity: 0.8;
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.05) 0%, transparent 100%);
}

.subtarea-header {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.subtarea-header h5 {
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    font-weight: 500;
}

/* Control de progreso para subtarea */
.subtarea-progress-control {
    padding: 8px 0;
}

.progress-slider-subtarea {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right,
        var(--md-sys-color-primary) 0%,
        var(--md-sys-color-primary) var(--slider-value, 0%),
        var(--md-sys-color-surface-variant) var(--slider-value, 0%),
        var(--md-sys-color-surface-variant) 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.progress-slider-subtarea::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    border: 2px solid var(--md-sys-color-surface);
}

.progress-slider-subtarea::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.progress-slider-subtarea::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--md-sys-color-surface);
    transition: all 0.2s ease;
}

.progress-slider-subtarea::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.progress-slider-subtarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.progress-slider-subtarea:disabled::-webkit-slider-thumb {
    background: var(--md-sys-color-outline-variant);
    cursor: not-allowed;
}

/* Progreso automático para tareas con subtareas */
.progress-control-auto {
    opacity: 0.7;
}

.progress-control-auto .progress-slider {
    cursor: not-allowed;
    opacity: 0.6;
}

.progress-control-auto .progress-slider:disabled::-webkit-slider-thumb {
    background: var(--md-sys-color-outline-variant);
    cursor: not-allowed;
}

/* Modo oscuro para subtareas */
body.dark-mode .subtarea-form-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .subtarea-display-card {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--md-sys-color-primary);
}

body.dark-mode .subtarea-display-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .subtarea-header h5 {
    color: var(--md-sys-color-on-surface);
}

body.dark-mode .progress-slider-subtarea {
    background: linear-gradient(to right,
        var(--md-sys-color-primary) 0%,
        var(--md-sys-color-primary) var(--slider-value, 0%),
        rgba(255, 255, 255, 0.1) var(--slider-value, 0%),
        rgba(255, 255, 255, 0.1) 100%);
}

body.dark-mode .progress-slider-subtarea::-webkit-slider-thumb {
    background: var(--md-sys-color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode .progress-slider-subtarea::-moz-range-thumb {
    background: var(--md-sys-color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Responsive para subtareas */
@media (max-width: 768px) {
    .subtarea-display-card {
        padding: 10px;
    }

    .subtarea-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .progress-slider-subtarea {
        height: 8px;
    }

    .progress-slider-subtarea::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    .progress-slider-subtarea::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
}
/* ============================================
   ESTILOS PARA COMENTARIOS
   ============================================ */

.comentarios-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.comentarios-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.comentarios-header .material-icons {
    font-size: 20px;
    color: var(--md-sys-color-primary);
}

.comentarios-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.btn-agregar-comentario {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--md-sys-color-primary);
    background: transparent;
    color: var(--md-sys-color-primary);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-agregar-comentario:hover {
    background: var(--md-sys-color-primary-container);
}

.btn-agregar-comentario .material-icons {
    font-size: 16px;
}

.comentario-formulario {
    background: var(--md-sys-color-surface-variant);
    padding: 12px;
    border-radius: var(--md-sys-shape-corner-small);
    margin-bottom: 12px;
    transition: max-height 0.3s ease;
}

.comentario-formulario.hidden {
    display: none;
}

.comentario-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface);
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
}

.comentario-textarea:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface);
}

.btn-enviar-comentario {
    padding: 8px 16px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-enviar-comentario:hover:not(:disabled) {
    background: var(--md-sys-color-primary);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-enviar-comentario:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.comentarios-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comentario-item {
    padding: 16px;
    border-left: 4px solid var(--md-sys-color-primary);
    background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, rgba(107, 114, 207, 0.08) 100%);
    border-radius: var(--md-sys-shape-corner-medium);
    animation: slideInLeft 0.3s ease-out;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.comentario-item:hover {
    box-shadow: 0 4px 12px rgba(107, 114, 207, 0.15);
    transform: translateX(4px);
}

.comentario-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.comentario-item-usuario {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.comentario-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.comentario-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comentario-usuario-nombre {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    font-size: 13px;
    margin: 0;
}

.comentario-usuario-rol {
    font-size: 11px;
    color: var(--md-sys-color-primary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comentario-fecha {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
}

.comentario-contenido {
    font-size: 13px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface);
    word-wrap: break-word;
    white-space: pre-wrap;
    margin: 0;
}

/* Dark mode */
body.dark-mode .comentario-item {
    background: linear-gradient(135deg, rgba(107, 114, 207, 0.15) 0%, rgba(107, 114, 207, 0.05) 100%);
    border-left-color: var(--md-sys-color-primary);
}

body.dark-mode .comentario-item:hover {
    box-shadow: 0 4px 12px rgba(107, 114, 207, 0.25);
}

/* Dark mode para comentarios */
body.dark-mode .comentarios-section {
    border-top-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .comentario-formulario {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .comentario-textarea {
    background: rgba(255, 255, 255, 0.05);
    color: var(--md-sys-color-on-surface);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .comentario-textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--md-sys-color-primary);
}

body.dark-mode .comentario-item {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--md-sys-color-primary);
}

body.dark-mode .btn-agregar-comentario {
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

body.dark-mode .btn-agregar-comentario:hover {
    background: rgba(208, 188, 255, 0.1);
}