:root {
    --bg-color: #f4f6f9;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --glass-bg: rgba(244, 246, 249, 0.88);
    --glass-card: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.6);
    
    /* Accent & System Colors */
    --primary: #3B82F6;
    --primary-light: rgba(59, 130, 246, 0.12);
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.12);
    --danger: #FF3B30;
    --danger-light: rgba(255, 59, 48, 0.12);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.12);
    --purple: #8B5CF6;
    --purple-light: rgba(139, 92, 246, 0.12);

    /* Priority Colors */
    --prio-urgent: #EF4444;
    --prio-high: #F97316;
    --prio-normal: #3B82F6;
    --prio-low: #9CA3AF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* --- Native Feedback Animations --- */
button:active, .icon-btn:active, .fab:active, .tab:active, .project-big-card:active, .banner-btn:active, .date-chip:active, .btn-task-action:active {
    transform: scale(0.93) !important;
    transition: transform 0.1s cubic-bezier(0.25, 1, 0.5, 1) !important;
    opacity: 0.82;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes checkBounce {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.04);
    overflow-x: hidden;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
}

/* Views Navigation Switching */
.app-view {
    display: none;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.app-view.active {
    display: block;
    opacity: 1;
}

.app-view.view-switching,
.app-view.view-switching * {
    pointer-events: none !important;
}

/* SVG Icon Base Styles */
.svg-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

/* --- App Header & Brand --- */
.app-header {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.22);
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.btn-back .svg-icon {
    width: 19px;
    height: 19px;
    stroke-width: 2.2;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000000;
    transform: translateX(-2px);
    border-color: rgba(0, 0, 0, 0.45);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

.brand-logo-card {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    padding: 3.5px;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #111827;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-divider {
    font-size: 14px;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.7;
    user-select: none;
}

.brand-app {
    font-family: 'Caveat', cursive, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #2563EB;
    letter-spacing: 0.5px;
    line-height: 1;
    transform: translateY(-1px);
}

.project-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.project-header-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.project-header-title {
    font-size: 17.5px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

/* Custom Colored Task View Header */
.app-header.custom-color-header {
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1),
                inset 0 1.5px 3px rgba(255, 255, 255, 0.5),
                inset 0 -2px 4px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease;
}

.app-header.custom-color-header .project-header-title {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    font-size: 18px;
}

.app-header.custom-color-header .btn-back,
.app-header.custom-color-header .icon-btn {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-header.custom-color-header .btn-back:hover,
.app-header.custom-color-header .icon-btn:hover {
    background: rgba(255, 255, 255, 0.38);
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.6);
}

.app-header.custom-color-header .icon-btn svg,
.app-header.custom-color-header .btn-back svg {
    stroke: #ffffff !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    color: #4b5563;
    padding: 0;
}

.icon-btn .svg-icon {
    width: 19px;
    height: 19px;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #111827;
    transform: scale(1.05);
}

.header-add-project-btn {
    background: var(--primary-light);
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--primary);
}

.header-add-project-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* --- Sync Status Button & Avatar --- */
.sync-status-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    color: #64748b;
    flex-shrink: 0;
}

.sync-status-btn svg {
    width: 19px;
    height: 19px;
    transition: transform 0.2s ease;
}

.sync-status-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.05);
}

.sync-status-btn:active {
    transform: scale(0.92);
}

.sync-status-btn.synced {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.sync-status-btn.syncing {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.35);
    color: #3b82f6;
}

.sync-status-btn.dirty {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

.sync-status-btn.offline {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.sync-status-btn .spin {
    animation: spinSync 1s linear infinite;
}

@keyframes spinSync {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.user-header-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.user-header-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.user-header-btn:active {
    transform: scale(0.92);
}

.user-avatar-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-default-icon {
    width: 18px;
    height: 18px;
    color: #64748b;
}

.user-initial-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .sync-status-btn,
    .user-header-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }
}


/* --- Search Bar --- */
.search-container {
    padding: 14px 18px 8px;
    position: sticky;
    top: 62px;
    z-index: 40;
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(255, 255, 255, 1);
    border-radius: 22px;
    padding: 9px 16px;
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.search-box:focus-within {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.12), inset 0 1px 2px rgba(255, 255, 255, 1);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.search-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input {
    border: none;
    outline: none;
    font-size: 15px;
    width: 100%;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    background: transparent;
    color: var(--text-main);
}

.clear-search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    padding: 3px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.clear-search-btn.active {
    display: flex;
}

/* --- Projects Page View --- */
.projects-page-header {
    padding: 10px 20px 14px;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-main-title {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.4px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.badge {
    background: #e5e7eb;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.info-btn-subtle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.8;
    margin-left: 2px;
}

.info-btn-subtle:hover {
    opacity: 1;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
    transform: scale(1.1);
}

.info-btn-subtle:active {
    transform: scale(0.95);
}

.info-btn-subtle .svg-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}


/* Projects Grid Container (Hiển thị các dự án gọn gàng) */
.projects-grid-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 18px 90px 18px;
}

.project-card-wrapper {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
}

.project-card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background-color: transparent;
    z-index: 1;
    pointer-events: none;
    transition: background-color 0.15s ease;
}

.project-big-card {
    border-radius: 24px;
    padding: 22px 24px;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.1),
                inset 2px 2px 4px rgba(255, 255, 255, 0.5),
                inset -2px -2px 6px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    position: relative;
    z-index: 2;
    touch-action: pan-y;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 115px;
    justify-content: space-between;
    color: #ffffff !important;
}

.project-big-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15),
                inset 2px 2px 4px rgba(255, 255, 255, 0.7),
                inset -2px -2px 6px rgba(0, 0, 0, 0.08);
}

.project-big-card:active {
    transform: translateY(2px) scale(0.98);
}

.project-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-card-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.project-card-title {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff !important;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.project-arrow-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.project-big-card:hover .project-arrow-btn {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.35);
}

.project-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff !important;
    opacity: 0.95;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.project-progress-bar {
    height: 7px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    overflow: hidden;
}

.project-progress-bar-fill {
    height: 100%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Project Header Color Badge in Tasks View */
.project-header-color-badge {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Card: Chưa có dự án nào */
.project-big-card.create-first-card {
    border: 2px dashed rgba(59, 130, 246, 0.4);
    background: #ffffff !important;
    color: var(--primary) !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 34px 20px;
    gap: 8px;
}

.project-big-card.create-first-card:hover {
    background: var(--primary-light) !important;
}

.project-big-card.create-first-card h3 {
    font-size: 16px;
    font-weight: 800;
}

.project-big-card.create-first-card p {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- Quick Add Inline Box (Modern Redesign) --- */
.quick-add-container {
    padding: 2px 18px 16px;
}

.quick-add-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 22px;
    padding: 6px 8px 6px 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(255, 255, 255, 0.9);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    gap: 10px;
}

.quick-add-box:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
}

.quick-add-box:focus-within {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.16), inset 0 1px 2px #ffffff;
    transform: translateY(-1px);
}

.quick-add-icon-left {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.quick-add-box:focus-within .quick-add-icon-left {
    transform: rotate(90deg);
}

.quick-add-icon-left svg {
    width: 15px;
    height: 15px;
    stroke-width: 2.8;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.quick-task-input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    width: 100%;
    color: #0f172a;
    background: transparent;
    padding: 0;
}

.quick-task-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.quick-add-btn {
    width: 36px;
    height: 36px;
    border-radius: 13px;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    padding: 0;
}

.quick-add-btn svg {
    width: 17px;
    height: 17px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.quick-add-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* --- Tasks List (Swipeable Native Feel) --- */
.tasks-list {
    display: flex;
    flex-direction: column;
    padding: 0 18px 90px 18px;
    gap: 10px;
}

.task-wrapper {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
}

.task-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: transparent;
    z-index: 1;
    pointer-events: none;
    transition: background-color 0.15s ease;
}

.bg-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.bg-action svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    stroke-width: 2.2;
}

.bg-action span {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.task-foreground {
    position: relative;
    padding: 13px 16px;
    border-radius: inherit;
    background: #ffffff;
    border: 1.5px solid #f1f5f9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    z-index: 2;
    cursor: pointer;
    touch-action: pan-y;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.28s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.task-foreground:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    border-color: #e2e8f0;
    transform: translateY(-2px);
}

.task-foreground.completed {
    background: #f8fafc;
    opacity: 0.75;
    border-color: #f1f5f9;
}

.task-main-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

/* Custom SVG Checkbox */
.task-checkbox-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #ffffff;
}

.task-checkbox:hover {
    border-color: #3B82F6;
    transform: scale(1.1);
}

.task-checkbox.checked {
    background: #10B981;
    border-color: #10B981;
    color: #ffffff;
    animation: checkBounce 0.3s ease;
}

.task-checkbox svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.task-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
}

.task-content-box {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.task-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.35;
    word-break: break-word;
    transition: all 0.2s;
}

.task-inline-input {
    width: 100%;
    font-size: 15.5px;
    font-weight: 700;
    font-family: inherit;
    color: #1e293b;
    line-height: 1.35;
    border: none;
    outline: none;
    background: rgba(59, 130, 246, 0.05);
    padding: 3px 6px;
    margin: -3px -6px;
    border-bottom: 2px solid var(--primary);
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15);
    -webkit-user-select: text !important;
    user-select: text !important;
    display: block;
}

.task-foreground.editing {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light), 0 6px 20px rgba(0, 0, 0, 0.06) !important;
    background: #ffffff !important;
    transform: none !important;
}

.task-foreground.completed .task-title {
    text-decoration: line-through;
    color: #94a3b8;
}

.task-note-preview {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Task Meta & Badges */
.task-tags-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.tag-project {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 7px;
    background: #f1f5f9;
    color: #334155;
}

.tag-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.tag-date svg {
    width: 12px;
    height: 12px;
}

.tag-date.overdue {
    color: #DC2626;
    font-weight: 700;
}

.tag-subtasks {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 6px;
}

.tag-subtasks svg {
    width: 12px;
    height: 12px;
}

.task-quick-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-task-action {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.btn-task-action svg {
    width: 14px;
    height: 14px;
}

.btn-task-action:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-task-action.delete:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
}

/* --- Floating Action Button (FAB) (Smooth Spring Micro-animations) --- */
.fab {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom));
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.38),
                0 3px 8px rgba(37, 99, 235, 0.22),
                inset 0 2px 4px rgba(255, 255, 255, 0.5),
                inset 0 -2px 4px rgba(0, 0, 0, 0.12);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease;
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
}

/* Hide FAB in Tasks View (Tasks are added via the top Quick-Add input) */
#tasks-view.active ~ #global-fab {
    display: none !important;
}

@media (min-width: 520px) {
    .fab {
        right: calc(50vw - 260px + 24px);
    }
}

.fab:hover {
    transform: translateY(-3px) scale(1.07);
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.45),
                0 4px 12px rgba(37, 99, 235, 0.25),
                inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.fab:active {
    transform: translateY(2px) scale(0.93);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.fab-icon {
    width: 26px;
    height: 26px;
    stroke: #ffffff;
    stroke-width: 2.6;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.fab:hover .fab-icon {
    transform: rotate(90deg);
}

.fab.pulse .fab-icon {
    transform: rotate(180deg) scale(1.15);
}

/* --- Editor Bottom Sheet / Modal View (Modern Apple/Linear Redesign) --- */
.editor-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.editor-view.active {
    opacity: 1;
    pointer-events: auto;
}

.editor-modal-container {
    background-color: #ffffff;
    width: 100%;
    max-width: 540px;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

.editor-view.active .editor-modal-container {
    transform: translateY(0);
}

.editor-modal-header {
    padding: 16px 20px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.editor-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.icon-btn-subtle {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-subtle:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.icon-btn-subtle.danger {
    color: #ef4444;
    background: #fef2f2;
}

.icon-btn-subtle.danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

.btn-editor-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-editor-save:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.38);
}

.editor-modal-body {
    padding: 18px 22px 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

/* Hero Title */
.editor-hero-title {
    font-size: 20px;
    font-weight: 800;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: #0f172a;
    width: 100%;
    padding: 2px 0 6px;
    border-bottom: 1.5px solid #f1f5f9;
}

.editor-hero-title:focus {
    border-bottom-color: #3B82F6;
}

.editor-hero-title::placeholder {
    color: #94a3b8;
    font-weight: 600;
}


/* --- Project Create/Edit Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 26px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 18px 20px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}

.close-modal-btn {
    background: #f1f5f9;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.close-modal-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: #3B82F6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.project-color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.color-palette-item {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.color-palette-item:hover {
    transform: scale(1.12);
}

.color-palette-item.active {
    transform: scale(1.18);
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 5.5px #3B82F6, 0 4px 10px rgba(0, 0, 0, 0.18);
}

.modal-footer {
    padding: 12px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
}

.btn {
    padding: 9px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: all 0.2s;
}

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

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563EB;
}

/* --- Action Sheet Confirm Modal (iPhone Style) --- */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.action-sheet {
    width: 100%;
    max-width: 520px;
    padding: 0 12px max(24px, env(safe-area-inset-bottom)) 12px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: 'Quicksand', sans-serif;
}

.confirm-modal-overlay.active .action-sheet {
    transform: translateY(0);
}

.action-sheet-group {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 18px;
    margin-bottom: 9px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
}

.action-sheet-group:last-child {
    margin-bottom: 0;
}

.action-sheet-text {
    padding: 15px 18px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    line-height: 1.45;
    font-weight: 600;
}

.action-sheet-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 15px;
    font-size: 16.5px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: background 0.15s;
}

.action-sheet-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.action-sheet-btn.delete {
    color: var(--danger);
    font-weight: 700;
}

.action-sheet-btn.cancel {
    color: var(--primary);
    font-weight: 700;
}

/* --- Info / SEO Modal --- */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.info-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.info-popup-card {
    background: #ffffff;
    width: 100%;
    border-radius: 32px 32px 0 0;
    padding: 26px 20px max(32px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -24px 48px rgba(0, 0, 0, 0.15);
}

.info-popup-overlay.active .info-popup-card {
    transform: translateY(0);
}

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

.info-header h2 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #2563EB, #10B981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-info-btn {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
}

.info-body p {
    font-size: 14.5px;
    line-height: 1.65;
    color: #4b5563;
    margin-bottom: 12px;
}

.info-body p strong {
    color: #111827;
}

.info-body h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
    margin: 20px 0 10px 0;
}

.info-body ul {
    list-style: none;
    padding: 0;
    margin-bottom: 18px;
}

.info-body li {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 10px;
    position: relative;
    padding-left: 16px;
}

.info-body li::before {
    content: "•";
    color: #3B82F6;
    font-weight: bold;
    font-size: 16px;
    position: absolute;
    left: 0;
    top: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 36px 18px;
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-state svg {
    margin-bottom: 4px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}

.toast {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 11px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    animation: slideUpFade 0.3s ease;
}

.toast-btn {
    background: #38BDF8;
    color: #0f172a;
    border: none;
    border-radius: 7px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    margin-left: 10px;
}

/* --- Multi-device & Desktop Optimization --- */
@media (min-width: 600px) {
    body {
        max-width: 580px;
        margin: 20px auto;
        min-height: calc(100vh - 40px);
        min-height: calc(100dvh - 40px);
        border-radius: 30px;
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border-color);
    }

    .app-header {
        border-top-left-radius: 30px;
        border-top-right-radius: 30px;
    }

    .editor-view {
        align-items: center;
        justify-content: center;
    }

    .editor-modal-container {
        border-radius: 28px;
        max-width: 520px;
        box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
        transform: translateY(20px) scale(0.96);
        transition: all 0.28s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .editor-view.active .editor-modal-container {
        transform: translateY(0) scale(1);
    }

    .action-sheet {
        max-width: 580px;
    }

    .info-popup-overlay {
        align-items: center;
    }

    .info-popup-card {
        max-width: 500px;
        border-radius: 28px;
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    .info-popup-overlay.active .info-popup-card {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Laptop / Keyboard Navigation & Focus Visible --- */
input,
textarea,
select,
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
    outline: none !important;
}

button:focus-visible,
.icon-btn:focus-visible,
.btn-back:focus-visible,
.btn:focus-visible,
.btn-editor-save:focus-visible {
    outline: 2.5px solid #3B82F6 !important;
    outline-offset: 2px !important;
}

.project-big-card:focus-visible,
.task-foreground:focus-visible {
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 8px 24px rgba(0, 0, 0, 0.08) !important;
    outline: none !important;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    line-height: 1.2;
    color: #1e293b;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom: 2px solid #94a3b8;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
