:root {
    /* Base Colors - Light & Airy */
    --bg-color: #f8f9fd;
    --text-color: #1e293b;
    --text-muted: #64748b;

    /* Vibrant Primary Palette */
    --primary-color: #3b82f6; /* Bright Blue */
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;

    --secondary-color: #8b5cf6; /* Purple */
    --secondary-hover: #7c3aed;
    --secondary-light: #ede9fe;

    --accent-color: #10b981; /* Emerald Green */
    --accent-hover: #059669;
    --accent-light: #d1fae5;

    --warning-color: #f59e0b; /* Amber */
    --warning-light: #fef3c7;

    --danger-color: #ef4444; /* Red */
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;

    --info-color: #06b6d4; /* Cyan */
    --info-light: #cffafe;

    --indigo: #6366f1;
    --indigo-light: #e0e7ff;

    --pink: #ec4899;
    --pink-light: #fce7f3;

    --teal: #14b8a6;
    --teal-light: #ccfbf1;

    /* UI Elements */
    --white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 20px 48px rgba(15, 23, 42, 0.15);
    --card-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, #f8f9fd 0%, #e0e7ff 100%);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background Elements */
.gradient-bg {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -1;
    background: linear-gradient(135deg, #f8f9fd 0%, #e0e7ff 50%, #dbeafe 100%);
    opacity: 0.6;
}

.background-blobs {
    display: block;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    width: 500px;
    height: 500px;
}

.blob-1 {
    left: -10%;
    top: -10%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    animation: float 12s ease-in-out infinite;
}

.blob-2 {
    right: -10%;
    top: 20%;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    animation: float 15s ease-in-out infinite reverse;
}

.blob-3 {
    left: 30%;
    bottom: -10%;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    animation: float 18s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    position: sticky;
    top: 0;
    z-index: 140;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.mobile-user {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.hamburger-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-color);
    border-radius: 999px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 120;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fd 50%, #eef2ff 100%);
    backdrop-filter: blur(12px);
    border-right: 2px solid var(--border-color);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 14px;
    transition: var(--transition);
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid transparent;
}

.icon-bubble {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
    font-size: 1rem;
}

.nav-label {
    font-weight: 700;
    color: inherit;
}

.nav-links a:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
    border-color: var(--primary-light);
}

.header-row {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-links a.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.25);
    border-color: transparent;
}

.nav-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 1rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
}

.user-chip .caret {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-chip:hover {
    background: var(--primary-light);
}

.user-chip i {
    color: var(--primary-color);
}
.user-chip {
    margin: 0;
}

.user-menu {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    z-index: 200;
    min-width: 160px;
}

.user-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    border-radius: 8px;
}

.user-menu a:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.user-menu.open {
    display: block;
}

.content {
    flex: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard Header */
header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 8px 20px -8px var(--primary-color);
}

.btn-primary:hover {
    box-shadow: 0 12px 28px -8px var(--primary-color);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-color), var(--teal));
    color: var(--white);
    font-weight: 700;
    box-shadow: 0 8px 20px -8px var(--accent-color);
}

.btn-secondary:hover {
    box-shadow: 0 12px 28px -8px var(--accent-color);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    color: var(--white);
    box-shadow: 0 8px 20px -8px var(--danger-color);
}

.btn-danger:hover {
    box-shadow: 0 12px 28px -8px var(--danger-color);
}

.btn-ghost {
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

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

/* Section Titles */
.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 3px;
    max-width: 150px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--indigo), transparent);
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.75rem;
}

/* Cards */
.card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 2rem;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.card:has(.card-type.hub)::before {
    background: linear-gradient(90deg, var(--accent-color), var(--teal));
}

.card:has(.card-type.hub) {
    background: linear-gradient(135deg, var(--white) 0%, var(--accent-light) 100%);
    border-color: var(--accent-color);
}

.card:has(.card-type.list) {
    background: linear-gradient(135deg, var(--white) 0%, var(--primary-light) 100%);
    border-color: var(--primary-color);
}

.card:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
}

.card:has(.card-type.hub):hover {
    box-shadow: var(--shadow-md);
}

.card:has(.card-type.list):hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.card-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-color);
}

.card-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.card-type.hub {
    background: linear-gradient(135deg, var(--accent-color), var(--teal));
    color: var(--white);
    box-shadow: 0 4px 12px -4px var(--accent-color);
}

.card-type.list {
    background: linear-gradient(135deg, var(--indigo), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 4px 12px -4px var(--indigo);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-top: auto;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--info-color));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.progress-text .btn-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.progress-text .btn-icon.delete:hover {
    background: var(--danger-light);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* List View */
.list-header {
    margin-bottom: 2.5rem;
    background: var(--white);
    padding: 1.5rem 1.75rem;
    border-radius: var(--card-radius);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.list-header.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.list-header.sticky-header.header-hidden {
    transform: translateY(-110%);
    box-shadow: none;
}

.list-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    transition: var(--transition);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.back-link:hover {
    color: var(--primary-color);
    background: var(--primary-light);
    transform: translateX(-4px);
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-item {
    background: var(--white);
    border: 2px solid var(--border-color);
    padding: 1.5rem 1rem 1.5rem 0.25rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

.task-item.menu-open {
    z-index: 200;
}

.task-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.task-item.phase {
    background: linear-gradient(135deg, var(--indigo-light) 0%, var(--secondary-light) 100%) !important;
    border-color: var(--indigo) !important;
    border-width: 3px !important;
    border-left-width: 6px !important;
    box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.2);
    padding: 1.75rem 1rem 1.75rem 0.25rem;
    font-size: 1.1rem;
}

.task-item.phase:hover {
    box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.3);
}

/* Indent tasks that are under a phase */
.task-item.under-phase {
    margin-left: 3rem;
    position: relative;
}

.task-item.under-phase::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background: var(--border-color);
}

.task-item.status-not_started {
    background: var(--white);
    border-color: var(--border-color);
}

.task-item.status-in_progress {
    background: linear-gradient(135deg, var(--white) 0%, var(--warning-light) 100%);
    border-color: var(--warning-color);
    box-shadow: 0 4px 16px -4px rgba(245, 158, 11, 0.2);
}

.task-item.status-in_progress:hover {
    box-shadow: 0 8px 24px -4px rgba(245, 158, 11, 0.3);
}

.task-item.status-done {
    background: linear-gradient(135deg, var(--white) 0%, var(--accent-light) 100%);
    border-color: var(--accent-color);
    box-shadow: 0 4px 16px -4px rgba(16, 185, 129, 0.2);
}

.task-item.status-done:hover {
    box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.3);
}

.task-item.status-done .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Override strikethrough for phases */
.task-item.phase.status-done .task-text {
    text-decoration: none !important;
}

.item-is-hub {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--teal-light) 100%);
    border-color: var(--accent-color);
}

.item-is-hub .task-text {
    color: var(--accent-hover);
    font-weight: 600;
}

.task-content {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    min-width: 0; /* Allows flex items to shrink */
    position: relative;
}

/* Add space between drag handle and task body */
.task-content .drag-handle {
    margin-right: 0.5rem;
}

/* When checkbox appears, shift content to the right */
.task-item:hover .task-content,
body.selection-mode-active .task-content,
.task-item:has(.select-item:checked) .task-content {
    margin-left: 0;
}

/* Checkbox Selection Styling */
.select-item {
    position: relative;
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-color: var(--white);
    border: 2.5px solid var(--border-color);
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
    opacity: 0;
    pointer-events: none;
}

/* Show checkbox on hover or when in selection mode */
body.selection-mode-active .select-item,
.select-item:checked {
    opacity: 1;
    pointer-events: all;
}

@media (min-width: 701px) {
    .task-item:hover .select-item {
        opacity: 1;
        pointer-events: all;
    }
}

/* Hover state for unchecked checkbox */
.select-item:hover:not(:checked) {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}

/* Checked state */
.select-item:checked {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Checkmark */
.select-item:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    user-select: none;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0.5;
    touch-action: none;
}

.drag-handle:hover {
    color: var(--primary-color);
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
    color: var(--secondary-color);
}

.task-item.dragging {
    opacity: 0.6;
    transform: scale(0.98) rotate(2deg);
    border-style: dashed;
    background: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.task-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
}

.task-item.phase .task-text {
    font-weight: 800;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--indigo), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

/* Phase with done status - keep it looking like a phase but with celebration colors */
.task-item.phase.status-done {
    background: linear-gradient(135deg, #ccfbf1 0%, #cffafe 100%) !important;
    border-color: #14b8a6 !important;
    border-width: 3px !important;
    border-left-width: 6px !important;
    box-shadow: 0 4px 16px -4px rgba(20, 184, 166, 0.35) !important;
}

.task-item.phase.status-done:hover {
    box-shadow: 0 8px 24px -4px rgba(20, 184, 166, 0.5) !important;
}

.task-item.phase.status-done .task-text {
    background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
}

/* Add large checkmark before completed phase */
.task-item.phase.status-done .task-text::before {
    content: '✓ ';
    font-size: 1.8rem;
    color: var(--accent-color);
    font-weight: 900;
    background: none;
    -webkit-text-fill-color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.task-description {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.task-notes {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    font-style: italic;
    line-height: 1.4;
}

.phase-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, var(--indigo), var(--secondary-color));
    color: var(--white);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 0.375rem;
    box-shadow: 0 2px 8px -2px var(--indigo);
}

.phase-toggle {
    border: none;
    background: linear-gradient(135deg, var(--indigo-light), var(--secondary-light));
    color: var(--indigo);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--indigo);
    position: relative;
    overflow: hidden;
}

.phase-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--indigo);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.phase-toggle:hover::before {
    width: 100%;
    height: 100%;
}

.phase-toggle i {
    position: relative;
    z-index: 1;
    transition: color 0.25s;
}

.phase-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.phase-toggle:hover i {
    color: var(--white);
}

.phase-toggle:active {
    transform: translateY(0) scale(0.95);
}

.task-item.phase.phase-collapsed {
    border-color: var(--border-color);
    background: #f8fafc;
}

.hidden-by-phase {
    display: none !important;
}

.hidden-by-filter {
    display: none !important;
}

.hub-pill {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--accent-color), var(--teal));
    color: var(--white);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 0.625rem;
    box-shadow: 0 2px 8px -2px var(--accent-color);
}

.task-filter-row {
    margin: 0.75rem 0 1rem;
}

.task-filter-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.task-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    min-width: 190px;
    display: none;
    z-index: 30;
}

.task-filter-menu.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.task-filter-item {
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.9rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    border-radius: 8px;
    transition: var(--transition);
}

.task-filter-item:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
}

.task-filter-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

/* Status Buttons */
.status-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.btn-status {
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-status:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.status-pending {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.status-in_progress {
    background: var(--warning-light);
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.status-done {
    background: var(--accent-light);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-status.active {
    background: linear-gradient(135deg, currentColor, currentColor);
    color: var(--white);
    box-shadow: 0 6px 16px -4px currentColor;
}

.status-in_progress.active {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
}

.status-done.active {
    background: linear-gradient(135deg, var(--accent-color), var(--teal));
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--indigo-light), var(--secondary-light));
    border: 2px solid var(--indigo);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    bottom: 1rem;
    z-index: 150;
}

.bulk-buttons {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.bulk-actions .btn-icon.delete {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

/* Task Actions */
.task-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.task-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

.task-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.task-body {
    flex: 1;
    min-width: 0;
}

/* Icon Buttons */
.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon.delete:hover {
    background: var(--danger-light);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-icon.edit:hover {
    background: var(--info-light);
    color: var(--info-color);
    border-color: var(--info-color);
}

/* Task Actions Dropdown Menu */
.task-actions-dropdown {
    position: relative;
    display: inline-block;
    z-index: 150;
}

.task-actions-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 180px;
    display: none;
    z-index: 100;
}

.task-actions-menu.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.task-actions-menu-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 8px;
    transition: var(--transition);
}

.task-actions-menu-item:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
}

.task-actions-menu-item.danger:hover {
    background: var(--danger-light);
    color: var(--danger-color);
}

.task-actions-menu-item i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

/* Phase Menu Dropdown */
.phase-add-dropdown {
    position: relative;
}

.phase-add-dropdown .phase-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 240px;
    display: none;
    z-index: 20;
}

.phase-add-dropdown .phase-menu.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

.phase-menu-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-radius: 8px;
    transition: var(--transition);
}

.phase-menu-item:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
    transform: translateX(4px);
}

.phase-menu-item i {
    width: 20px;
    text-align: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--card-radius);
    width: 100%;
    max-width: 540px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.625rem;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.125rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Status Dropdown */
.status-dropdown-container {
    position: relative;
    display: inline-block;
}

.status-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.375rem;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
}

.status-dropdown-menu.active {
    display: flex;
}

.status-option {
    padding: 0.625rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.status-option:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
}

/* Mobile & Tablet Responsive */
@media (max-width: 1024px) {
    .mobile-topbar {
        display: flex;
    }

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 82vw);
        height: 100vh;
        transform: translateX(-105%);
        padding: 2rem 1.5rem;
        z-index: 150;
        box-shadow: 0 16px 40px rgba(0,0,0,0.15);
        overflow-y: auto;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        padding: 1.25rem 1rem;
        max-width: 100%;
    }

    .nav-row {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.75rem;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin: 0;
    }

    .user-chip {
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }

.nav-links a.active .icon-bubble {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}


    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
    }

    .task-footer {
        order: 1;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.625rem;
        margin-top: 0.75rem;
    }

    .status-buttons {
        order: -1;
        width: 100%;
        justify-content: flex-start;
    }

    .task-actions {
        gap: 0.5rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
    }

    .btn-status {
        font-size: 0.8rem;
        padding: 0.45rem 0.75rem;
    }

    .list-header .task-actions {
        position: static;
        width: auto;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bulk-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        margin: 0;
        z-index: 300;
    }

    .bulk-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.75rem;
    }

    .blob {
        width: 300px;
        height: 300px;
    }

    .drag-handle {
        opacity: 1;
    }

    /* Reduce indentation on mobile */
    .task-item.under-phase {
        margin-left: 1.5rem;
    }

    .task-item.under-phase::before {
        left: -0.75rem;
        width: 0.5rem;
    }
}

@media (max-width: 700px) {
    .sidebar {
        flex-wrap: wrap;
        padding: 0.75rem 0.95rem;
        gap: 0.6rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.35rem;
    }

    .task-item {
        touch-action: manipulation;
    }

    .task-item:hover {
        transform: none;
    }

    .nav-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.4rem;
    }

    .nav-links a {
        width: 100%;
        justify-content: flex-start;
        text-align: left;
        padding: 0.7rem 0.85rem;
        white-space: nowrap;
    }

    .icon-bubble {
        width: 32px;
        height: 32px;
    }

    .user-chip {
        width: 100%;
        justify-content: flex-start;
        padding: 0.5rem 0.65rem;
    }

    .phase-add-dropdown .phase-menu {
        left: 0;
        right: auto;
        width: min(260px, 92vw);
    }

    .sidebar .nav-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        flex: 1 1 100%;
        gap: 0.35rem;
    }

    .sidebar .nav-links a {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.5rem 0.35rem;
        white-space: normal;
        font-size: 0.85rem;
    }

    .sidebar .icon-bubble {
        width: 30px;
        height: 30px;
    }

    .sidebar .nav-label {
        font-size: 0.85rem;
    }

    .user-menu {
        position: absolute;
        top: 110%;
        right: 0;
        width: 180px;
        margin-top: 0.1rem;
    }

    .task-footer {
        order: 0;
        width: 100%;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.35rem;
    }

    .task-actions {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .task-actions-dropdown {
        flex: 0 0 auto;
        order: 0;
    }

    .status-buttons {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .header-actions {
        gap: 0.4rem;
    }

    .header-actions .btn,
    .header-actions .btn-secondary,
    .header-actions .btn-primary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .list-header {
        padding: 0.9rem 1rem;
        margin-bottom: 1rem;
    }

    .list-header h1 {
        font-size: 1.35rem;
    }

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

    .task-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.875rem;
        touch-action: pan-y;
    }

    /* Position checkbox inline on mobile instead of absolute */
    .select-item {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        order: -1;
    }

    /* Only reveal checkboxes after long-press selection */
    body:not(.selection-mode-active) .select-item {
        opacity: 0;
        pointer-events: none;
    }

    body.selection-mode-active .select-item,
    .select-item:checked,
    .select-item.force-visible {
        opacity: 1;
        pointer-events: all;
    }
}

/* Move Modal Enhancements */
.move-nav-header {
    margin-bottom: 1rem;
}

#move-back-button {
    background: linear-gradient(135deg, var(--border-color), #cbd5e1);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

#move-back-button::before {
    content: '\f060';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

#move-back-button:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.move-step-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

.move-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.move-step-container .btn {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 1rem 1.25rem;
    margin: 0;
    font-size: 0.95rem;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.move-step-container .btn::before {
    display: none;
}

.move-step-container .btn::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: all 0.25s;
}

.move-step-container .btn:hover::after {
    right: 1rem;
    opacity: 1;
    color: var(--primary-color);
}

.move-step-container .btn:hover {
    background: var(--white);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.move-step-container .btn:active {
    transform: scale(0.98);
}

/* Custom scrollbar for move container */
.move-step-container::-webkit-scrollbar {
    width: 8px;
}

.move-step-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.move-step-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

.move-step-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary-hover));
}

/* AI Assistant */
.ai-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.25);
    cursor: pointer;
    z-index: 500;
}

.ai-launcher i {
    font-size: 1.1rem;
}

.notif-launcher {
    position: fixed;
    top: 18px;
    right: 24px;
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 1100;
}

.notif-badge {
    background: var(--danger-color);
    color: white;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.notif-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 360px;
    height: 100%;
    background: var(--white);
    box-shadow: -6px 0 24px rgba(0,0,0,0.12);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.2s ease;
    border-left: 1px solid var(--border-color);
}

.notif-panel.open {
    right: 0;
}

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

.notif-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notif-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notif-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    background: var(--bg-light);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.notif-item.unread {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.notif-item:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
}

.notif-title {
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.notif-body {
    margin: 0;
    color: var(--text-color);
    font-size: 0.95rem;
}

.notif-time {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.ai-panel {
    position: fixed;
    right: 1rem;
    bottom: 4.5rem;
    width: min(420px, 90vw);
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem;
    z-index: 600;
}

.ai-panel.open {
    display: flex;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ai-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ai-messages {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-msg {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    line-height: 1.5;
    max-width: 85%;
}

.ai-msg.user {
    background: #eef2ff;
    align-self: flex-end;
}

.ai-msg.ai {
    background: #e0f2fe;
    align-self: flex-start;
}

.ai-msg.ai strong {
    color: #1e40af;
    font-weight: 600;
}

.ai-msg.ai .ai-project-header {
    color: #0f766e;
    font-size: 1.05rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.35rem;
    margin-top: 0.5rem;
}

.ai-msg.ai .ai-phase-header {
    color: #7c3aed;
    font-size: 1rem;
    font-weight: 600;
    display: block;
    margin-top: 0.4rem;
    margin-bottom: 0.25rem;
    margin-left: 0.5rem;
}

.ai-msg.ai .ai-bullet {
    color: #475569;
    margin-left: 1.25rem;
}

.ai-msg.ai .ai-status {
    display: inline-block;
    font-weight: 600;
    font-size: 1rem;
    margin-right: 0.4rem;
    min-width: 1.1rem;
    text-align: center;
}

.ai-msg.ai .ai-status-todo {
    color: #94a3b8;
}

.ai-msg.ai .ai-status-progress {
    color: #f59e0b;
}

.ai-msg.ai .ai-status-done {
    color: #10b981;
}

.ai-msg.ai br + br {
    display: block;
    content: "";
    margin-top: 0.5rem;
}

.ai-typing {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.35rem 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: aiPulse 1.2s infinite ease-in-out;
}

.ai-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes aiPulse {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}
.ai-input-row {
    display: flex;
    gap: 0.5rem;
}

.ai-input-row textarea {
    resize: none;
    min-height: 60px;
}

.ai-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ai-page-container {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-page-container .ai-messages {
    max-height: 420px;
}

.ai-page-container .ai-input-row textarea {
    min-height: 80px;
}

/* Notes Workspace */
.notes-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto 1fr;
    gap: 1.25rem;
    align-items: flex-start;
}

.notes-header {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

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

.notes-sidebar.card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 75vh;
    overflow: hidden;
}

.notes-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.notes-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notes-list-item {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    background: var(--white);
    color: var(--text-color);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.notes-list-item .note-title {
    font-weight: 600;
    font-size: 1rem;
}

.notes-list-item .note-updated {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.notes-list-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.12);
    background: linear-gradient(135deg, #ffffff, #eef2ff);
}

.notes-list-item:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.notes-editor.card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 70vh;
}

.notes-sidebar.card:hover,
.notes-editor.card:hover {
    transform: none;
    box-shadow: var(--shadow-lg);
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.note-meta input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    font-size: 1.05rem;
    font-weight: 600;
    background: #f8fafc;
    color: var(--text-color);
}

.note-meta input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: var(--white);
}

.note-meta-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.note-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: #f8fafc;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.note-tool {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--white);
    padding: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
    min-width: 40px;
    transition: var(--transition);
}

.note-tool:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.note-font-size {
    min-width: 90px;
    padding: 0.5rem 0.6rem;
    font-weight: 600;
    cursor: pointer;
}

.note-tool-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 0.1rem;
}

.note-editor-surface {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--white);
    min-height: 60vh;
    padding: 1rem 1.1rem;
    font-size: 1rem;
    line-height: 1.6;
    overflow-y: auto;
    cursor: text;
}

.note-editor-surface:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.note-editor-surface:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

.note-editor-surface ul, .note-editor-surface ol {
    padding-left: 1.2rem;
}

.note-editor-surface blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 0.8rem;
    color: var(--text-muted);
    margin: 0.75rem 0;
    font-style: italic;
}

.note-editor-surface code {
    background: #0f172a0d;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.note-editor-surface input[type="checkbox"] {
    accent-color: var(--primary-color);
    margin-right: 0.35rem;
}

.empty-state {
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    background: #f8fafc;
    text-align: center;
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-light);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.setting-title {
    font-weight: 600;
}

.setting-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.setting-row:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
}

@media (max-width: 1024px) {
    .notes-layout {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .notes-sidebar.card {
        max-height: none;
        order: 1;
    }

    .notes-header {
        order: 2;
    }

    .note-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .note-meta-right {
        width: 100%;
    }

    .notes-editor.card {
        order: 3;
    }
}

@media (max-width: 700px) {
    .notes-header {
        margin-bottom: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .notes-header-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .notes-editor.card {
        padding-top: 1rem;
    }

    .notes-header-actions .btn {
        flex: 1 1 48%;
        min-width: 140px;
    }
}

/* Calendar */
.is-hidden {
    display: none;
}

.calendar-month {
    margin-bottom: 1.25rem;
    transform: none;
}

.calendar-month.is-hidden {
    display: none;
}

.calendar-month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.calendar-month-label-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.calendar-month-label {
    font-size: 1.4rem;
    font-weight: 700;
}

.calendar-month-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
}

.calendar-month-cell {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    outline: none;
    padding: 0.6rem;
    min-height: 120px;
    height: 140px;
    max-height: 140px;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    cursor: pointer;
}

.calendar-month-cell.pad {
    visibility: hidden;
}

.calendar-month-cell:hover {
    border-color: rgba(59,130,246,0.25);
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.calendar-month-cell.today {
    border-color: rgba(59,130,246,0.4);
}

.calendar-month-cell.selected {
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 28px rgba(59,130,246,0.12);
}

.calendar-month-cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.calendar-month-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.calendar-month-event {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.3rem;
    border-radius: 8px;
    background: rgba(0,0,0,0.03);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-month-event.phase {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
}

.calendar-month-event .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.calendar-month-event .title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-month-more {
    color: var(--primary-color);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-month-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-month-error {
    grid-column: span 7;
    text-align: center;
    color: var(--text-muted);
    padding: 1rem;
}

/* Quick Add Panel */
.calendar-quick-add-panel {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease-out;
}

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

.calendar-quick-add-panel.is-hidden {
    display: none;
}

.calendar-quick-add-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.calendar-quick-add-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.calendar-quick-add-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

#calendar-month-quick-input {
    flex: 1;
    min-height: 60px;
    resize: vertical;
}

.calendar-help-toggle {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    margin-left: 0.5rem;
}

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

.calendar-syntax-guide {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.syntax-guide-row {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--bg-light);
}

.syntax-guide-row:last-child {
    border-bottom: none;
}

.syntax-guide-row strong {
    color: var(--primary-color);
    font-family: monospace;
    margin-right: 0.5rem;
}

.syntax-guide-row code {
    background: var(--bg-light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.calendar-day-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: visible !important;
}

.calendar-day-view.is-hidden {
    display: none !important;
}

.calendar-page header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Keep calendar cards pinned (no hover float/rotate) */
.calendar-month.card:hover,
.calendar-day-view .card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.calendar-date-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-date-nav .btn-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0.5rem;
}

.calendar-day-label {
    font-size: 1.4rem;
    font-weight: 700;
}

.calendar-day-sub {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.calendar-date-picker {
    padding: 0.4rem 0.6rem;
    font-family: 'Outfit', sans-serif;
    border-radius: 8px;
    font-size: 0.9rem;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#calendar-back-month {
    height: 36px;
    padding: 0.5rem 0.75rem;
}

#calendar-back-month i,
#calendar-menu-btn i {
    margin: 0;
}

#calendar-menu-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0.5rem;
}

#calendar-today-btn {
    height: 36px;
    padding: 0.5rem 0.75rem;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon-text .btn-text {
    display: inline;
}

.btn-icon-only {
    padding: 0.5rem 0.65rem !important;
    min-width: unset !important;
}

.calendar-actions-menu {
    position: relative;
}

.calendar-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 200px;
    padding: 0.5rem;
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-dropdown-menu.active {
    display: flex;
}

.calendar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    color: var(--text-color);
    text-align: left;
    width: 100%;
}

.calendar-menu-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
}

.calendar-menu-item i {
    width: 16px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.calendar-quick-add {
    margin-bottom: 1rem;
    overflow: visible;
}

.quick-add-row textarea {
    width: 100%;
}

.quick-hint {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Autocomplete styles */
.calendar-input-row {
    position: relative;
    overflow: visible;
}

.quick-add-input-wrapper {
    position: relative;
    padding-right: 34px;
    overflow: visible;
}

.calendar-help-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: rgba(59,130,246,0.1);
    color: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
}

.calendar-help-btn:hover {
    background: rgba(59,130,246,0.2);
    transform: translateY(-50%) scale(1.2);
}

.calendar-help-btn i {
    font-size: 0.95rem;
}

.calendar-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
}

.autocomplete-item {
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.15s;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(59,130,246,0.08);
}

.autocomplete-syntax {
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.autocomplete-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.autocomplete-example {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.quick-hint {
    margin-top: 0.5rem;
}

.hint-detected {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(59,130,246,0.1);
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-right: 0.35rem;
    font-weight: 500;
}

.hint-detected.priority-high {
    background: rgba(239,68,68,0.1);
    color: #dc2626;
}

.hint-detected.priority-medium {
    background: rgba(245,158,11,0.1);
    color: #d97706;
}

.hint-detected.priority-low {
    background: rgba(16,185,129,0.1);
    color: #059669;
}

#calendar-day-view .card,
section.card.calendar-board,
.calendar-board.card,
.calendar-board,
.calendar-quick-add.card {
    padding: 1rem;
    overflow: visible !important;
    contain: none !important;
}

/* Ensure calendar page doesn't clip */
#calendar-page,
.calendar-page {
    overflow: visible !important;
}

section.card.calendar-board,
.calendar-board.card,
.calendar-board {
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
}

.calendar-events {
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.calendar-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(16, 185, 129, 0.01) 100%);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    border-left: 3px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.calendar-row:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: rgba(59,130,246,0.15);
    border-left-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.calendar-row.dragging {
    opacity: 0.4;
}

.calendar-row.drag-over {
    outline: 2px dashed rgba(59,130,246,0.4);
}

.calendar-row.phase {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    border-left: 4px solid var(--primary-color);
    grid-template-columns: 1fr auto;
    font-weight: 600;
}

.calendar-row.event {
    grid-template-columns: 24px 1fr auto;
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.08) 0%, rgba(147, 197, 253, 0.02) 100%);
    border-left: 3px solid rgba(147, 197, 253, 0.5);
}

.calendar-row.group {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(168, 85, 247, 0.04) 100%);
    border-left: 3px solid rgba(168, 85, 247, 0.4);
    font-weight: 600;
}

.calendar-row.child-row {
    padding-left: 2rem;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05) 0%, rgba(168, 85, 247, 0.02) 100%);
    border-left: 3px solid rgba(168, 85, 247, 0.3);
}

.calendar-row.done {
    opacity: 0.55;
    background: rgba(0,0,0,0.02);
}

.calendar-row.done input[type="text"] {
    text-decoration: line-through;
}

/* Removed - using margin-bottom instead of border-bottom */

.calendar-row input[type="text"] {
    width: 100%;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    background: rgba(255,255,255,0.5);
    transition: all 0.2s ease;
}

.calendar-row input[type="text"]:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.calendar-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.calendar-title input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.calendar-time-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    font-weight: 600;
    border: 1px solid var(--border-color);
    padding: 0 0.6rem;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.15s ease;
}
.calendar-time-inline .fa-clock { font-size: 0.95rem; }
.calendar-time-inline span { line-height: 1; }
.calendar-time-inline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(59,130,246,0.08);
}
.calendar-time-inline.no-time {
    color: var(--primary-color);
    border: 1px dashed var(--primary-color);
    background: rgba(59, 130, 246, 0.08);
    padding: 0 0.5rem;
    position: relative;
}
.calendar-time-inline.no-time span {
    display: none;
}
.calendar-time-inline.no-time::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    bottom: -1.75rem;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    color: #fff;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.calendar-time-inline.no-time:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.row-left {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-left input[type="checkbox"] {
    margin: 0;
}

.priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.priority-high { background: #ef4444; }
.priority-medium { background: #f59e0b; }
.priority-low { background: #10b981; }

.calendar-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.chip {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chip.reminder { background: rgba(59, 130, 246, 0.12); color: var(--primary-color); }
.chip.rollover { background: rgba(16, 185, 129, 0.12); color: #0f9f73; }

.calendar-actions-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
}

/* Calendar item overflow menu */
.calendar-overflow-menu {
    position: static;
}

.calendar-item-dropdown {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 180px;
    padding: 0.5rem;
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-item-dropdown.active {
    display: flex !important;
    opacity: 1;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

.calendar-item-menu-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-color);
    text-align: left;
    width: 100%;
}

.calendar-item-menu-option:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
}

.calendar-item-menu-option.delete-option:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.calendar-item-menu-option i {
    width: 16px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.calendar-icon-btn.overflow-trigger {
    opacity: 0.6;
}

.calendar-icon-btn.overflow-trigger:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.1);
}

/* Removed secondary button hiding - all buttons always visible */

.group-select {
    min-width: 120px;
    max-width: 160px;
    padding: 0.25rem 0.4rem;
    font-size: 0.9rem;
}

.btn-small {
    padding: 0.4rem 0.65rem;
    font-size: 0.9rem;
}

.calendar-row .drag-btn {
    cursor: grab;
    color: var(--text-muted);
}

.calendar-empty {
    padding: 1.25rem;
    color: var(--text-muted);
    text-align: center;
}

.calendar-event-divider {
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.calendar-event-divider:hover {
    background: rgba(59,130,246,0.05);
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.calendar-event-divider .divider-icon {
    transition: transform 0.2s ease;
}

.calendar-event-divider.collapsed .divider-icon {
    transform: rotate(-90deg);
}

.calendar-event-divider .count-badge {
    background: rgba(59,130,246,0.1);
    color: var(--primary-color);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.calendar-section {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.calendar-section.collapsed {
    max-height: 0 !important;
    opacity: 0;
}

.group-icon {
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.event-left {
    width: 24px;
}

.calendar-prompt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.calendar-prompt-modal.is-hidden {
    display: none !important;
}

.calendar-prompt-modal .calendar-prompt-content {
    width: min(420px, 90vw);
    padding: 1.25rem;
}

.calendar-prompt-message {
    color: var(--text-muted);
    margin: 0.25rem 0 0.75rem;
}

.calendar-prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.calendar-meta-lite {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.calendar-row:hover .calendar-meta-lite {
    display: flex;
}

.meta-chip {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(0,0,0,0.04);
    color: var(--text-muted);
}
.meta-chip.task-link {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: none;
}
.meta-chip.task-link:hover {
    background: rgba(59,130,246,0.12);
    color: var(--primary-color);
}

.meta-chip.phase {
    background: rgba(59,130,246,0.1);
    color: var(--primary-color);
}

.calendar-task-links {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calendar-task-links-header {
    font-weight: 700;
    color: var(--text-color);
}

.calendar-task-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: var(--white);
    border: 1px solid var(--border-color);
}

.calendar-priority-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.calendar-priority-dot:hover {
    transform: scale(1.2);
}

.calendar-priority-dot.priority-high { background: #ef4444; }
.calendar-priority-dot.priority-medium { background: #f59e0b; }
.calendar-priority-dot.priority-low { background: #10b981; }

.calendar-note-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.calendar-icon-btn {
    border: none;
    background: rgba(0,0,0,0.03);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-icon-btn:hover {
    background: rgba(59,130,246,0.1);
    color: var(--primary-color);
    transform: scale(1.05);
}

.calendar-icon-btn.active {
    background: rgba(59, 130, 246, 0.25) !important;
    color: var(--primary-color) !important;
}

.calendar-icon-btn.active i {
    color: var(--primary-color) !important;
}

.calendar-icon-btn.active:hover {
    background: rgba(59, 130, 246, 0.35) !important;
}

.priority-menu {
    position: absolute;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 500;
}

.priority-menu.is-hidden {
    display: none;
}

.priority-menu-item {
    padding: 0.45rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: var(--bg-light);
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.priority-menu-item.active {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    color: var(--primary-color);
}

.priority-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

@media (max-width: 800px) {
    /* Calendar Month Grid - Compact & Consistent */
    .calendar-month-grid {
        gap: 0.25rem;
    }

    .calendar-month-cell {
        min-height: 80px;
        height: 80px;
        max-height: 80px;
        padding: 0.4rem;
        border-radius: 8px;
    }

    .calendar-month-cell-header {
        font-size: 0.9rem;
    }

    .calendar-month-event {
        font-size: 0.75rem;
        padding: 0.2rem 0.25rem;
        border-radius: 4px;
    }

    .calendar-month-event .dot {
        width: 6px;
        height: 6px;
    }

    .calendar-month-more {
        font-size: 0.75rem;
    }

    .calendar-weekdays {
        font-size: 0.85rem;
        gap: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .calendar-month-label {
        font-size: 1.2rem;
    }

    .calendar-month-sub {
        font-size: 0.8rem;
    }

    /* Quick Add Panel - Mobile */
    .calendar-quick-add-panel {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .calendar-quick-add-date {
        font-size: 1rem;
    }

    #calendar-month-quick-input {
        font-size: 0.95rem;
        min-height: 50px;
    }

    .calendar-quick-add-header .btn-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .calendar-help-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .calendar-syntax-guide {
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .syntax-guide-row {
        padding: 0.35rem 0;
    }

    .link-btn {
        font-size: 0.85rem;
    }

    /* Day View - Compact Mobile Layout */
    .calendar-day-view {
        gap: 0.5rem;
    }

    /* Day View Header - Compact Single Row */
    .calendar-page header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.4rem;
        margin-bottom: 0.5rem;
        padding: 0.65rem;
    }

    .calendar-date-nav {
        flex: 1;
        justify-content: flex-start;
        gap: 0.3rem;
        min-width: 0;
    }

    .calendar-actions {
        flex-shrink: 0;
    }

    .calendar-day-label {
        font-size: 0.95rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .calendar-date-display {
        text-align: left;
        flex: 1;
        min-width: 0;
    }

    .calendar-day-sub {
        display: none;
    }

    .calendar-date-picker {
        display: none;
    }

    /* Action Buttons - Touch Friendly */
    .calendar-actions {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .btn-icon-text .btn-text {
        display: none;
    }

    .btn-icon-text {
        padding: 0.6rem !important;
        min-width: 42px !important;
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-actions .btn {
        padding: 0.6rem;
        font-size: 0.9rem;
        min-width: 42px;
        min-height: 42px;
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-actions .btn i {
        font-size: 1.1rem;
    }

    /* Navigation Buttons - Bigger Touch Targets */
    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    /* Calendar Rows - Single Column Layout */
    .calendar-row {
        grid-template-columns: 20px 1fr;
        gap: 0.4rem;
        padding: 0.6rem 0.5rem;
        margin-bottom: 0.3rem;
    }

    .calendar-row.phase {
        grid-template-columns: 1fr;
        padding: 0.5rem 0.6rem;
    }

    .calendar-row.event {
        grid-template-columns: 20px 1fr;
    }

    .calendar-row.group {
        grid-template-columns: 1fr;
        padding: 0.5rem 0.6rem;
    }

    .calendar-row.child-row {
        padding-left: 1rem;
    }

    /* Calendar Title - Better Mobile Layout */
    .calendar-title {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }

    .calendar-title input[type="text"] {
        min-width: 0;
        width: 100%;
        font-size: 0.9rem;
        padding: 0.4rem 0.5rem;
    }

    .calendar-time-inline {
        font-size: 0.75rem;
        order: -1;
    }

    /* Action Buttons Row - Stack on Mobile */
    .calendar-actions-row {
        flex-wrap: wrap;
        gap: 0.25rem;
        margin-top: 0.3rem;
        grid-column: 1 / -1;
    }

    .calendar-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .calendar-priority-dot {
        width: 14px;
        height: 14px;
    }

    /* Quick Add - Mobile Optimized */
    .calendar-quick-add {
        margin-bottom: 0;
        padding: 0.65rem;
    }

    .quick-add-input-wrapper {
        padding-right: 42px;
    }

    .calendar-help-btn {
        width: 36px;
        height: 36px;
    }

    .calendar-help-btn i {
        font-size: 1.05rem;
    }

    #calendar-quick-input {
        font-size: 0.95rem;
        padding: 0.5rem;
        min-height: 50px;
    }

    .quick-hint {
        font-size: 0.8rem;
        margin-top: 0.4rem;
    }

    .calendar-autocomplete {
        max-height: 280px;
    }

    .calendar-input-row {
        margin-bottom: 0.4rem;
    }

    /* Calendar Board - Less Padding */
    .calendar-board {
        padding: 0.65rem;
    }

    .calendar-events {
        gap: 0.3rem;
    }

    /* Event Dividers - Compact */
    .calendar-event-divider {
        padding: 0.4rem 0.5rem;
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
    }

    .calendar-event-divider .count-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.35rem;
    }

    /* Autocomplete - Full Width on Mobile */
    .calendar-autocomplete {
        max-height: 200px;
        border-radius: 10px;
    }

    /* Mobile-friendly dropdown menus */
    .calendar-dropdown-menu,
    .calendar-item-dropdown {
        min-width: 200px;
        box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    }

    .calendar-menu-item,
    .calendar-item-menu-option {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        min-height: 44px;
    }

    .calendar-menu-item i,
    .calendar-item-menu-option i {
        font-size: 1.1rem;
    }

    .calendar-icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

.note-chooser {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 240px;
    overflow-y: auto;
}

.note-chooser-empty {
    color: var(--text-muted);
    padding: 0.5rem;
}

.note-chooser-item {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.note-chooser-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.note-chooser-item.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

.note-chooser-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#date-picker-modal-content {
    max-width: 420px;
}

.linked-note-chip {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.linked-note-chip:hover {
    text-decoration: none;
    opacity: 0.9;
}

    .autocomplete-item {
        padding: 0.55rem 0.75rem;
    }

    .autocomplete-syntax {
        font-size: 0.9rem;
    }

    .autocomplete-description {
        font-size: 0.8rem;
    }

    /* Calendar Prompt Modal */
    .calendar-prompt-modal .calendar-prompt-content {
        width: min(360px, 92vw);
        padding: 1rem;
    }

    .calendar-prompt-actions {
        flex-wrap: wrap;
    }

    .calendar-prompt-actions .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Extra Small Mobile - Even More Compact */
@media (max-width: 480px) {
    .calendar-month-cell {
        min-height: 70px;
        height: 70px;
        max-height: 70px;
        padding: 0.3rem;
    }

    .calendar-month-cell-header {
        font-size: 0.85rem;
    }

    .calendar-month-event {
        font-size: 0.7rem;
        gap: 0.2rem;
    }

    .calendar-weekdays {
        font-size: 0.75rem;
    }

    .calendar-weekdays span {
        font-size: 0.7rem;
    }

    .calendar-day-label {
        font-size: 1.15rem;
    }

    .calendar-actions .btn {
        flex: 1 1 100%;
        font-size: 0.8rem;
    }

    .calendar-row {
        padding: 0.65rem 0.5rem;
    }

    #calendar-quick-input {
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .btn,
    .btn-icon,
    .bulk-actions,
    .task-actions,
    .gradient-bg,
    .background-blobs {
        display: none !important;
    }

    body {
        background: white;
    }

    .task-item {
        break-inside: avoid;
    }
}
