/* Variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
    --max-width: 1200px;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --slot-height: 60px;
    --slot-border: 1px solid var(--border-color);
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 80px;
}

.nav-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-text {
    font-weight: 500;
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem 0;
}

.app-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Screen base styles */
.screen {
    max-width: 100%;
}

.screen h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.screen h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.screen h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Goal Display */
.goal-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.goal-display::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.goal-display-content {
    position: relative;
    z-index: 2;
}

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

.goal-display-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.goal-edit-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.goal-edit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.goal-text {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.goal-timerange {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.goal-timerange-icon {
    font-size: 1rem;
}

.no-goal-display {
    background: var(--surface-color);
    border: 2px dashed var(--border-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.no-goal-display:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.02);
}

.no-goal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-goal-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.set-goal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.set-goal-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Goal Form Modal */
.goal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.goal-modal {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.goal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
    flex-shrink: 0;
}

.goal-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.goal-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.goal-modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.goal-form {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.goal-form-group {
    margin-bottom: 1.5rem;
}

.goal-form-group:last-child {
    margin-bottom: 0;
}

.goal-form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.goal-form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    transition: var(--transition);
    background-color: var(--surface-color);
    resize: vertical;
}

.goal-form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.goal-form-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.goal-timerange-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.goal-timerange-option {
    position: relative;
}

.goal-timerange-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.goal-timerange-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    background-color: var(--surface-color);
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 80px;
    justify-content: center;
}

.goal-timerange-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.02);
}

.goal-timerange-radio:checked + .goal-timerange-label {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.goal-timerange-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.goal-timerange-text {
    font-weight: 500;
    line-height: 1.2;
}

.goal-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.goal-form-cancel {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.goal-form-cancel:hover {
    background: #475569;
}

.goal-form-save {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.goal-form-save:hover {
    background: var(--primary-hover);
}

.goal-form-save:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Notes Modal */
.notes-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.notes-modal {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.notes-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
    flex-shrink: 0;
}

.notes-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notes-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.notes-modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.notes-form {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.notes-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notes-form-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.notes-form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

.notes-form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.notes-char-counter {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

.notes-preview-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.notes-preview-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.notes-preview-content {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
}

.notes-rendered-content {
    line-height: 1.6;
    word-wrap: break-word;
}

.notes-empty {
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

.notes-link {
    color: var(--primary-color);
    text-decoration: underline;
    word-break: break-all;
    transition: var(--transition);
}

.notes-link:hover {
    color: var(--primary-hover);
}

.notes-image-container {
    margin: 0.75rem 0;
}

.notes-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.notes-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.notes-form-cancel,
.notes-form-save {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.notes-form-cancel {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.notes-form-cancel:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.notes-form-save {
    background-color: var(--primary-color);
    color: white;
}

.notes-form-save:hover {
    background: var(--primary-hover);
}

.view-notes-btn {
    background-color: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}

.view-notes-btn:hover {
    background-color: var(--border-color);
    border-color: var(--text-secondary);
}

/* Forms */
.task-form, .budget-form {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.task-form {
    grid-template-columns: 2fr 1fr 2fr 1fr auto;
}

/* Task notes field in form */
.task-notes-field {
    grid-column: 1 / -1;
}

.task-notes-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-notes-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.task-notes-field textarea::placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.budget-form {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--surface-color);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Buttons */
button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

button:hover {
    background-color: var(--primary-hover);
}

button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #059669;
}

.btn-warning {
    background-color: var(--warning-color);
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-error {
    background-color: var(--error-color);
}

.btn-error:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Filters */
.filters {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filters select {
    min-width: 180px;
}

/* Task selection */
.task-selection {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.progress-bar .progress[style*="100%"] {
    background-color: var(--success-color);
}

/* Task list */
.task-list {
    display: grid;
    gap: 1rem;
}

.task-item {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.task-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.task-info {
    flex: 1;
}

.task-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.task-info p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.duration, .priority {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.5rem;
}

.duration {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.priority {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Priority colors */
.priority-1 { border-left: 4px solid #ef4444; }
.priority-2 { border-left: 4px solid #f97316; }
.priority-3 { border-left: 4px solid #eab308; }
.priority-4 { border-left: 4px solid #84cc16; }
.priority-5 { border-left: 4px solid #22c55e; }
.priority-6 { border-left: 4px solid #06b6d4; }
.priority-7 { border-left: 4px solid #8b5cf6; }

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Budget section */
.budget-section, .rewards-section {
    margin-bottom: 2rem;
}

.reward-item {
    margin-bottom: 1rem;
}

.reward-item input {
    width: 100%;
}

/* Calendar */
.calendar-screen {
    display: grid;
    gap: 2rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.calendar-controls {
    display: flex;
    gap: 0.5rem;
}

.calendar-grid {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.time-slot {
    display: grid;
    grid-template-columns: 100px 1fr;
    border-bottom: var(--slot-border);
    min-height: var(--slot-height);
    transition: var(--transition);
    position: relative;
}

.time-slot:last-child {
    border-bottom: none;
}

.time-slot.available:hover {
    background-color: rgba(37, 99, 235, 0.05);
    cursor: pointer;
}

.time-slot.available .slot-content {
    position: relative;
}

.time-slot.available .slot-content:hover::after {
    content: "Click para asignar tarea";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--text-secondary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.slot-time {
    background-color: var(--background-color);
    padding: 1rem;
    border-right: var(--slot-border);
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    position: sticky;
    left: 0;
    z-index: 5;
}

.slot-content {
    padding: 1rem;
    position: relative;
    min-height: var(--slot-height);
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.slot-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Assigned task base styles */
.assigned-task {
    background-color: rgba(37, 99, 235, 0.1);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: var(--transition);
    overflow: hidden;
}

/* Task span classes for different durations */
.assigned-task.task-span-1 {
    /* 15 minutos - 1 slot */
    min-height: calc(var(--slot-height) - 2px);
}

.assigned-task.task-span-2 {
    /* 30 minutos - 2 slots */
    min-height: calc((var(--slot-height) * 2) - 2px);
}

.assigned-task.task-span-4 {
    /* 60 minutos - 4 slots */
    min-height: calc((var(--slot-height) * 4) - 2px);
}

.assigned-task.task-span-6 {
    /* 90 minutos - 6 slots */
    min-height: calc((var(--slot-height) * 6) - 2px);
}

.assigned-task.task-span-8 {
    /* 120 minutos - 8 slots */
    min-height: calc((var(--slot-height) * 8) - 2px);
}

/* Task position styles para multi-slot */
.time-slot.task-start .assigned-task {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid rgba(37, 99, 235, 0.3);
}

.time-slot.task-middle {
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.time-slot.task-middle .slot-content {
    background: linear-gradient(to right, 
        rgba(37, 99, 235, 0.02) 0%, 
        rgba(37, 99, 235, 0.05) 50%, 
        rgba(37, 99, 235, 0.02) 100%);
    padding: 0;
}

.time-slot.task-middle .slot-time {
    background-color: rgba(37, 99, 235, 0.03);
    color: var(--primary-color);
    font-weight: 400;
    font-size: 0.75rem;
}

.time-slot.task-end .assigned-task {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 1px solid rgba(37, 99, 235, 0.3);
}

.time-slot.task-single .assigned-task {
    border-radius: var(--border-radius);
}

/* Estados de tareas asignadas */
.assigned-task.status-pending {
    background-color: rgba(148, 163, 184, 0.1);
    border-color: var(--secondary-color);
}

.assigned-task.status-doing {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.assigned-task.status-team-doing {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: #06b6d4;
}

.assigned-task.status-blocked {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
    border-style: dashed;
}

.assigned-task.status-needs-work {
    background-color: rgba(249, 115, 22, 0.1);
    border-color: #f97316;
}

.assigned-task.status-completed {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    opacity: 0.8;
}

.assigned-task.status-completed::after {
    content: "✓";
    position: absolute;
    top: 0.5rem;
    right: 2rem;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Task content dentro de assigned-task */
.assigned-task .task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.assigned-task .task-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.3;
    flex: 1;
    margin: 0;
}

.assigned-task .task-timing {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.assigned-task .task-deliverable {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.assigned-task .task-duration {
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background-color: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
}

.assigned-task .task-status {
    margin-top: auto;
}

.status-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) / 2);
    background-color: var(--surface-color);
    font-size: 0.75rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.status-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    outline: none;
}

.unassign-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--error-color);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 10;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.unassign-btn:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

/* Efectos de hover para tareas largas */
.assigned-task:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.assigned-task.task-span-4:hover,
.assigned-task.task-span-6:hover,
.assigned-task.task-span-8:hover {
    box-shadow: 
        0 0 0 1px rgba(37, 99, 235, 0.3),
        0 8px 25px -5px rgba(37, 99, 235, 0.2);
}

/* Indicadores visuales para slots ocupados sin contenido */
.time-slot.assigned:not(.task-start) .slot-content::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, 
        var(--primary-color),
        rgba(37, 99, 235, 0.5));
    z-index: 1;
}

/* Modal de selección de tareas */
.task-selection-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.task-selection-modal {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.modal-content {
    padding: 0;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

.available-tasks-list {
    padding: 0;
}

.task-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.task-option:last-child {
    border-bottom: none;
}

.task-option:hover {
    background-color: var(--background-color);
}

.task-option .task-info {
    flex: 1;
    margin-right: 1rem;
}

.task-option .task-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.task-option .task-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.task-option .task-timing {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.task-option .duration {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.task-option .time-range {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.task-option .priority {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.select-task-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.select-task-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.no-tasks-available {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.no-tasks-available p {
    margin: 0;
    font-style: italic;
}

/* Task status */
.task-status {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.status-item:last-child {
    border-bottom: none;
}

.status-item-info {
    flex: 1;
}

.task-name {
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

.task-details {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.task-details .task-duration {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.task-details .task-priority {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.task-current-status {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.task-current-status.status-pending {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--secondary-color);
}

.task-current-status.status-doing {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.task-current-status.status-team-doing {
    background-color: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.task-current-status.status-blocked {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.task-current-status.status-needs-work {
    background-color: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.task-current-status.status-completed {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    background-color: var(--secondary-color);
    opacity: 0.6;
}

.status-btn.active {
    opacity: 1;
}

.status-btn[data-status="doing"].active { background-color: var(--warning-color); }
.status-btn[data-status="team-doing"].active { background-color: #06b6d4; }
.status-btn[data-status="blocked"].active { background-color: var(--error-color); }
.status-btn[data-status="needs-work"].active { background-color: #f97316; }
.status-btn[data-status="completed"].active { background-color: var(--success-color); }

.no-tasks-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

/* Summary */
.summary-screen {
    display: grid;
    gap: 2rem;
}

.weekly-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.daily-breakdown {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.day-summary {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.day-summary:last-child {
    border-bottom: none;
}

.day-summary h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.day-summary p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.completed-tasks {
    list-style: none;
    padding-left: 1rem;
}

.completed-tasks li {
    position: relative;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.completed-tasks li::before {
    content: "✓";
    position: absolute;
    left: -1rem;
    color: var(--success-color);
    font-weight: bold;
}

/* Calendar legend */
.calendar-legend {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-color.available {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
}

.legend-color.assigned {
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(248, 250, 252, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Footer */
.footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-top: auto;
}

.footer p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Drag and drop */
.draggable-task {
    cursor: move;
}

.dragging {
    opacity: 0.5;
}

.drop-highlight {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: var(--success-color) !important;
}

.drop-invalid {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-color: var(--error-color) !important;
}

/* ========================================
   MOBILE NAVIGATION STYLES
   ======================================== */

/* Hamburger Button (mobile only) */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 110;
}

.hamburger-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    position: relative;
    transition: var(--transition);
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition);
}

.hamburger-icon::before {
    top: -7px;
}

.hamburger-icon::after {
    top: 7px;
}

.hamburger-btn.active .hamburger-icon {
    background-color: transparent;
}

.hamburger-btn.active .hamburger-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.hamburger-btn.active .hamburger-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Mobile Sidebar Menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    z-index: 105;
    opacity: 0;
    pointer-events: none; /* CRÍTICO: No bloquear clicks cuando está invisible */
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.show {
    opacity: 1;
    pointer-events: auto; /* Permitir clicks cuando está visible */
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-lg);
    z-index: 106;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar.show {
    left: 0;
}

.mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
}

.mobile-sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.mobile-sidebar-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.mobile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-size: 1rem;
}

.mobile-menu-item:hover {
    background-color: var(--background-color);
}

.mobile-menu-item .menu-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.workspace-menu-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background-color: var(--background-color);
}

.workspace-menu-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.workspace-menu-item select {
    flex: 1;
}

.workspace-menu-item .btn-icon-small {
    padding: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 1.5rem;
}

.user-info-item {
    cursor: default;
    font-weight: 500;
}

.user-info-item:hover {
    background-color: transparent;
}

.logout-item {
    color: var(--error-color);
    font-weight: 500;
}

.logout-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Bottom Navigation Bar (mobile only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 0.5rem 0;
}

.bottom-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.75rem;
    position: relative;
}

.bottom-nav-btn .nav-icon {
    font-size: 1.5rem;
    transition: var(--transition);
}

.bottom-nav-btn .nav-text {
    font-weight: 500;
}

.bottom-nav-btn:hover {
    color: var(--text-primary);
}

.bottom-nav-btn.active {
    color: var(--primary-color);
}

.bottom-nav-btn.active .nav-icon {
    transform: scale(1.1);
}

/* Indicador visual de sección activa */
.bottom-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 0 0 3px 3px;
    opacity: 0;
    transition: var(--transition);
}

.bottom-nav-btn.active::before {
    opacity: 1;
}

/* ========================================
   END MOBILE NAVIGATION STYLES
   ======================================== */

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --slot-height: 50px;
    }

    /* MOSTRAR hamburger button */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* OCULTAR elementos del header en móvil */
    .header-top {
        justify-content: space-between;
    }

    .header-actions {
        display: none;
    }

    .nav {
        display: none;
    }

    /* MOSTRAR menú móvil */
    .mobile-menu-overlay {
        display: block;
    }

    /* MOSTRAR barra inferior */
    .bottom-nav {
        display: flex;
    }

    /* Ajustar main para dar espacio a la barra inferior */
    .main {
        padding-bottom: calc(2rem + 70px);
    }

    /* Footer ajuste para barra inferior */
    .footer {
        margin-bottom: 70px;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .task-form {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters select {
        min-width: auto;
    }
    
    .task-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .task-actions {
        justify-content: center;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .calendar-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .time-slot {
        grid-template-columns: 80px 1fr;
    }
    
    .slot-time {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .slot-content {
        padding: 0.5rem;
    }
    
    .assigned-task {
        padding: 0.5rem;
    }
    
    .assigned-task .task-title {
        font-size: 0.8rem;
    }
    
    .assigned-task .task-deliverable {
        font-size: 0.7rem;
    }
    
    .status-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .status-buttons {
        justify-content: center;
    }
    
    .weekly-stats {
        grid-template-columns: 1fr;
    }
    
    .task-selection-modal {
        margin: 1rem;
        max-width: none;
        width: auto;
    }
    
    .task-option {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .select-task-btn {
        align-self: center;
    }
    
    .calendar-legend {
        justify-content: flex-start;
    }
    
    /* Goal Display Responsive */
    .goal-display {
        padding: 1rem;
    }
    
    .goal-display-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .goal-edit-btn {
        align-self: stretch;
        text-align: center;
    }
    
    .goal-text {
        font-size: 1.1rem;
    }
    
    .goal-timerange-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .goal-timerange-label {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        min-height: 70px;
    }
    
    .goal-timerange-icon {
        font-size: 1.25rem;
    }
    
    .goal-form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .goal-form-cancel,
    .goal-form-save {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
    
    /* Modal responsive ajustments */
    .goal-modal {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .goal-modal-header {
        padding: 1rem;
    }
    
    .goal-form {
        padding: 1rem;
        max-height: calc(95vh - 100px);
    }
    
    .goal-form-textarea {
        min-height: 80px;
        font-size: 0.9rem;
    }

    /* Notes modal responsive */
    .notes-modal {
        margin: 0.5rem;
        max-height: 95vh;
    }

    .notes-modal-header {
        padding: 1rem;
    }

    .notes-form {
        padding: 1rem;
        max-height: calc(95vh - 100px);
    }

    .notes-form-textarea {
        min-height: 150px;
        font-size: 0.9rem;
    }

    .notes-preview-content {
        max-height: 200px;
    }

    .notes-form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .notes-form-cancel,
    .notes-form-save {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }

    /* Task spans responsivos */
    .assigned-task.task-span-2 {
        min-height: calc((var(--slot-height) * 2) - 2px);
    }
    
    .assigned-task.task-span-4 {
        min-height: calc((var(--slot-height) * 4) - 2px);
    }
    
    .assigned-task.task-span-6 {
        min-height: calc((var(--slot-height) * 6) - 2px);
    }
    
    .assigned-task.task-span-8 {
        min-height: calc((var(--slot-height) * 8) - 2px);
    }
}

@media (max-width: 480px) {
    :root {
        --slot-height: 45px;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .screen h1 {
        font-size: 1.5rem;
    }
    
    .task-form, .budget-form {
        padding: 1rem;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-btn {
        padding: 0.5rem;
    }
    
    .task-selection-modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .task-option {
        padding: 1rem;
    }
    
    .time-slot {
        grid-template-columns: 60px 1fr;
    }
    
    .assigned-task .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .assigned-task .task-timing {
        white-space: normal;
    }
    
    /* Goal responsive para móviles pequeños */
    .goal-timerange-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .goal-timerange-label {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        gap: 0.75rem;
        min-height: 60px;
        padding: 0.75rem;
    }
    
    .goal-timerange-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    
    .goal-timerange-text {
        flex: 1;
    }
    
    /* Modal extra small screens */
    .goal-modal {
        margin: 0.25rem;
        max-height: 98vh;
    }

    .goal-modal-header {
        padding: 0.75rem;
    }

    .goal-modal-title {
        font-size: 1.1rem;
    }

    .goal-form {
        padding: 0.75rem;
        max-height: calc(98vh - 80px);
    }

    .goal-form-actions {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }

    .goal-form-cancel,
    .goal-form-save {
        font-size: 0.8rem;
        padding: 0.75rem 1rem;
    }

    /* Invitation modal extra small screens */
    .invitation-modal {
        margin: 0.25rem;
        margin-bottom: 80px; /* Espacio para bottom-nav */
        max-height: calc(95vh - 80px); /* Restar altura de bottom-nav */
    }

    .invitation-modal .modal-header {
        padding: 0.75rem;
    }

    .invitation-modal .modal-body {
        padding: 0.75rem;
        padding-bottom: 1.5rem; /* Padding extra en la parte inferior */
        max-height: calc(95vh - 150px); /* Ajustar para header + bottom-nav */
        overflow-y: auto;
    }

    .invitation-url-input {
        font-size: 0.8rem;
        padding: 0.625rem;
    }

    #copy-url-btn {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    .invitation-note {
        font-size: 0.75rem;
        margin-bottom: 1rem; /* Espacio extra al final */
    }

    .modal-overlay {
        z-index: 1000; /* Por encima de bottom-nav (z-index: 100) */
    }

    /* Notes modal extra small screens */
    .notes-modal {
        margin: 0.25rem;
        max-height: 98vh;
    }

    .notes-modal-header {
        padding: 0.75rem;
    }

    .notes-modal-title {
        font-size: 1.1rem;
    }

    .notes-form {
        padding: 0.75rem;
        max-height: calc(98vh - 80px);
    }

    .notes-form-textarea {
        min-height: 120px;
        font-size: 0.85rem;
    }

    .notes-preview-content {
        max-height: 150px;
        font-size: 0.9rem;
    }

    .notes-form-cancel,
    .notes-form-save {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    .view-notes-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    /* Invitation modal responsive */
    .invitation-modal {
        margin: 0.5rem;
        margin-bottom: 80px; /* Espacio para bottom-nav */
        max-height: calc(90vh - 80px); /* Restar altura de bottom-nav */
    }

    .invitation-modal .modal-body {
        padding: 1rem;
        padding-bottom: 1.5rem; /* Padding extra en la parte inferior */
        max-height: calc(90vh - 150px); /* Ajustar para header + bottom-nav */
        overflow-y: auto;
    }

    .invitation-result {
        margin-bottom: 1rem;
    }

    .invitation-url-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .invitation-url-input {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.75rem;
    }

    #copy-url-btn {
        width: 100%;
        padding: 0.875rem;
    }
}

/* Workspace Selector Styles */
.workspace-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.workspace-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Workspace Actions Styles */
.workspace-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.btn-header:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.btn-invite-header {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-invite-header:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.workspace-dropdown {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

.workspace-dropdown:hover {
    border-color: var(--primary-color);
}

.workspace-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.btn-icon:hover {
    background-color: var(--primary-hover);
}

/* User Menu Styles */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background-color: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background-color: #dc2626;
}

/* Responsive adjustments for new header */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .workspace-selector {
        flex: 1;
    }

    .workspace-dropdown {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .workspace-selector,
    .user-menu {
        width: 100%;
    }

    .workspace-selector {
        flex-wrap: wrap;
    }

    .workspace-dropdown {
        width: 100%;
    }
}

/* Assignee Selector Component */
.assignee-selector {
    margin: 1rem 0;
}

.assignee-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.assignee-selector-header label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.assignee-clear-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.assignee-clear-btn:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

.assignee-dropdown {
    position: relative;
}

.assignee-dropdown-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.assignee-dropdown-toggle:hover {
    border-color: var(--primary-color);
}

.assignee-selected-text {
    color: var(--text-primary);
}

.assignee-dropdown-arrow {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.assignee-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.assignee-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--surface-color);
}

.assignee-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.assignee-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.assignee-list {
    padding: 0.5rem 0;
}

.assignee-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.assignee-item:hover {
    background-color: var(--background-color);
}

.assignee-item.selected {
    background-color: rgba(37, 99, 235, 0.1);
}

.assignee-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.assignee-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.assignee-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.assignee-item-info {
    flex: 1;
}

.assignee-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.assignee-item-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.assignee-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.assignee-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.assignee-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 999px;
    font-size: 0.8125rem;
}

.assignee-tag-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.625rem;
}

.assignee-tag-name {
    color: var(--text-primary);
    font-weight: 500;
}

.assignee-tag-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.assignee-tag-remove:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--error-color);
}

/* Members List Component */
.members-list-container {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.members-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.members-list-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.members-list-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.members-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-invite {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-invite:hover {
    background-color: var(--primary-hover);
}

.btn-invite-modal {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.members-list-content {
    min-height: 200px;
}

.members-loading,
.members-error,
.members-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.members-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.members-error {
    color: var(--error-color);
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.member-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.member-card:hover {
    box-shadow: var(--shadow);
}

.member-card.current-user {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.you-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 999px;
}

.member-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-badge-owner {
    background-color: rgba(251, 191, 36, 0.1);
    color: #d97706;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.role-badge-admin {
    background-color: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.role-badge-member {
    background-color: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ========================================
   GENERIC MODAL STYLES
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Members Modal Specific Styles */
.members-modal {
    max-width: 600px;
}

.members-modal .modal-body {
    max-height: 600px;
    overflow-y: auto;
}

.members-modal .members-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }

    .modal {
        width: 100%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .members-modal .modal-body {
        max-height: 70vh;
    }

    .members-grid {
        grid-template-columns: 1fr;
    }

    .members-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-invite {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   COMPLETED TASKS SCREEN
   ======================================== */

.completed-tasks-screen {
    display: grid;
    gap: 2rem;
}

.completed-tasks-header {
    background-color: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.completed-count {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
}

.completed-task-list {
    display: grid;
    gap: 1rem;
}

.completed-task-item {
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-left: 4px solid var(--success-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.completed-task-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.completed-task-item .task-info {
    flex: 1;
}

.completed-task-item .task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.completed-task-item h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.completion-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
    margin-left: 1rem;
}

.completed-task-item .task-metadata {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.no-completed-tasks {
    background-color: var(--surface-color);
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.no-completed-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-completed-tasks p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.no-completed-tasks .hint {
    font-size: 0.875rem;
    font-style: italic;
}

/* Summary Actions Button */
.summary-actions {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.view-completed-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid var(--primary-color);
    background-color: white;
    color: var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-completed-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.no-tasks-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .completed-task-item .task-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .completion-date {
        margin-left: 0;
        align-self: flex-start;
    }

    .no-completed-tasks {
        padding: 2rem 1rem;
    }
}