* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
    padding: 16px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Updated Header Styles */
.header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: bold;
    color: #1f2937;
    flex: 1;
}

.calendar-icon {
    width: 28px;
    height: 28px;
    color: #2563eb;
}

/* Mobile view toggle */
.mobile-view-toggle {
    display: none;
    gap: 4px;
}

.mobile-view-btn {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
}

.mobile-view-btn.active {
    background-color: #2563eb !important;
    color: white !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.desktop-only {
    display: inline;
}

/* Updated: Combined auth button - replaces user profile and connection status */
.auth-button {
    padding: 6px 12px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.auth-button:hover {
    background-color: #1d4ed8;
}

.auth-button.login {
    background-color: #059669;
}

.auth-button.login:hover {
    background-color: #047857;
}

/* Removed: user-profile, status-indicator, and related styles */

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Calendar Section */
.calendar-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Updated: Integrated calendar controls */
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.color-filters {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Updated: Color filters without "All" button, with toggle functionality */
.color-filter {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.5rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0.4; /* Default to inactive */
    transition: all 0.2s ease;

}

.color-filter.active {
    border-color: #1f2937;
    transform: scale(1.2);
    opacity: 1; /* Active filters are fully visible */
}

.color-filter:hover {
    transform: scale(1.1);
    opacity: 0.8;
}
.color-filter.isolated {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 
                0 0 0 5px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
    z-index: 10;
}


/* Prevent text selection on double-click */
.color-filter {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.week-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
}

.week-nav-btn, .page-nav-btn {
    padding: 8px 12px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
}

.week-nav-btn:hover, .page-nav-btn:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.week-nav-btn:disabled, .page-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-nav-btn.drag-over {
    background-color: #dbeafe;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.week-info {
    font-size: 0.9rem;
    color: #6b7280;
    text-align: center;
    min-width: 120px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
    min-height: 500px;
}

.calendar-grid.month-view {
    grid-template-columns: repeat(7, 1fr);
    min-height: 700px;
}

.calendar-grid.mobile-3day {
    grid-template-columns: repeat(3, 1fr);
    min-height: 400px;
}

.day-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    min-height: 320px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.day-card.today {
    border-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.day-card.past {
    background-color: #f9fafb;
    opacity: 0.8;
}

.day-card.other-month {
    opacity: 0.4;
}

.day-card.drag-over {
    border-color: #10b981;
    background-color: #ecfdf5;
    transform: scale(1.02);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.day-header-left {
    flex: 1;
}

.day-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
}

.day-name.today {
    color: #1e40af;
}

.day-date {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 2px;
}

.add-day-todo-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-day-todo-btn:hover {
    background-color: #1d4ed8;
    transform: scale(1.1);
}

.day-todos {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: 240px;
}

/* Todo item with category on top */
.day-todo-item {
    display: flex;
    flex-direction: column;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: move;
    transition: all 0.2s;
    touch-action: none;
    user-select: none;
    overflow: hidden;
    border-left: 3px solid var(--page-color, #6b7280);
}

.day-todo-item:hover {
    background-color: #f3f4f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-todo-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Category header moved to top */
.day-todo-category {
    background-color: var(--page-color, #6b7280);
    color: white;
    padding: 2px 6px;
    font-size: 0.55rem;
    font-weight: 500;
    text-align: left;
    opacity: 0.9;
}

.day-todo-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
}

.todo-checkbox {
    width: 12px;
    height: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.grip-icon {
    width: 10px;
    height: 10px;
    color: #9ca3af;
    flex-shrink: 0;
    font-size: 0.6rem;
}

.day-todo-text {
    flex: 1;
    font-size: 0.75rem;
    line-height: 1.3;
    cursor: text;
}

.empty-day {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Categories Section */
.categories-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    transition: color 0.2s;
}

.page-manager-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-manager-btn:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    max-width: 23cqw;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.category-card.drag-over {
    border-color: #2563eb;
    background-color: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.category-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-bottom: 1px solid #d1d5db;
    cursor: grab;
}

.category-header:active {
    cursor: grabbing;
}

.category-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
}

.category-actions {
    display: flex;
    gap: 6px;
    flex-direction: row-reverse;
}

.category-content {
    padding: 16px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.add-todo-form {
    display: none;
    margin-bottom: 12px;
    gap: 8px;
}

.add-todo-form.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-todo-input {
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.add-todo-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.edit-todo-input {
    padding: 4px 8px;
    border: 1px solid #2563eb;
    border-radius: 4px;
    outline: none;
    font-size: 0.75rem;
    background: white;
    width: 100%;
}

.form-buttons {
    display: flex;
    gap: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: move;
    transition: all 0.2s;
    touch-action: none;
    user-select: none;
}

.todo-item:hover {
    background-color: #f3f4f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.todo-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.todo-text {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.3;
    cursor: text;
}

.scheduled-indicator {
    font-size: 0.7rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.add-page-section {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

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

.btn-success:hover:not(:disabled) {
    background-color: #047857;
}

/* Delete button with cross instead of trash */
.btn-danger {
    background-color: transparent;
    color: #dc2626;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-danger:hover {
    color: #b91c1c;
    background-color: #fef2f2;
    border-color: #fecaca;
}

.done-header button {
    display: none !important;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn-ghost {
    background-color: transparent;
    color: #6b7280;
    border: 2px dashed #d1d5db;
    padding: 12px 16px;
    font-size: 0.9rem;
}

.btn-ghost:hover {
    color: #374151;
    border-color: #9ca3af;
    background-color: #f9fafb;
}

/* Done Section */
.done-section {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    background-color: #f9fafb;
}

.done-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 8px;
}

.done-title {
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.done-count {
    background-color: #e5e7eb;
    color: #6b7280;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.done-content {
    display: none;
}

.done-content.expanded {
    display: block;
}

.chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.chevron.expanded {
    transform: rotate(90deg);
}

.done-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 6px;
    opacity: 0.7;
    cursor: move;
}

.done-text {
    flex: 1;
    font-size: 0.85rem;
    text-decoration: line-through;
    color: #6b7280;
}

/* Modals */
.page-modal, .todo-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
}

.close-modal:hover {
    color: #374151;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 16px;
}

.modal-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.color-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.color-option.selected {
    border-color: #1f2937;
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.2);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.category-section {
    margin-bottom: 16px;
}

.category-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.todo-selection-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selectable-todo {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.selectable-todo:hover {
    background: #e5e7eb;
}

/* Page manager dropdown styles */
.page-manager-dropdown {
    position: relative;
    display: inline-block;
}

.page-manager-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 240px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1000;
    border: 1px solid #e5e7eb;
    margin-top: 4px;
    overflow: hidden;
}

.page-manager-content.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

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

.page-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s;
    font-size: 0.9rem;
    position: relative;
}

.page-dropdown-item:hover {
    background-color: #f9fafb;
}

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

.page-dropdown-item.current-page {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.page-dropdown-item.current-page:hover {
    background-color: #dbeafe;
}

.page-dropdown-item.drag-over {
    background-color: #ecfdf5;
    border-left: 3px solid #10b981;
    transform: scale(1.02);
}

.page-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.page-dropdown-name {
    flex: 1;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: color 0.2s;
}

.page-dropdown-name:hover {
    color: #1f2937;
    text-decoration: underline;
}

.current-page .page-dropdown-name {
    color: #1e40af;
    font-weight: 600;
}

.page-dropdown-actions {
    display: flex;
    gap: 6px;
}

.page-dropdown-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    font-weight: 500;
}

.page-dropdown-btn.edit {
    background-color: #e5e7eb;
    color: #374151;
}

.page-dropdown-btn.delete {
    background-color: #fef2f2;
    color: #dc2626;
}

.page-dropdown-btn:hover.edit {
    background-color: #d1d5db;
}

.page-dropdown-btn:hover.delete {
    background-color: #fecaca;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 4px 0;
}

.add-page-dropdown-item {
    color: #2563eb;
    font-weight: 600;
}

.add-page-dropdown-item:hover {
    background-color: #eff6ff;
}

/* Enhanced Mobile Calendar Styles */

/* Mobile adjustments */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    /* Updated: Hide title and calendar icon on mobile */
    .header h1 {
        display: none;
    }
    
    .calendar-icon {
        display: none;
    }
    
    .header {
        gap: 8px;
        margin-bottom: 16px;
        justify-content: space-between;
        align-items: center;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    /* Show mobile view toggle prominently */
    .mobile-view-toggle {
        display: flex;
        gap: 2px;
        flex: 1;
        justify-content: center;
    }
    
    .mobile-view-btn {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
        border-radius: 4px;
    }
    
    /* Updated: Integrated calendar header on mobile */
    .calendar-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }
    
    .calendar-title {
        display: none; /* Hide calendar title on mobile */
    }
    
    .calendar-controls {
        flex: 1;
        justify-content: space-between;
        gap: 8px;
        align-items: center;
        width: 100%;
    }
    
    .color-filters {
        gap: 3px;
        order: 1;
    }
    
    .week-navigation {
        gap: 8px;
        order: 2;
    }
    
    .color-filter {
        width: 16px;
        height: 16px;
        font-size: 0.45rem;
    }
    
    .week-info {
        min-width: 80px;
        font-size: 0.75rem;
    }
    
    .week-nav-btn {
        padding: 6px 10px;
        font-size: 1rem;
    }
    
    .calendar-section {
        padding: 12px;
        border-radius: 12px;
    }
    
    .calendar-grid {
        gap: 8px;
        min-height: 300px;
    }
    
    /* MOBILE MONTH VIEW - Tiny boxes with dots */
    .calendar-grid.mobile-month {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
        min-height: 240px;
        max-height: 300px;
    }
    
    .calendar-grid.mobile-month .day-card {
        min-height: 32px;
        max-height: 40px;
        padding: 2px;
        font-size: 0.6rem;
        border-radius: 4px;
        border-width: 1px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-day-number {
        font-size: 0.6rem;
        font-weight: 600;
        line-height: 1;
        margin-bottom: 1px;
    }
    
    .mobile-day-dots {
        display: flex;
        gap: 1px;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 20px;
    }
    
    .mobile-day-dot {
        width: 3px;
        height: 3px;
        border-radius: 50%;
        background-color: #3b82f6;
    }
    
    /* MOBILE 3-DAY VIEW - Horizontal scroll */
    .calendar-grid.mobile-3day {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 4px 0 8px 0;
        min-height: 320px;
        max-height: 400px;
    }
    
    .calendar-grid.mobile-3day .day-card {
        flex: 0 0 calc(50vw - 20px);
        max-width: calc(50vw - 20px);
        min-width: 140px;
        scroll-snap-align: start;
        min-height: 300px;
        max-height: 380px;
        overflow: hidden;
    }
    
    /* MOBILE WEEK VIEW - Colored bars only */
    .calendar-grid.mobile-week {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        min-height: 200px;
        max-height: 250px;
    }
    
    .calendar-grid.mobile-week .day-card {
        min-height: 80px;
        max-height: 100px;
        padding: 4px;
        font-size: 0.65rem;
        border-radius: 6px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .mobile-week-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
        min-height: 24px;
    }
    
    .mobile-week-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .mobile-week-name {
        font-size: 0.6rem;
        font-weight: 600;
        line-height: 1;
    }
    
    .mobile-week-date {
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1;
        margin-top: 1px;
    }
    
    .mobile-todo-count {
        background-color: #3b82f6;
        color: white;
        border-radius: 8px;
        padding: 2px 4px;
        font-size: 0.55rem;
        font-weight: 600;
        min-width: 16px;
        text-align: center;
        line-height: 1;
    }
    
    .mobile-week-bars {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1px;
        overflow: hidden;
    }
    
    .mobile-week-bar {
        height: 3px;
        border-radius: 2px;
        background-color: #e5e7eb;
    }
    
    /* Categories section mobile */
    .categories-section {
        padding: 12px;
    }
    
    .categories-header {
        margin-bottom: 12px;
        gap: 8px;
    }
    
    .page-title {
        font-size: 1.1rem;
    }
    
    .page-manager-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .page-navigation {
        gap: 6px;
    }
    
    .page-nav-btn {
        padding: 6px 10px;
        font-size: 1rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .category-card {
        max-width: unset;
    }
    
    .category-header {
        padding: 12px 16px;
        min-height: 50px;
    }
    
    .category-title {
        font-size: 0.9rem;
    }
    
    .category-actions .btn-small {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    .todo-item {
        padding: 6px 10px;
        margin-bottom: 4px;
        font-size: 0.8rem;
    }
    
    .todo-text {
        font-size: 0.8rem;
    }
    
    .add-todo-input {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Done section mobile */
    .done-section-wrapper {
        padding: 12px;
    }
    
    .done-title {
        font-size: 0.8rem;
    }
    
    .done-count {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .done-item {
        padding: 6px 10px;
        margin-bottom: 4px;
        font-size: 0.8rem;
    }
    
    /* Page dropdown mobile */
    .page-manager-content {
        left: -60px;
        min-width: 180px;
        font-size: 0.8rem;
    }
    
    .page-dropdown-item {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .page-dropdown-btn {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    
    /* Add category section mobile */
    .add-category-section {
        margin-top: 16px;
    }
    
    .add-category-form {
        padding: 12px;
        max-width: 100%;
    }
    
    .add-category-input {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Empty state mobile */
    .empty-day {
        font-size: 0.65rem;
        padding: 12px;
    }
    
    /* CRITICAL: Mobile date icon adjustments */
    .scheduled-date-icon {
        width: 18px !important;
        height: 18px !important;
        font-size: 0.5rem !important;
    }
    
    .scheduled-date-icon::before {
        height: 4px !important;
    }
    
    .scheduled-date-number {
        font-size: 0.55rem !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    body {
        padding: 6px;
    }
    
    .calendar-section,
    .categories-section,
    .done-section-wrapper {
        padding: 8px;
        border-radius: 8px;
    }
    
    /* Extra small month view */
    .calendar-grid.mobile-month .day-card {
        min-height: 28px;
        max-height: 32px;
        padding: 1px;
    }
    
    .mobile-day-number {
        font-size: 0.55rem;
    }
    
    .mobile-day-dot {
        width: 2px;
        height: 2px;
    }
    
    /* Extra small 3-day view */
    .calendar-grid.mobile-3day .day-card {
        flex: 0 0 calc(60vw - 16px);
        min-width: 120px;
    }
    
    /* Extra small week view */
    .calendar-grid.mobile-week .day-card {
        min-height: 70px;
        max-height: 80px;
    }
    
    .mobile-week-name {
        font-size: 0.55rem;
    }
    
    .mobile-week-date {
        font-size: 0.7rem;
    }
    
    .mobile-todo-count {
        font-size: 0.5rem;
        padding: 1px 3px;
    }
    
    /* Header scaling for very small screens */
    .mobile-view-btn {
        padding: 3px 6px !important;
        font-size: 0.65rem !important;
    }
    
    .page-manager-content {
        left: -80px;
        min-width: 160px;
        font-size: 0.75rem;
    }
    
    /* CRITICAL: Extra small date icon adjustments */
    .scheduled-date-icon {
        width: 16px !important;
        height: 16px !important;
        font-size: 0.45rem !important;
    }
    
    .scheduled-date-icon::before {
        height: 3px !important;
    }
    
    .scheduled-date-number {
        font-size: 0.5rem !important;
    }
}

/* Custom scrollbar for mobile 3-day view */
.calendar-grid.mobile-3day::-webkit-scrollbar {
    height: 4px;
}

.calendar-grid.mobile-3day::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.calendar-grid.mobile-3day::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.calendar-grid.mobile-3day::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Ensure mobile containers don't overflow */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    .container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .calendar-grid,
    .categories-grid,
    .day-todos {
        width: 100%;
        max-width: 100%;
    }
    
    /* Prevent text overflow in small containers */
    .day-todo-text,
    .todo-text,
    .category-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .calendar-grid.mobile-3day .day-todo-text {
        white-space: normal;
        line-height: 1.2;
        max-height: 2.4em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

/* Custom scrollbar for day todos */
.day-todos::-webkit-scrollbar {
    width: 4px;
}

.day-todos::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.day-todos::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.day-todos::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast-info {
    background-color: #3b82f6;
}

.toast-success {
    background-color: #10b981;
}

.toast-error {
    background-color: #ef4444;
}

.toast-warning {
    background-color: #f59e0b;
}

/* Pull to refresh visual feedback */
.pull-refresh {
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

/* App loaded state */
.app-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Category edit styles */
.category-title-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
}

.category-edit-input {
    width: 100%;
    padding: 4px 8px;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    outline: none;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.category-edit-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.category-page-dropdown {
    width: 100%;
    padding: 4px 8px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    font-size: 0.9rem;
    color: #374151;
    background: white;
    cursor: pointer;
}

.category-page-dropdown:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.category-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.category-edit-btn {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    font-size: 0.8rem;
    padding: 4px 8px;
}

.category-edit-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
    border-color: #9ca3af;
}

.category-save-btn {
    background-color: #059669;
    color: white;
    font-size: 0.8rem;
    padding: 4px 8px;
}

.category-save-btn:hover {
    background-color: #047857;
}

.category-delete-btn {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-size: 0.8rem;
    padding: 4px 8px;
    font-weight: 600;
}

.category-delete-btn:hover {
    background-color: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.category-actions button {
    transition: all 0.2s ease;
}

.category-actions .btn-small {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    border: 1px solid transparent;
}

.category-header {
    position: relative;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-bottom: 1px solid #d1d5db;
    cursor: default;
    align-items: center;
    min-height: 60px;
    display: flex;
    justify-content: space-between;
}

.category-header:has(.category-edit-input:not([style*="display: none"])) {
    cursor: default;
}

.category-card:has(.category-edit-input:not([style*="display: none"])) {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Updated add category section styles */
.add-category-section {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.add-category-form {
    display: none;
    gap: 12px;
    align-items: center;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    width: 100%;
    max-width: 400px;
}

.add-category-form.active {
    display: flex;
}

.add-category-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    font-size: 0.875rem;
}

.add-category-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Done section wrapper styles */
.done-section-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

/* ===== CRITICAL: CALENDAR DATE ICON STYLES ===== */
/* These styles are essential for the date icons to display properly */

.scheduled-date-icon {
    display: inline-flex !important;
    flex-direction: column !important;
    width: 24px !important;
    height: 24px !important;
    background: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 1px !important;
    overflow: hidden !important;
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

.scheduled-date-icon::before {
    content: '' !important;
    display: block !important;
    height: 6px !important;
    background: #ef4444 !important; /* Red stripe at top */
    width: 100% !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.scheduled-date-number {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #1f2937 !important;
    line-height: 1 !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    padding: 1px !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Different colors for different time periods */
.scheduled-date-icon.today::before {
    background: #10b981 !important; /* Green for today */
}

.scheduled-date-icon.past::before {
    background: #6b7280 !important; /* Gray for past */
}

.scheduled-date-icon.future::before {
    background: #3b82f6 !important; /* Blue for future */
}

/* Hover effect */
.scheduled-date-icon:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
}

/* Ensure the container doesn't interfere */
.scheduled-indicator {
    display: flex !important;
    align-items: center !important;
    font-size: 0.7rem !important;
    flex-shrink: 0 !important;
    min-width: 24px !important;
}

/* Debug border for testing - REMOVE THIS AFTER CONFIRMING ICONS WORK */
.scheduled-date-icon {
    /* Temporarily add a visible border to see if icons are being created */
    background: #fff !important;
}

/* When icons are working properly, replace the debug border with this: */
/*
.scheduled-date-icon {
    border: 1px solid #d1d5db !important;
}
*/