/* CSS Variables */
:root {
    --primary-color: #1A73E8;
    --secondary-color: #FFFFFF;
    --accent-color: #F9A825;
    --background: #F5F5F5;
    --surface: #FFFFFF;
    --text-primary: #202124;
    --text-secondary: #5F6368;
    --border-color: #E0E0E0;
    --error-color: #D32F2F;
    --success-color: #4CAF50;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.1);
    --shadow-2: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-3: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-4: 0 8px 16px rgba(0,0,0,0.2);
    --app-bar-height: 56px;
    --bottom-nav-height: 64px;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    position: fixed;
    width: 100%;
    height: 100%;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    max-width: 480px;
    margin: 0 auto;
    background: var(--background);
    position: relative;
    overflow: hidden;
}

/* Top App Bar */
.app-bar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--app-bar-height);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-2);
    z-index: 100;
}

.app-bar h1 {
    font-size: 20px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

/* Content Area */
.content-area {
    flex: 1;
    margin-top: var(--app-bar-height);
    margin-bottom: var(--bottom-nav-height);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* AI Insight Bar & Button */
.ai-insight-bar {
    padding: 12px 16px;
}

.ai-insight-bar-chat {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ai-clear-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.ai-clear-chat-btn:active {
    background: var(--background);
    color: var(--text-primary);
}

.ai-insight-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(26, 115, 232, 0.3);
    border-radius: 20px;
    background: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.ai-insight-btn:active {
    background: rgba(26, 115, 232, 0.15);
    transform: scale(0.98);
}

.ai-insight-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.section-header-with-ai {
    flex-wrap: wrap;
    gap: 8px;
}

.section-header-with-ai .ai-insight-btn {
    margin-left: auto;
}

/* AI Insight Modal */
#insight-modal-overlay {
    align-items: center;
    justify-content: center;
}

#insight-modal-overlay.active {
    display: flex;
}

.insight-modal {
    background: var(--surface);
    border-radius: 16px;
    width: calc(100% - 32px);
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-4);
    animation: scaleIn 0.25s ease-out;
}

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

.insight-modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.insight-modal-body {
    padding: 20px 16px;
    overflow-y: auto;
    min-height: 80px;
}

.insight-loading {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.insight-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.insight-loading span:nth-child(1) { animation-delay: 0s; }
.insight-loading span:nth-child(2) { animation-delay: 0.2s; }
.insight-loading span:nth-child(3) { animation-delay: 0.4s; }

.insight-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    white-space: pre-wrap;
}

.insight-content.hidden {
    display: none;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.text-btn {
    border: none;
    background: transparent;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
}

.text-btn:active {
    background: rgba(26, 115, 232, 0.1);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 16px 16px;
}

.action-card {
    background: var(--surface);
    border: none;
    border-radius: var(--border-radius);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: var(--transition);
}

.action-card:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-2);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-label {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
}

/* Search Bar */
.search-bar {
    margin: 16px;
    background: var(--surface);
    border-radius: 24px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-1);
}

.search-bar svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

/* Filter Chips */
.filter-chips {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.chip:active {
    transform: scale(0.95);
}

.chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Projects List */
#projects-list,
#recent-projects-list {
    padding: 0 16px;
}

.project-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.project-card.status-pending::before {
    background: #F9A825;
}

.project-card.status-in-progress::before {
    background: #1A73E8;
}

.project-card.status-completed::before {
    background: #4CAF50;
}

.project-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-2);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.project-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    margin-right: 12px;
}

.project-menu-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.project-menu-btn:active {
    background: var(--background);
}

.project-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.project-date {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.project-status-badge.pending {
    background: #FFF3E0;
    color: #E65100;
}

.project-status-badge.in-progress {
    background: #E3F2FD;
    color: #1565C0;
}

.project-status-badge.completed {
    background: #E8F5E9;
    color: #2E7D32;
}

/* Project Actions Menu */
.project-actions {
    position: absolute;
    top: 50px;
    right: 16px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-3);
    overflow: hidden;
    z-index: 10;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.project-actions button {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-actions button:active {
    background: var(--background);
}

.project-actions button.delete {
    color: var(--error-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    text-align: center;
    min-height: 400px;
}

.empty-icon {
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
    max-width: 300px;
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
}

.calendar-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 0 16px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day:active {
    transform: scale(0.95);
}

.calendar-day.other-month {
    color: var(--text-secondary);
    opacity: 0.4;
}

.calendar-day.today {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-color);
}

.calendar-day.today.has-event::after {
    background: white;
}

#upcoming-deadlines {
    padding: 0 16px;
}

.deadline-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.deadline-date {
    background: var(--background);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    min-width: 48px;
}

.deadline-day {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.deadline-month {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 2px;
}

.deadline-content {
    flex: 1;
}

.deadline-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.deadline-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--bottom-nav-height);
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
}

.nav-item:active {
    transform: scale(0.95);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    right: calc(50% - 240px + 16px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    transition: var(--transition);
}

.fab:active {
    transform: scale(0.9);
    box-shadow: var(--shadow-2);
}

@media (max-width: 480px) {
    .fab {
        right: 16px;
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    animation: fadeInOverlay 0.3s ease-out;
}

.modal-overlay.active {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Bottom Sheet */
.bottom-sheet {
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.bottom-sheet-header h2 {
    font-size: 20px;
    font-weight: 500;
}

/* Form Styles */
form {
    padding: 24px 16px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
}

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

.btn-primary:active {
    background: #1557B0;
    transform: scale(0.98);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:active {
    background: #B71C1C;
    transform: scale(0.98);
}

/* Dialog */
.dialog {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    width: calc(100% - 64px);
    max-width: 320px;
    margin: auto;
    animation: scaleIn 0.3s ease-out;
}

.modal-overlay:not(.bottom-sheet-modal) {
    align-items: center;
}

.dialog h3 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
}

.dialog p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

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

/* Snackbar */
.snackbar {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: var(--shadow-4);
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease-out;
    max-width: calc(100% - 32px);
}

.snackbar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Scrollbar Styles */
.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Ripple Effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    width: 20px;
    height: 20px;
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

/* Responsive Adjustments */
@media (max-height: 600px) {
    .stats-grid {
        gap: 8px;
        padding: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .section-header {
        padding: 12px 16px 8px;
    }
}

/* AI Chat Styles */
#ai-screen {
    display: none;
}

#ai-screen.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#ai-screen.active .ai-insight-bar {
    flex-shrink: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    margin: auto;
}

.ai-avatar {
    width: 80px;
    height: 80px;
    background: #E3F2FD;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.chat-welcome h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.5;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageIn 0.3s ease-out;
}

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

.chat-message.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    background: var(--surface);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-1);
}

.chat-message.typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.chat-message.typing span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chat-message.typing span:nth-child(1) {
    animation-delay: 0s;
}

.chat-message.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-message.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

.chat-input-container {
    display: none;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: var(--bottom-nav-height);
    width: 100%;
    max-width: 480px;
    padding: 12px 16px;
    padding-bottom: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    z-index: 90;
    flex-shrink: 0;
}

#app.ai-tab-active .chat-input-container {
    display: block;
}

.chat-input-form {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--background);
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
}

.chat-input-form input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    padding: 8px 0;
}

.chat-input-form input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.send-btn:active {
    transform: scale(0.9);
}

.send-btn:disabled {
    background: var(--text-secondary);
    opacity: 0.5;
}

/* Analytics Styles */
.analytics-container {
    padding: 0 16px 16px;
}

.analytics-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-1);
}

.analytics-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.chart-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.donut-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.donut-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-hole span {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.donut-hole small {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.chart-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-label {
    flex: 1;
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 500;
    color: var(--text-primary);
}

.progress-stat {
    margin-top: 8px;
}

.progress-bar-container {
    height: 12px;
    background: var(--background);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #4CAF50);
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-label span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 20px;
}

.timeline-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.timeline-stat-item {
    text-align: center;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.timeline-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-stat-item:first-child .timeline-stat-value {
    color: var(--error-color);
}

.timeline-stat-item:nth-child(2) .timeline-stat-value {
    color: var(--accent-color);
}

.timeline-stat-item:last-child .timeline-stat-value {
    color: var(--success-color);
}

.timeline-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.created {
    background: #E8F5E9;
    color: #4CAF50;
}

.activity-icon.updated {
    background: #E3F2FD;
    color: #1A73E8;
}

.activity-icon.completed {
    background: #F3E5F5;
    color: #9C27B0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.empty-analytics {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Notes Screen */
.notes-ai-generate {
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
}

.notes-ai-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notes-ai-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
}

.notes-ai-form input::placeholder {
    color: var(--text-secondary);
}

.notes-ai-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    min-height: 44px;
}

.notes-ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.notes-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
}

.note-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: var(--transition);
}

.note-card:active {
    transform: scale(0.98);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.note-card-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    margin-right: 8px;
}

.note-card-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.notes-fab {
    display: none;
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    right: 16px;
    z-index: 99;
}

#app.notes-tab-active .notes-fab {
    display: flex;
}

/* Settings Styles */
.settings-container {
    padding: 16px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow-1);
}

.settings-item.clickable {
    cursor: pointer;
    transition: var(--transition);
}

.settings-item.clickable:active {
    background: var(--background);
}

.settings-item.static {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.settings-label {
    font-size: 15px;
    color: var(--text-primary);
}

.settings-label.settings-danger {
    color: var(--error-color);
}

.settings-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-item svg {
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 28px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-1);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

