/* ================================================================
   AI Calendar — Modern Design System
   Version 2.0 — Comprehensive UI Revamp
   ================================================================ */

/* ===== CSS CUSTOM PROPERTIES (Design Tokens) ===== */
:root {
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Spacing Scale (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Z-Index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;
    --z-tooltip: 700;

    /* Light Theme Colors */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-muted: #f1f5f9;
    --bg-subtle: #e2e8f0;
    --bg-overlay: rgba(15, 23, 42, 0.4);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    --border-subtle: #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong: #94a3b8;
    --border-color: #cbd5e1;
    --border-radius-sm: 6px;

    /* Accent Colors (Indigo/Violet primary) */
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-primary-light: #e0e7ff;
    --accent-primary-bg: rgba(99, 102, 241, 0.08);

    --accent-success: #10b981;
    --accent-success-light: #d1fae5;
    --accent-success-bg: rgba(16, 185, 129, 0.1);

    --accent-warning: #f59e0b;
    --accent-warning-light: #fef3c7;
    --accent-warning-bg: rgba(245, 158, 11, 0.1);

    --accent-danger: #ef4444;
    --accent-danger-light: #fee2e2;
    --accent-danger-bg: rgba(239, 68, 68, 0.08);

    --accent-info: #3b82f6;
    --accent-info-light: #dbeafe;
    --accent-info-bg: rgba(59, 130, 246, 0.08);

    /* Gradient */
    --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-brand-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);

    /* Interactive States */
    --hover-overlay: rgba(15, 23, 42, 0.04);
    --active-overlay: rgba(15, 23, 42, 0.08);
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-base: #0c0a1a;
    --bg-surface: #151226;
    --bg-elevated: #1e1b32;
    --bg-primary: #1e1b32;
    --bg-secondary: #151226;
    --bg-muted: #252240;
    --bg-subtle: #2d2a4a;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --border-subtle: #2d2a4a;
    --border-default: #3d3860;
    --border-strong: #5b5480;
    --border-color: #3d3860;
    --border-radius-sm: 6px;

    --accent-primary: #818cf8;
    --accent-primary-hover: #6366f1;
    --accent-primary-light: rgba(129, 140, 248, 0.15);
    --accent-primary-bg: rgba(129, 140, 248, 0.1);

    --accent-success: #34d399;
    --accent-success-light: rgba(52, 211, 153, 0.15);

    --accent-warning: #fbbf24;
    --accent-warning-light: rgba(251, 191, 36, 0.15);

    --accent-danger: #f87171;
    --accent-danger-light: rgba(248, 113, 113, 0.15);

    --accent-info: #60a5fa;
    --accent-info-light: rgba(96, 165, 250, 0.15);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(129, 140, 248, 0.2);

    --hover-overlay: rgba(255, 255, 255, 0.04);
    --active-overlay: rgba(255, 255, 255, 0.08);
    --focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    transition: background-color var(--duration-normal) var(--ease-out),
                color var(--duration-normal) var(--ease-out);
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.8;
}

.hidden { display: none !important; }

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* ===== FOCUS STYLES ===== */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ================================================================
   AUTHENTICATION
   ================================================================ */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: var(--gradient-brand-subtle);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatBlob 20s ease-in-out infinite;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.10) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatBlob 25s ease-in-out infinite reverse;
}

@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

.auth-card {
    background-color: var(--bg-surface);
    padding: var(--space-10);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-subtle);
    animation: authSlideUp 0.5s var(--ease-out);
    position: relative;
    z-index: 1;
}

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-header h2 {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="datetime-local"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-muted);
    color: var(--text-primary);
    font-size: var(--text-base);
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--border-default);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
}

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

.form-group.check-group {
    display: flex;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-muted);
    color: var(--text-primary);
    border: 1.5px solid var(--border-subtle);
}

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-default);
}

.btn-danger {
    background-color: var(--accent-danger);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-success {
    background-color: var(--accent-success);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid transparent;
}

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

.btn-intelligence {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}

.btn-intelligence:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
    transform: translateY(-1px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-md);
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--duration-fast);
}

.auth-footer a:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ================================================================
   APP LAYOUT
   ================================================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-6);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    z-index: var(--z-sticky);
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .app-header {
    background-color: rgba(21, 18, 38, 0.85);
}

[data-theme="dark"] .notifications-drawer {
    background-color: rgba(21, 18, 38, 0.9);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.logo {
    font-size: var(--text-xl);
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    margin-right: var(--space-2);
}

/* Navigation Tabs */
.header-nav {
    display: flex;
    gap: var(--space-1);
    background-color: var(--bg-muted);
    padding: var(--space-1);
    border-radius: var(--radius-md);
}

.nav-tab {
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.nav-tab.active {
    color: var(--accent-primary);
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--gradient-brand);
    border-radius: var(--radius-full);
}

/* Quick Add */
.quick-add-container {
    display: flex;
    flex: 1;
    max-width: 480px;
    margin: 0 var(--space-6);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1.5px solid var(--border-subtle);
    background-color: var(--bg-muted);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.quick-add-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
}

#quick-add-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 10px 18px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

#quick-add-btn {
    border-radius: 0;
    font-size: var(--text-sm);
    padding: 8px 18px;
}

/* Header Widgets */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
}

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

.bell-wrapper {
    position: relative;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent-danger);
    color: white;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: var(--radius-full);
    font-weight: 700;
    animation: badgePop 0.3s var(--ease-out);
}

@keyframes badgePop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.user-email {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Theme Switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border-default);
    transition: var(--duration-normal);
    border-radius: 26px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--duration-normal) var(--ease-out);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .switch-slider {
    background: var(--gradient-brand);
}

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

/* ================================================================
   WORKSPACE LAYOUT
   ================================================================ */
.app-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    min-width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    overflow-y: auto;
    transition: all var(--duration-slow) var(--ease-in-out);
}

/* Sidebar Navigation Buttons */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-align: left;
    width: 100%;
}

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

.sidebar-nav-btn.active {
    background-color: var(--accent-primary-bg);
    color: var(--accent-primary);
    font-weight: 600;
}

/* Sidebar Tasks Section */
.tasks-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-section h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    font-weight: 700;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-btn {
    background: none;
    border: none;
    font-size: var(--text-sm);
    cursor: pointer;
    color: var(--accent-primary);
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.add-btn:hover {
    background-color: var(--accent-primary-bg);
}

/* Calendars List */
.calendars-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.calendar-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.calendar-list-item:hover {
    background-color: var(--hover-overlay);
}

.calendar-item-actions {
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.calendar-list-item:hover .calendar-item-actions {
    opacity: 1;
}

.calendar-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.calendar-item-actions button:hover {
    background-color: var(--hover-overlay);
}

/* Custom Checkbox (used throughout) */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    user-select: none;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-muted);
    border: 1.5px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
}

.custom-checkbox:hover .checkmark {
    border-color: var(--accent-primary);
    background-color: var(--accent-primary-light);
}

.custom-checkbox input:checked ~ .checkmark {
    background: var(--gradient-brand);
    border-color: transparent;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Help Section */
.help-section {
    margin-top: auto;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--gradient-brand-subtle);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    line-height: 1.5;
    border: 1px solid var(--border-subtle);
}

kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-mono);
    box-shadow: 0 1px 0 var(--border-subtle);
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    min-width: 0;
}

.view-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: tabSlideIn 0.35s var(--ease-out);
}

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

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

/* ================================================================
   CALENDAR VIEW
   ================================================================ */
.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    gap: var(--space-4);
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toolbar-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto;
}

.quick-add-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 4px 6px 4px 14px;
    width: 100%;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease, background-color var(--duration-fast) ease;
    box-shadow: var(--shadow-xs);
}

.quick-add-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-bg), var(--shadow-sm);
    background: var(--bg-elevated);
}

.quick-add-icon {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.quick-add-bar input[type="text"] {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--text-sm);
    color: var(--text-primary);
    outline: none;
    padding: 4px 0;
    min-width: 0;
}

.quick-add-bar input[type="text"]::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.quick-add-bar .btn {
    flex-shrink: 0;
    border-radius: var(--radius-full) !important;
    padding: 4px 14px;
    font-size: var(--text-xs);
}

.calendar-title-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-left: var(--space-2);
    transition: opacity 0.15s ease, transform 0.15s ease;
    display: inline-block;
}

/* Live Clock in toolbar */
.live-clock {
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent-primary);
    background: var(--accent-primary-bg);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    margin-left: var(--space-3);
    letter-spacing: 0.02em;
    min-width: 160px;
    text-align: center;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}
.live-clock:hover {
    background: var(--accent-primary-light);
}

.clock-time {
    font-weight: 700;
}

.clock-date {
    font-weight: 500;
    opacity: 0.7;
    font-size: var(--text-xs);
    padding-left: 6px;
    border-left: 1px solid rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .clock-date {
    border-left-color: rgba(129, 140, 248, 0.3);
}

/* Go to Date Picker */
.goto-date-wrapper {
    display: flex;
    align-items: center;
    margin-left: var(--space-3);
    position: relative;
}

.goto-date-input {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-muted);
    color: transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    flex-shrink: 0;
}

.goto-date-input:hover {
    border-color: var(--accent-primary);
    background-color: var(--accent-primary-bg);
    box-shadow: var(--shadow-sm);
}

.goto-date-input:focus,
.goto-date-input:active {
    width: 140px;
    padding: 6px 10px;
    color: var(--text-primary);
    background-image: none;
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.goto-date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Today button pulse when not on today's date */
#cal-today-btn.not-today {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0); }
}

/* ===== DASHBOARD STATS BAR ===== */
.dashboard-stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 2fr 0.8fr;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-muted) 100%);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-primary-bg);
}

.stat-card.stat-overdue.has-overdue {
    border-color: var(--accent-danger);
    background: var(--accent-danger-bg);
    animation: pulse-warn 2s infinite;
}

@keyframes pulse-warn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.stat-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-upcoming-info {
    flex: 1;
}

.stat-upcoming-list {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Next event countdown highlight */
.stat-upcoming-list[style*="⏱"] {
    font-weight: 600;
}

.stat-upcoming-countdown {
    color: var(--accent-primary);
    font-weight: 600;
}

/* ===== Calendar Drag Ghost ===== */
.calendar-drag-ghost {
    position: fixed;
    top: -1000px;
    left: -1000px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: var(--shadow-lg);
    opacity: 0.92;
    pointer-events: none;
    z-index: 10000;
}

@media (max-width: 900px) {
    .dashboard-stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-4);
    }
    .stat-card.stat-upcoming {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .dashboard-stats-bar {
        grid-template-columns: 1fr;
    }
}

.custom-select {
    padding: 8px 32px 8px 12px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-muted);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.custom-select:hover {
    border-color: var(--border-default);
}

.custom-select:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.select-sm {
    padding: 6px 24px 6px 10px;
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

/* Calendar Layout */
.calendar-layout {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.calendar-grid-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg-surface);
    min-width: 0;
}

/* View switch fade animation */
.calendar-grid-view.view-fade-in {
    animation: viewFadeIn 0.25s var(--ease-out);
}

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

/* Floating "Back to Today" button for week/day views */
.back-to-today-fab {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    padding: 10px 18px;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg), 0 0 0 0 rgba(99, 102, 241, 0.3);
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fabSlideIn 0.3s var(--ease-out);
}

.back-to-today-fab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.back-to-today-fab:active {
    transform: translateY(0);
}

@keyframes fabSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.back-to-today-fab.hidden {
    display: none;
}

[data-theme="dark"] .back-to-today-fab {
    background: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(129, 140, 248, 0.3);
}

/* ===== SKELETON LOADER ===== */
.cal-skeleton {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: var(--space-4);
    height: 100%;
}

.cal-skeleton-cell {
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
    border-radius: var(--radius-sm);
    min-height: 100px;
}

.cal-skeleton-cell:nth-child(even) {
    animation-delay: 0.3s;
}

/* Todo skeleton loader */
.todo-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

.todo-skeleton-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.todo-skeleton-check {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
    flex-shrink: 0;
}

.todo-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
}

.todo-skeleton-item:nth-child(1) .todo-skeleton-line { width: 65%; animation-delay: 0s; }
.todo-skeleton-item:nth-child(2) .todo-skeleton-line { width: 80%; animation-delay: 0.15s; }
.todo-skeleton-item:nth-child(3) .todo-skeleton-line { width: 50%; animation-delay: 0.3s; }
.todo-skeleton-item:nth-child(4) .todo-skeleton-line { width: 72%; animation-delay: 0.45s; }

/* Notes skeleton loader */
.notes-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
    padding: var(--space-2);
}

.notes-skeleton-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.notes-skeleton-title {
    height: 16px;
    width: 60%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
}

.notes-skeleton-text {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
}

.notes-skeleton-card:nth-child(1) .notes-skeleton-text { width: 100%; }
.notes-skeleton-card:nth-child(2) .notes-skeleton-text { width: 85%; animation-delay: 0.1s; }
.notes-skeleton-card:nth-child(3) .notes-skeleton-text { width: 92%; animation-delay: 0.2s; }
.notes-skeleton-card:nth-child(4) .notes-skeleton-text { width: 78%; animation-delay: 0.3s; }
.notes-skeleton-card:nth-child(odd) .notes-skeleton-title { animation-delay: 0.1s; }

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

/* Agent Task skeleton loader */
.agent-task-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-4);
}

.agent-task-skeleton-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border-left: 4px solid var(--border-default);
}

.agent-task-skeleton-title {
    height: 16px;
    width: 65%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
    margin-bottom: var(--space-3);
}

.agent-task-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--skeleton-shimmer, rgba(156, 163, 175, 0.15)) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite var(--ease-in-out);
    margin-bottom: var(--space-2);
}

.agent-task-skeleton-card:nth-child(1) .agent-task-skeleton-title { width: 65%; }
.agent-task-skeleton-card:nth-child(2) .agent-task-skeleton-title { width: 80%; animation-delay: 0.1s; }
.agent-task-skeleton-card:nth-child(3) .agent-task-skeleton-title { width: 50%; animation-delay: 0.2s; }
.agent-task-skeleton-card:nth-child(1) .agent-task-skeleton-line { width: 90%; }
.agent-task-skeleton-card:nth-child(2) .agent-task-skeleton-line { width: 75%; animation-delay: 0.1s; }
.agent-task-skeleton-card:nth-child(3) .agent-task-skeleton-line { width: 85%; animation-delay: 0.2s; }

/* ===== MONTH GRID ===== */
.grid-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(120px, 1fr);
    min-height: 100%;
}

.grid-day-label {
    padding: var(--space-3) 0;
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}

.month-day-cell {
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: background-color var(--duration-fast);
    cursor: pointer;
}

.month-day-cell:hover {
    background-color: var(--accent-primary-bg);
}

.month-day-cell:hover::after {
    content: '+';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    opacity: 0.7;
    pointer-events: none;
    transition: opacity var(--duration-fast);
}

/* Calendar Empty State */
.calendar-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    text-align: center;
    color: var(--text-tertiary);
}

.calendar-empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.6;
    animation: floatGentle 3s ease-in-out infinite;
}

@keyframes floatGentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.calendar-empty-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.calendar-empty-text {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.calendar-empty-text kbd {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
}

.month-day-cell.other-month {
    background-color: var(--bg-base);
    opacity: 0.4;
}

.day-number-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-1);
}

.day-number {
    font-size: var(--text-sm);
    font-weight: 600;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--duration-fast);
}

.month-day-cell.today .day-number {
    background: var(--gradient-brand);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.day-events-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendar-event-pill {
    font-size: var(--text-xs);
    color: var(--text-primary);
    padding: 3px 8px 3px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    transition: all var(--duration-fast);
    font-weight: 500;
    background-color: var(--bg-muted);
    border-left: 3px solid var(--pill-color, var(--accent-primary));
    position: relative;
}

.calendar-event-pill:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
    background-color: var(--accent-primary-bg);
}

.event-pill-time {
    font-weight: 700;
    margin-right: 4px;
    opacity: 0.9;
}

.calendar-more-events {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    background-color: var(--accent-primary-bg);
    transition: all var(--duration-fast);
    user-select: none;
    margin-top: 1px;
}

.calendar-more-events:hover {
    background-color: var(--accent-primary-light);
    transform: scale(1.02);
}

[data-theme="dark"] .calendar-more-events {
    color: var(--accent-primary);
    background-color: rgba(129, 140, 248, 0.12);
}

[data-theme="dark"] .calendar-more-events:hover {
    background-color: rgba(129, 140, 248, 0.22);
}

.drag-hover {
    background-color: var(--accent-primary-bg) !important;
    border: 2px dashed var(--accent-primary) !important;
}

/* ===== WEEK GRID ===== */
.grid-week {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    grid-auto-rows: 48px;
    min-height: max-content;
    height: auto;
}

.week-header-cell {
    padding: var(--space-2) var(--space-1);
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    background-color: var(--bg-muted);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.week-header-cell.today {
    color: var(--accent-primary);
    background-color: var(--accent-primary-bg);
}

.week-header-cell.today .week-day-num {
    background: var(--gradient-brand);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.week-day-name {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.week-time-label-cell {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-align: right;
    padding-right: var(--space-2);
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    transform: translateY(-8px);
    background-color: var(--bg-muted);
}

/* Current-time indicator in week/day views */
.current-time-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
    animation: pulseLine 2s ease-in-out infinite;
}

@keyframes pulseLine {
    0%, 100% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.7); }
}

/* All-day event row in week/day views */
.all-day-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
    min-height: 28px;
}

.all-day-cell {
    min-height: 28px !important;
    padding: 2px 4px !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-muted);
    border-bottom: 2px solid var(--border-subtle) !important;
}

.all-day-pill {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    padding: 3px 8px !important;
    font-size: 0.7rem;
    border-radius: 4px;
    margin-bottom: 1px;
}

.current-time-indicator::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
}

.current-time-label {
    color: #ef4444 !important;
    font-weight: 700 !important;
}

.current-time-label-text {
    background: #ef4444;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
}

.week-hour-cell {
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    padding: 2px;
    cursor: pointer;
    transition: background-color var(--duration-fast);
}

.week-hour-cell:hover {
    background-color: var(--accent-primary-bg);
}

.week-event-card {
    position: absolute;
    left: 2px;
    right: 2px;
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-size: var(--text-xs);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    transition: all var(--duration-fast);
    background-color: var(--bg-surface);
}

.week-event-card:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
    z-index: 15;
}

/* Overlapping events — visual conflict indicator */
.week-event-card.has-overlap {
    border-top: 2px solid var(--accent-warning);
    box-shadow: var(--shadow-xs), inset 0 0 0 1px rgba(245, 158, 11, 0.15);
}

.week-event-card.has-overlap::after {
    content: '⚠';
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.55rem;
    opacity: 0.6;
    line-height: 1;
}

.week-event-card.has-overlap .event-card-title {
    padding-right: 10px; /* avoid overlap with warning icon */
}

.event-card-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.7rem;
    line-height: 1.2;
}

.event-card-time {
    color: var(--text-tertiary);
    font-size: 0.65rem;
}

/* ===== DAY GRID ===== */
.grid-day {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-auto-rows: 58px;
    min-height: max-content;
    height: auto;
}

.day-header-cell {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-muted);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.day-view-cell {
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color var(--duration-fast);
}

.day-view-cell:hover {
    background-color: var(--accent-primary-bg);
}

.day-view-card {
    padding: var(--space-2);
}

.event-card-desc {
    font-size: var(--text-xs);
    margin-top: 2px;
    color: var(--text-secondary);
}

/* ================================================================
   TASKS (in sidebar)
   ================================================================ */
.todos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-2);
}

.todos-header h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Priority Filter Chips */
.todo-priority-filter {
    display: flex;
    gap: 4px;
    padding: var(--space-1) 0 var(--space-2) 0;
    flex-wrap: wrap;
}

.priority-filter-chip {
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.priority-filter-chip:hover {
    background: var(--bg-subtle);
    border-color: var(--border-default);
}

.priority-filter-chip.active {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

[data-theme="dark"] .priority-filter-chip.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border-color: #818cf8;
}

.priority-filter-chip .chip-count {
    display: inline-block;
    margin-left: 3px;
    padding: 0 4px;
    font-size: 0.6rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
    line-height: 1.3;
}

.priority-filter-chip.active .chip-count {
    background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .priority-filter-chip .chip-count {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .priority-filter-chip.active .chip-count {
    background: rgba(129, 140, 248, 0.25);
}

/* Overdue badge in Tasks header */
.overdue-badge {
    background: var(--accent-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    animation: overduePulse 2s ease-in-out infinite;
    text-transform: none;
    letter-spacing: 0;
}

@keyframes overduePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Task Alert Banner (overdue/due-today summary) */
.task-alert-banner {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    font-weight: 600;
    animation: fadeInUp 0.3s var(--ease-out);
}

.alert-alert-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.alert-overdue {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-due-today {
    background: var(--accent-warning-bg);
    color: #ff6d01;
    border: 1px solid rgba(255, 109, 1, 0.2);
}

[data-theme="dark"] .alert-due-today {
    color: #ff9d42;
}

[data-theme="dark"] .alert-overdue {
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .alert-due-today {
    border-color: rgba(255, 109, 1, 0.3);
}

/* Task Progress Bar */
.todos-progress-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0 var(--space-2) 0;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-brand);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}

.progress-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 32px;
    text-align: right;
}

#clear-completed-btn {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    opacity: 0.8;
    transition: opacity var(--duration-fast);
}

#clear-completed-btn:hover {
    opacity: 1;
}

.todo-form {
    padding: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.todo-form input[type="text"],
.todo-form input[type="date"],
.todo-form select {
    padding: 6px 10px;
    font-size: var(--text-xs);
    background-color: var(--bg-muted);
    color: var(--text-primary);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.todo-form input[type="text"]:focus,
.todo-form input[type="date"]:focus,
.todo-form select:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
}

.todo-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
}

/* Due date row with date picker + shortcut buttons */
.todo-due-date-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.todo-due-date-row input[type="date"] {
    flex: 1;
    min-width: 0;
}

.due-date-shortcuts {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.due-shortcut-btn {
    padding: 3px 7px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.due-shortcut-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-bg);
    border-color: var(--accent-primary);
}

.due-shortcut-btn:active {
    transform: scale(0.95);
}

.due-shortcut-btn.due-shortcut-clear {
    color: var(--accent-danger);
    border-color: transparent;
}

.due-shortcut-btn.due-shortcut-clear:hover {
    background: var(--accent-danger-bg);
    border-color: var(--accent-danger);
}

/* Edit modal due date row */
.todo-edit-due-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.todo-edit-due-row input[type="date"] {
    width: 100%;
    padding: 8px 10px;
    font-size: var(--text-sm);
    background-color: var(--bg-muted);
    color: var(--text-primary);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.todo-edit-due-row input[type="date"]:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
}

.todo-edit-due-row .due-date-shortcuts {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Agent assign checkbox */
.todo-form-agent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.agent-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

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

.todos-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-1);
}

/* Agent task badge */
.agent-task-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background-color: var(--accent-primary-bg);
    color: var(--accent-primary);
    letter-spacing: 0.03em;
}

.todo-item.agent-task {
    border-left: 3px solid var(--accent-primary);
    background-color: var(--accent-primary-bg);
}

.todo-item.agent-task .todo-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Todo Item */
.todo-item {
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    background-color: var(--bg-surface);
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    animation: todoSlideIn 0.3s var(--ease-out) both;
}

/* Staggered entry animation for todo items */
.todo-item:nth-child(1) { animation-delay: 0ms; }
.todo-item:nth-child(2) { animation-delay: 30ms; }
.todo-item:nth-child(3) { animation-delay: 60ms; }
.todo-item:nth-child(4) { animation-delay: 90ms; }
.todo-item:nth-child(5) { animation-delay: 120ms; }
.todo-item:nth-child(n+6) { animation-delay: 150ms; }

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

.todo-item:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-sm);
}

.todo-item.completed {
    opacity: 0.6;
    background-color: var(--bg-muted);
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.todo-main-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

/* Custom Checkbox for Todos */
.todo-check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.todo-check-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.todo-check-visual {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Priority color indicator dot inside unchecked checkbox */
.todo-check-visual::before {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--priority-color, var(--accent-primary));
    border: 1.5px solid var(--bg-surface);
    transition: all var(--duration-fast) var(--ease-out);
    opacity: 0.85;
    z-index: 1;
}

.todo-check-wrapper:hover .todo-check-visual {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.todo-check:checked + .todo-check-visual {
    background: var(--gradient-brand);
    border-color: var(--accent-primary);
    animation: checkPop 0.3s var(--ease-out);
}

/* Hide priority dot when checked */
.todo-check:checked + .todo-check-visual::before {
    opacity: 0;
    transform: scale(0);
}

.todo-check:checked + .todo-check-visual::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    animation: checkDraw 0.2s 0.1s var(--ease-out) forwards;
}

@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes checkDraw {
    from { transform: rotate(45deg) scale(0); }
    to { transform: rotate(45deg) scale(1); }
}

.todo-details {
    flex: 1;
    min-width: 0;
}

.todo-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.todo-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.priority-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.03em;
}

.priority-badge.high {
    background-color: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.priority-badge.medium {
    background-color: var(--accent-warning-bg);
    color: var(--accent-warning);
}

.priority-badge.low {
    background-color: var(--accent-success-bg);
    color: var(--accent-success);
}

.list-badge {
    font-size: 0.6rem;
    font-weight: 600;
    background-color: var(--bg-muted);
    color: var(--text-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.due-badge {
    font-size: var(--text-xs);
    color: var(--accent-info);
    font-weight: 500;
}

.due-badge.overdue {
    color: var(--accent-danger);
    font-weight: 600;
}

.due-badge.today {
    color: #ff6d01;
    font-weight: 600;
}

.due-badge.soon {
    color: var(--accent-warning);
    font-weight: 600;
}

.due-badge.completed-due {
    color: var(--text-tertiary);
    font-weight: 400;
    opacity: 0.7;
}

/* Priority badge hover effect for click-to-cycle */
.priority-badge {
    transition: all var(--duration-fast) var(--ease-out);
}

.priority-badge:hover {
    transform: scale(1.1);
    filter: brightness(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.priority-badge:active {
    transform: scale(0.95);
}

/* Todo item focus styles for keyboard navigation */
.todo-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.todo-item.due-overdue {
    border-left: 3px solid var(--accent-danger);
    background-color: var(--accent-danger-bg);
}

.todo-item.due-today {
    border-left: 3px solid #ff6d01;
}

.todo-item.due-soon {
    border-left: 3px solid var(--accent-warning);
}

[data-theme="dark"] .todo-item.due-today {
    border-left-color: #ff9d42;
}

[data-theme="dark"] .due-badge.today {
    color: #ff9d42;
}

/* Dark mode: adjust priority dot border for checkbox */
[data-theme="dark"] .todo-check-visual::before {
    border-color: var(--bg-elevated);
}

.todo-description {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
    line-height: 1.4;
}

.todo-actions {
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.todo-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
    color: var(--text-tertiary);
}

.todo-actions button:hover {
    background-color: var(--hover-overlay);
    color: var(--text-primary);
}

.todo-actions .delete-todo-btn:hover {
    color: var(--accent-danger);
    background-color: var(--accent-danger-bg);
}

.todo-actions .edit-todo-btn:hover {
    color: var(--accent-primary);
    background-color: var(--accent-primary-bg);
}

/* Subtasks */
.todo-item.depth-1 { margin-left: 20px; border-left: 2px solid var(--border-default); padding-left: 10px; }
.todo-item.depth-2 { margin-left: 40px; border-left: 2px solid var(--border-default); padding-left: 10px; }

/* Task Section Headers (Overdue, Today, Tomorrow, etc.) */
.todo-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-3);
    margin-bottom: var(--space-1);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeInUp 0.3s var(--ease-out);
}
.todo-section-header:first-child {
    margin-top: 0;
}
.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.section-count {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}
.section-overdue {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.section-overdue .section-count {
    background: var(--accent-danger);
    color: #fff;
    border-color: var(--accent-danger);
}
.section-today {
    background: var(--accent-warning-bg);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.15);
}
.section-today .section-count {
    background: var(--accent-warning);
    color: #1c1917;
    border-color: var(--accent-warning);
}
.section-tomorrow {
    background: rgba(251, 191, 36, 0.08);
    color: #92400e;
    border: 1px solid rgba(251, 191, 36, 0.15);
}
.section-tomorrow .section-count {
    background: #fbbf24;
    color: #1c1917;
    border-color: #fbbf24;
}
.section-later {
    background: var(--accent-primary-bg);
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.12);
}
.section-later .section-count {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}
.section-none {
    background: var(--bg-muted);
    color: var(--text-tertiary);
    border: 1px solid var(--border-subtle);
}
.section-none .section-count {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border-default);
}
[data-theme="dark"] .section-today {
    color: #fbbf24;
}
[data-theme="dark"] .section-today .section-count {
    background: #fbbf24;
    color: #1c1917;
}
[data-theme="dark"] .section-tomorrow {
    color: #fcd34d;
}
[data-theme="dark"] .section-tomorrow .section-count {
    background: #fcd34d;
    color: #1c1917;
}

/* Templates Panel */
.todos-templates-panel {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-3) 0;
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow: hidden;
    transition: max-height var(--duration-slow) var(--ease-in-out);
}

.todos-templates-panel.collapsed {
    max-height: 45px !important;
}

.templates-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.templates-panel-header h4 {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.templates-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-right: var(--space-1);
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background-color: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
}

.template-item:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-default);
}

.template-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-item-actions {
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
    color: var(--text-tertiary);
}

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

.btn-icon-only.danger:hover {
    background-color: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.collapse-chevron {
    font-size: 0.65rem;
    margin-left: 4px;
    display: inline-block;
    transition: transform var(--duration-normal) var(--ease-out);
}

/* ================================================================
   NOTES VIEW
   ================================================================ */
.note-creation-container {
    display: flex;
    justify-content: center;
    padding: var(--space-8);
    background-color: var(--bg-base);
}

.note-form {
    width: 100%;
    max-width: 580px;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: box-shadow var(--duration-normal);
}

.note-form:focus-within {
    box-shadow: var(--shadow-xl);
}

.note-form input[type="text"] {
    border: none;
    font-weight: 700;
    font-size: var(--text-lg);
    outline: none;
    background: none;
    color: var(--text-primary);
    padding: var(--space-2) 0;
}

.note-form textarea {
    border: none;
    resize: none;
    outline: none;
    font-size: var(--text-base);
    background: none;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 80px;
}

.note-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-3);
}

.note-form-actions input {
    border: none;
    outline: none;
    font-size: var(--text-sm);
    background: none;
    width: 50%;
    color: var(--text-primary);
}

.form-row-group {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
}

.notes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-8);
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    gap: var(--space-4);
}

#note-search {
    width: 350px;
    padding: 10px 16px 10px 38px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background-color: var(--bg-muted);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

#note-search:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
}

.notes-sections-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8);
}

.notes-section-group {
    margin-bottom: var(--space-10);
}

.section-label {
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    font-weight: 700;
    text-transform: uppercase;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

/* Note Card */
.note-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid transparent;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
    animation: noteFadeIn 0.35s var(--ease-out) both;
}

/* Left border accent for colored notes */
.note-card[data-note-color="red"]    { border-left-color: #d45050; }
.note-card[data-note-color="orange"] { border-left-color: #d9a004; }
.note-card[data-note-color="yellow"] { border-left-color: #c8b830; }
.note-card[data-note-color="green"]  { border-left-color: #50b050; }
.note-card[data-note-color="teal"]   { border-left-color: #40b0a0; }
.note-card[data-note-color="blue"]   { border-left-color: #50a0c0; }
.note-card[data-note-color="darkblue"] { border-left-color: #5080d0; }
.note-card[data-note-color="purple"] { border-left-color: #8060c0; }
.note-card[data-note-color="pink"]   { border-left-color: #d05080; }

/* Staggered entry animation for note cards */
.note-card:nth-child(1) { animation-delay: 0ms; }
.note-card:nth-child(2) { animation-delay: 40ms; }
.note-card:nth-child(3) { animation-delay: 80ms; }
.note-card:nth-child(4) { animation-delay: 120ms; }
.note-card:nth-child(5) { animation-delay: 160ms; }
.note-card:nth-child(n+6) { animation-delay: 200ms; }

@keyframes noteFadeIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.note-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--border-default);
}

.note-card.pinned {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

.note-card-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
}

.pin-note-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
    opacity: 0.5;
}

.pin-note-btn:hover {
    opacity: 1;
    background-color: var(--hover-overlay);
}

.note-card-body {
    flex: 1;
    margin-bottom: var(--space-3);
}

.note-card-content {
    font-size: var(--text-sm);
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card:hover .note-card-content {
    -webkit-line-clamp: unset;
}

.note-card-labels {
    margin-top: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.note-card-timestamp {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.65rem;
    color: var(--text-tertiary);
    opacity: 0.8;
}

.note-inline-edit-input,
.todo-inline-edit-input {
    transition: border-color var(--duration-fast) var(--ease-out);
}

.note-inline-edit-input:focus,
.todo-inline-edit-input:focus {
    box-shadow: var(--focus-ring);
}

.note-label-pill {
    font-size: 0.65rem;
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

[data-theme="dark"] .note-label-pill {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Dark mode: colored note cards get a subtle colored border to preserve the color identity */
[data-theme="dark"] .note-card[data-note-color="red"]    { border-color: #7a3030; border-left-color: #a04040; }
[data-theme="dark"] .note-card[data-note-color="orange"] { border-color: #7a6020; border-left-color: #a08030; }
[data-theme="dark"] .note-card[data-note-color="yellow"] { border-color: #707030; border-left-color: #a0a040; }
[data-theme="dark"] .note-card[data-note-color="green"]  { border-color: #306030; border-left-color: #408040; }
[data-theme="dark"] .note-card[data-note-color="teal"]   { border-color: #306060; border-left-color: #408080; }
[data-theme="dark"] .note-card[data-note-color="blue"]   { border-color: #305060; border-left-color: #4070a0; }
[data-theme="dark"] .note-card[data-note-color="darkblue"] { border-color: #3d5070; border-left-color: #5070a0; }
[data-theme="dark"] .note-card[data-note-color="purple"] { border-color: #503070; border-left-color: #7050a0; }
[data-theme="dark"] .note-card[data-note-color="pink"]   { border-color: #603050; border-left-color: #a05080; }

.note-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

.note-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
    color: var(--text-tertiary);
}

.note-card-actions button:hover {
    background-color: var(--hover-overlay);
    color: var(--text-primary);
}

/* Color Picker */
.color-picker-dropdown {
    position: relative;
    display: inline-block;
}

.color-palette {
    position: absolute;
    bottom: 30px;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-1);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    width: 140px;
    animation: scaleIn 0.15s var(--ease-out);
}

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

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-block;
    transition: all var(--duration-fast);
}

.color-swatch:hover {
    transform: scale(1.2);
    border-color: var(--border-strong);
}

/* ===== Note View/Edit Modal ===== */
.note-view-card {
    max-width: 600px;
    width: 90vw;
}
.note-view-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    padding-right: var(--space-3);
    word-break: break-word;
}
.note-view-body {
    padding: var(--space-4) var(--space-5);
}
.note-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: var(--space-3);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}
.note-view-labels {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.note-view-date {
    margin-left: auto;
}
.note-view-content {
    font-size: var(--text-base);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    max-height: 50vh;
    overflow-y: auto;
    padding: var(--space-2) 0;
}
.note-view-content:empty::before {
    content: 'No content';
    color: var(--text-tertiary);
    font-style: italic;
}

/* ================================================================
   AGENT TASKS VIEW
   ================================================================ */
.agent-dashboard-header {
    padding: var(--space-8);
    background: var(--gradient-brand-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.agent-dashboard-header h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
    letter-spacing: -0.025em;
}

.agent-dashboard-header p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    max-width: 600px;
}

.agent-launchers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    padding: var(--space-8);
}

.launcher-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: all var(--duration-normal) var(--ease-out);
}

.launcher-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-default);
}

.launcher-card h3 {
    font-size: var(--text-lg);
    font-weight: 700;
}

.launcher-card p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    flex: 1;
    line-height: 1.5;
}

/* Agent Task Create Card */
.agent-task-create-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.agent-task-form .form-row-group {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.agent-task-form .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.agent-task-form label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.agent-task-form input,
.agent-task-form textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: inherit;
    background-color: var(--bg-muted);
    color: var(--text-primary);
    transition: all var(--duration-fast);
}

.agent-task-form input:focus,
.agent-task-form textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    background-color: var(--bg-surface);
    outline: none;
}

.agent-task-form small {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.agent-tasks-filter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.agent-tasks-filter label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Agent Tasks List */
.agent-tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-4);
}

.agent-task-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--duration-normal) var(--ease-out);
    border-left: 4px solid var(--border-default);
    animation: cardSlideIn 0.35s var(--ease-out) both;
}

.agent-task-card:nth-child(1) { animation-delay: 0ms; }
.agent-task-card:nth-child(2) { animation-delay: 50ms; }
.agent-task-card:nth-child(3) { animation-delay: 100ms; }
.agent-task-card:nth-child(n+4) { animation-delay: 150ms; }

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

.agent-task-card.status-pending { border-left: 3px solid var(--accent-warning); }
.agent-task-card.status-in-progress { border-left: 3px solid var(--accent-primary); }
.agent-task-card.status-complete,
.agent-task-card.status-completed { border-left: 3px solid var(--accent-success); }
.agent-task-card.status-failed { border-left: 3px solid var(--accent-danger); }

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

.agent-task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

.agent-task-title {
    font-size: var(--text-base);
    font-weight: 700;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.agent-task-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.agent-task-status {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    margin-left: var(--space-2);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.agent-task-status.pending {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
}

.agent-task-status.in-progress {
    background: var(--accent-primary-bg);
    color: var(--accent-primary);
}

.agent-task-status.complete {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

/* Agent task card status-based styles */
.agent-task-card.status-in-progress {
    border-left: 3px solid var(--accent-primary);
}

.agent-task-card.status-pending {
    border-left: 3px solid var(--accent-warning);
}

.agent-task-card.status-complete {
    border-left: 3px solid var(--accent-success);
}

.agent-task-card.status-complete .agent-task-title {
    text-decoration: line-through;
    opacity: 0.6;
}

.agent-task-card.status-complete {
    opacity: 0.75;
}

.agent-task-overdue {
    color: var(--accent-danger);
    font-weight: 600;
}

.agent-task-card.done .agent-task-title {
    text-decoration: line-through;
    opacity: 0.6;
}

.agent-task-card.done {
    opacity: 0.75;
}

.agent-task-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-3) 0;
    line-height: 1.5;
}

.agent-task-meta {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
}

.agent-task-comments {
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
}

.agent-task-comments strong {
    color: var(--text-primary);
}

.agent-task-comments p {
    margin: var(--space-1) 0 0;
    color: var(--text-secondary);
}

/* Agent task progress log entries */
.agent-task-progress-log {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-3);
    margin-top: var(--space-3);
}

.agent-task-progress-entry {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    padding: var(--space-2) 0;
    border-bottom: 1px dashed var(--border-subtle);
    line-height: 1.5;
}

.agent-task-progress-entry:last-child {
    border-bottom: none;
}

.agent-task-progress-status {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: var(--space-1);
}

.agent-task-progress-status.status-pending { color: var(--accent-warning); }
.agent-task-progress-status.status-in_progress { color: var(--accent-primary); }
.agent-task-progress-status.status-complete { color: var(--accent-success); }

.agent-task-progress-time {
    color: var(--text-tertiary);
    font-size: 0.65rem;
    display: block;
    margin-top: 2px;
}

/* Agent task comment input form */
.agent-task-comment-form {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
}

.agent-task-comment-input {
    flex: 1;
    padding: 6px 10px;
    font-size: var(--text-xs);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.agent-task-comment-input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.agent-task-comment-submit {
    padding: 6px 12px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--gradient-brand);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: opacity var(--duration-fast);
}

.agent-task-comment-submit:hover {
    opacity: 0.9;
}

.agent-task-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.agent-task-actions {
    display: flex;
    gap: var(--space-2);
}

.agent-task-actions button {
    padding: 6px 14px;
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.agent-task-actions button:hover {
    background: var(--bg-muted);
    border-color: var(--border-default);
}

.agent-task-toggle-btn,
.agent-task-delete-btn {
    padding: 4px 8px;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity var(--duration-fast);
}

.agent-task-toggle-btn:hover,
.agent-task-delete-btn:hover {
    opacity: 1;
}

/* Expand Task Button */
.expand-task-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--duration-fast);
}

.expand-task-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* Agent Task Detail View */
.agent-task-detail-view {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    animation: slideDown 0.25s var(--ease-out);
}

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

.agent-task-detail-section {
    margin-bottom: var(--space-4);
}

.agent-task-detail-section:last-child {
    margin-bottom: 0;
}

.agent-task-detail-section h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    margin: 0 0 var(--space-2) 0;
    color: var(--text-primary);
}

.detail-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    font-size: var(--text-sm);
}

.detail-label {
    color: var(--text-tertiary);
    min-width: 70px;
    font-weight: 500;
}

.task-status-select {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-subtle);
    font-size: var(--text-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
}

/* Agent Comments */
.agent-comments-display {
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    max-height: 150px;
    overflow-y: auto;
}

.agent-comment-text {
    font-size: var(--text-sm);
    white-space: pre-wrap;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.no-comments {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-style: italic;
    margin: 0;
}

.agent-comment-input-row {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}

.agent-comment-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    resize: vertical;
    min-height: 36px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color var(--duration-fast);
}

.agent-comment-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.add-comment-btn {
    padding: 8px 16px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--gradient-brand);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration-fast);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.add-comment-btn:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

/* Subtasks */
.subtask-list {
    margin-bottom: var(--space-2);
    min-height: 24px;
}

.no-subtasks {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-style: italic;
    margin: var(--space-1) 0;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-1);
    background: var(--bg-muted);
    transition: all var(--duration-fast);
}

.subtask-item.completed .subtask-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.subtask-item:hover {
    background: var(--bg-subtle);
}

.subtask-check {
    cursor: pointer;
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.subtask-title {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.subtask-actions {
    display: flex;
    gap: var(--space-1);
}

.subtask-delete-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
}

.subtask-delete-btn:hover {
    color: var(--accent-danger);
    background-color: var(--accent-danger-bg);
}

.subtask-input-row {
    display: flex;
    gap: var(--space-2);
}

.subtask-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--duration-fast);
}

.subtask-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.add-subtask-btn {
    padding: 8px 16px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--gradient-brand);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration-fast);
}

.add-subtask-btn:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

/* ================================================================
   MODALS
   ================================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: var(--bg-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal-backdrop);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s var(--ease-out);
}

.modal-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: modalSlideUp 0.3s var(--ease-out);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-sm {
    max-width: 380px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--gradient-brand-subtle);
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
}

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

.modal-form {
    padding: var(--space-6);
}

.modal-form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.modal-form-actions .btn {
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    background-color: var(--bg-muted);
    border-top: 1px solid var(--border-subtle);
}

.border-top {
    border-top: 1px solid var(--border-subtle);
}

/* View Event Modal */
.view-event-body {
    padding: var(--space-6);
}

.event-view-heading {
    margin-bottom: var(--space-5);
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.event-detail-item {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    padding: var(--space-2) 0;
    align-items: flex-start;
    flex-wrap: wrap;
}

.detail-icon {
    font-size: 1.1rem;
    opacity: 0.8;
    flex-shrink: 0;
}

/* Smart location link in event view modal */
.event-location-link {
    color: var(--accent-primary);
    text-decoration: none;
    word-break: break-all;
    transition: color var(--duration-fast) var(--ease-out);
}

.event-location-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.event-join-btn {
    margin-top: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    white-space: nowrap;
}

.calendar-indicator-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border-left: 4px solid var(--accent-primary);
    font-size: var(--text-sm);
    font-weight: 600;
    background-color: var(--bg-muted);
}

/* Event color dot in view modal title */
.event-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-surface);
}

/* Extra details section in view modal */
.view-event-extra-details {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

/* Smart Scheduling Results */
.smart-sched-result {
    padding: 0 var(--space-6) var(--space-6) var(--space-6);
}

.result-box {
    background-color: var(--accent-info-bg);
    border: 1px solid var(--accent-info);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    font-size: var(--text-sm);
}

.conflicts-avoided {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--accent-success);
    font-weight: 600;
}

/* Shortcuts Modal */
.shortcuts-body {
    padding: var(--space-5) var(--space-6);
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
}

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

/* Confirmation Modal */
.confirm-modal-card {
    max-width: 400px;
    text-align: center;
    padding: var(--space-6);
}

.confirm-icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.confirm-icon {
    font-size: 3rem;
    color: var(--accent-danger);
}

.confirm-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.confirm-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    line-height: 1.5;
}

.confirm-message strong {
    color: var(--text-primary);
}

.confirm-warning {
    font-size: var(--text-sm);
    color: var(--accent-danger);
    background-color: var(--accent-danger-bg);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    display: inline-block;
    margin-bottom: var(--space-5);
    font-weight: 500;
}

.confirm-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.confirm-actions .btn {
    flex: 1;
    padding: 12px 20px;
}

/* Template Modal */
.template-modal-card {
    max-width: 480px;
}

.template-tasks-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
    background-color: var(--bg-muted);
}

.template-task-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.template-task-row input[type="text"] {
    flex: 2;
    padding: 6px 10px;
    font-size: var(--text-xs);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.template-task-row select {
    flex: 1;
    padding: 6px 10px;
    font-size: var(--text-xs);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.template-task-row input[type="number"] {
    width: 60px;
    padding: 6px 10px;
    font-size: var(--text-xs);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.btn-remove-task-row {
    color: var(--accent-danger);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1rem;
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

.btn-remove-task-row:hover {
    background-color: var(--accent-danger-bg);
}

/* ================================================================
   EVENT COLOR PICKER
   ================================================================ */
.event-color-palette {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-2) 0;
}

.event-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--duration-fast) var(--ease-out);
    box-shadow: var(--shadow-xs);
}

.event-color-swatch:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-sm);
}

.event-color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--text-primary);
}

.event-color-palette-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.custom-color-input {
    border: 1.5px solid var(--border-subtle);
    background: none;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    overflow: hidden;
}

.custom-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-input::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius-full);
}

/* ================================================================
   NOTIFICATIONS DRAWER
   ================================================================ */
.notifications-drawer {
    position: absolute;
    top: 48px;
    right: 0;
    width: 340px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 420px;
    z-index: var(--z-dropdown);
    animation: dropIn 0.2s var(--ease-out);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

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

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--gradient-brand-subtle);
}

.drawer-header h3 {
    font-size: var(--text-sm);
    font-weight: 700;
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-sans);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast);
}

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

.notifications-list {
    flex: 1;
    overflow-y: auto;
}

.notification-item {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color var(--duration-fast), transform var(--duration-fast);
    position: relative;
}

.notification-item:hover {
    background-color: var(--hover-overlay);
    transform: translateX(2px);
}

.notification-item.unread {
    border-left: 3px solid var(--accent-primary);
    background-color: var(--accent-primary-bg);
}

/* Unread dot indicator */
.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 14px;
    right: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulseDot 2s ease-in-out infinite;
}

.notification-item.unread:hover {
    background-color: rgba(99, 102, 241, 0.12);
}

[data-theme="dark"] .notification-item.unread:hover {
    background-color: rgba(129, 140, 248, 0.15);
}

.notif-header {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
}

.delete-notif-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-sm);
    opacity: 0.4;
    padding: 0 var(--space-1);
    transition: opacity var(--duration-fast);
}

.delete-notif-btn:hover {
    opacity: 1;
}

.notif-message {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
    line-height: 1.4;
}

.notif-time {
    font-size: 0.65rem;
    color: var(--text-tertiary);
}

/* ================================================================
   COMMAND PALETTE (Ctrl+K global search)
   ================================================================ */
.command-palette-card {
    max-width: 560px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-subtle);
    animation: paletteSlideIn 0.15s var(--ease-out);
    margin-top: 10vh;
}

@keyframes paletteSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.command-palette-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.command-palette-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

#command-palette-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--text-lg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    padding: 0;
}

#command-palette-input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.command-palette-results {
    overflow-y: auto;
    max-height: 400px;
    padding: var(--space-2);
}

.command-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out);
}

.command-result-item:hover,
.command-result-item.selected {
    background-color: var(--hover-overlay);
}

.command-result-item.selected {
    background-color: var(--accent-primary-bg);
}

.command-result-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.command-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.command-result-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-result-subtitle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-result-type {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background-color: var(--bg-muted);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Action commands get a subtle accent color to differentiate from data items */
.command-result-item[data-type="command"] .command-result-type {
    color: var(--accent-primary);
    background-color: var(--accent-primary-bg);
}

.command-result-item[data-type="agent-task"] .command-result-type {
    color: #7c3aed;
    background-color: rgba(124, 58, 237, 0.1);
}

.command-palette-empty code {
    background-color: var(--bg-muted);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-primary);
    border: 1px solid var(--border-subtle);
}

.command-highlight {
    background-color: var(--accent-warning-bg);
    color: var(--accent-warning);
    border-radius: 2px;
    padding: 0 1px;
}

.command-palette-empty {
    padding: var(--space-10) var(--space-6);
    text-align: center;
    color: var(--text-tertiary);
}

.command-empty-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.command-palette-empty p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
}

.command-palette-empty small {
    font-size: var(--text-xs);
    opacity: 0.7;
}

.command-palette-footer {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background-color: var(--bg-muted);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.command-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.command-hint kbd {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    min-width: 18px;
    text-align: center;
}

/* Highlight pulse animation for items opened from command palette */
@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.highlight-pulse {
    animation: highlightPulse 1.5s ease-out;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: var(--z-toast);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    font-weight: 500;
    min-width: 280px;
    max-width: 400px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s var(--ease-out), opacity 0.3s;
    position: relative;
    overflow: hidden;
}

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

.toast-success { border-left: 4px solid var(--accent-success); }
.toast-error { border-left: 4px solid var(--accent-danger); }
.toast-info { border-left: 4px solid var(--accent-info); }
.toast-warning { border-left: 4px solid var(--accent-warning); }

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-msg {
    flex: 1;
    line-height: 1.3;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
    background: var(--hover-overlay);
}

/* Toast Action Button (e.g. Undo) */
.toast-action-btn {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.toast-action-btn:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.04);
}

.toast-action-btn:active {
    transform: scale(0.97);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.15;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ================================================================
   LOADING INDICATORS
   ================================================================ */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    border-radius: inherit;
}

/* ================================================================
   QUICK NOTE MODAL
   ================================================================ */
#quick-note-modal .modal-card {
    max-width: 480px;
    animation: slideUp 0.25s var(--ease-out);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#quick-note-modal .form-control {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#quick-note-modal .form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

#quick-note-modal textarea {
    resize: vertical;
    min-height: 80px;
}

/* ================================================================
   EMPTY STATES
   ================================================================ */
.empty-state-msg {
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    padding: var(--space-8) var(--space-4);
    line-height: 1.5;
    animation: fadeInUp 0.4s var(--ease-out);
}

.empty-state-msg::before {
    content: '📭';
    display: block;
    font-size: 2rem;
    margin-bottom: var(--space-2);
    opacity: 0.6;
    animation: bounceIn 0.5s var(--ease-out) 0.1s both;
}

/* Contextual empty state variants */
.empty-state-msg.empty-tasks::before { content: '✅'; }
.empty-state-msg.empty-tasks-all-done::before { content: '🎉'; }
.empty-state-msg.empty-notes::before { content: '📝'; }
.empty-state-msg.empty-notes-search::before { content: '🔍'; }
.empty-state-msg.empty-events::before { content: '📅'; }
.empty-state-msg.empty-agent-tasks::before { content: '🤖'; }

.empty-state-msg.empty-tasks-all-done {
    color: var(--accent-success);
    opacity: 0.8;
}

/* Empty state action prompt */
.empty-state-action {
    display: inline-block;
    margin-top: var(--space-3);
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--duration-fast);
}

.empty-state-action:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

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

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.5); }
    60% { opacity: 0.8; transform: scale(1.1); }
    100% { opacity: 0.6; transform: scale(1); }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ================================================================
   SETTINGS VIEW
   ================================================================ */
#settings-view-container {
    padding: var(--space-6);
    overflow-y: auto;
    height: 100%;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.settings-header h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-10);
}

.settings-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-normal);
}

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

.settings-card h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-3);
}

.settings-divider {
    border: 0;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-2) 0;
}

.readonly-input {
    background-color: var(--bg-muted) !important;
    color: var(--text-tertiary) !important;
    cursor: not-allowed;
}

/* Profile Avatar */
.profile-avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-3) 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    color: white;
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.profile-avatar-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Password Input */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 44px !important;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: color var(--duration-fast);
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

/* Theme Selection Cards */
.theme-selection-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.theme-option-card {
    cursor: pointer;
    position: relative;
}

.theme-option-card input[type="radio"] {
    display: none;
}

.theme-option-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-muted);
    transition: all var(--duration-fast) var(--ease-out);
}

.theme-option-card:hover .theme-option-content {
    background-color: var(--bg-subtle);
    border-color: var(--border-default);
}

.theme-option-card.active .theme-option-content {
    border-color: var(--accent-primary);
    background-color: var(--accent-primary-bg);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

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

.theme-label {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    font-size: var(--text-sm);
}

.theme-check {
    color: var(--accent-primary);
    font-weight: bold;
    font-size: var(--text-sm);
    display: none;
}

.theme-option-card.active .theme-check {
    display: inline-block;
}

/* Data Management */
.data-mgmt-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.data-mgmt-section h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.import-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.import-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.file-input {
    font-size: var(--text-xs);
    padding: var(--space-2);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-muted);
    color: var(--text-primary);
}

/* ================================================================
   SIDEBAR COLLAPSE ANIMATION
   ================================================================ */
.app-sidebar {
    transition: all var(--duration-slow) var(--ease-in-out);
}

.app-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
}

/* ================================================================
   SMART SCHEDULE
   ================================================================ */
.smart-sched-result {
    padding: var(--space-4);
    animation: fadeSlideUp 0.3s var(--ease-out);
}

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

.smart-sched-result-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--accent-success-bg);
    border: 1px solid var(--accent-success);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.smart-sched-result-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.smart-sched-result-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.smart-sched-result-info strong {
    font-size: var(--text-base);
    color: var(--text-primary);
}

.smart-sched-result-msg {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.smart-sched-result-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.smart-sched-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.smart-sched-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: schedSpin 0.8s linear infinite;
}

@keyframes schedSpin {
    to { transform: rotate(360deg); }
}

/* Smart schedule button subtle hover */
#smart-schedule-btn {
    position: relative;
    overflow: hidden;
}

#smart-schedule-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

#smart-schedule-btn:hover::after {
    opacity: 1;
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 1100px) {
    .header-nav {
        display: none;
    }
    
    .quick-add-container {
        max-width: 300px;
    }
}

@media (max-width: 900px) {
    .app-workspace {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .app-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: var(--space-4);
        gap: var(--space-3);
    }
    
    .calendar-layout {
        flex-direction: column;
    }
    
    .calendar-toolbar {
        padding: var(--space-3) var(--space-4);
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .toolbar-center {
        order: 3;
        width: 100%;
        max-width: 100%;
    }
    
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .agent-tasks-list {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-add-container {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: var(--space-2) var(--space-3);
    }
    
    .logo {
        font-size: var(--text-base);
    }
    
    .user-email {
        display: none;
    }
    
    .auth-card {
        padding: var(--space-6);
    }
    
    .calendar-toolbar {
        padding: var(--space-2);
    }
    
    .calendar-title-text {
        font-size: var(--text-base);
    }

    .goto-date-wrapper {
        margin-left: var(--space-1);
    }
    
    .notes-sections-wrapper {
        padding: var(--space-4);
    }
    
    .note-creation-container {
        padding: var(--space-4);
    }
    
    .modal-card {
        max-width: 95vw;
        margin: var(--space-4);
    }
    
    .notifications-drawer {
        width: 100vw;
        right: -20px;
    }
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
    .app-header,
    .app-sidebar,
    .modal-backdrop,
    #toast-container {
        display: none !important;
    }
    
    .main-content {
        overflow: visible;
    }
    
    .calendar-grid-view {
        overflow: visible;
    }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.mt-2 { margin-top: var(--space-2); }
.mb-2 { margin-bottom: var(--space-2); }
.gap-2 { gap: var(--space-2); }
.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }

/* ================================================================
   CONFETTI CELEBRATION (task completion)
   ================================================================ */
.confetti-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 9999;
    animation: confetti-burst 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confetti-burst {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.3);
        opacity: 0;
    }
}

/* Task completion flash */
.todo-item.just-completed {
    animation: task-complete-flash 0.8s ease-out;
}

@keyframes task-complete-flash {
    0% {
        background-color: rgba(52, 168, 83, 0.25);
        transform: scale(1.02);
    }
    50% {
        background-color: rgba(52, 168, 83, 0.1);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Input focus flash for keyboard shortcut */
@keyframes input-focus-flash {
    0% {
        box-shadow: 0 0 0 3px var(--accent-primary);
        border-color: var(--accent-primary);
    }
    100% {
        box-shadow: none;
    }
}

.input-focused-flash {
    animation: input-focus-flash 0.6s ease-out;
    border-radius: var(--radius-sm);
}

/* Notification relative time styling */
.notif-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* Dashboard stat card pulse on update */
.stat-card.stat-updated {
    animation: stat-pulse 0.4s ease-out;
}

@keyframes stat-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}
.font-mono { font-family: var(--font-mono); }

/* ================================================================
   ANALYTICS DASHBOARD
   ================================================================ */

/* Analytics button in stats bar */
.stat-analytics-btn {
    cursor: pointer;
    background: var(--gradient-brand-subtle) !important;
    border-color: var(--accent-primary) !important;
    transition: all var(--duration-fast) var(--ease-out);
}

.stat-analytics-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    background: var(--accent-primary-bg) !important;
}

/* Analytics modal - wider than standard */
.analytics-modal-card {
    max-width: 620px;
}

/* Loading state */
.analytics-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-12);
    color: var(--text-secondary);
}

.analytics-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: analytics-spin 0.8s linear infinite;
}

@keyframes analytics-spin {
    to { transform: rotate(360deg); }
}

.analytics-error {
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--accent-danger);
}

/* Content container */
.analytics-content {
    padding: var(--space-4) var(--space-6) var(--space-6);
    overflow-y: auto;
    max-height: 60vh;
}

/* Hero stats - top row with 3 cards */
.analytics-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.analytics-hero-card {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

@media (max-width: 500px) {
    .analytics-hero {
        grid-template-columns: 1fr;
    }
}

/* Completion ring */
.analytics-ring-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-ring {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.analytics-ring-bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 8;
}

.analytics-ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    transition: stroke-dashoffset 0.8s var(--ease-out);
}

.analytics-ring-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.analytics-ring-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
}

.analytics-ring-text {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-hero-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.analytics-danger-text {
    color: var(--accent-danger);
    font-weight: 600;
}

/* Big stat */
.analytics-big-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.analytics-big-icon {
    font-size: 1.6rem;
}

.analytics-big-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.analytics-big-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.analytics-mini-stats {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.analytics-mini {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* Breakdown section */
.analytics-breakdown {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (max-width: 500px) {
    .analytics-breakdown {
        grid-template-columns: 1fr;
    }
}

.analytics-breakdown-section {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.analytics-section-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-3);
}

/* Bar chart */
.analytics-bar-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.analytics-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.analytics-bar-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    min-width: 70px;
    text-align: right;
}

.analytics-bar-track {
    flex: 1;
    height: 10px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s var(--ease-out);
}

.analytics-bar-value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    min-width: 24px;
}

/* Agent stats */
.analytics-agent-stats {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
}

.analytics-agent-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.analytics-agent-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
}

.analytics-agent-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Insights */
.analytics-insights {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.analytics-insights-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.analytics-insight-item {
    font-size: var(--text-sm);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-primary);
    line-height: 1.5;
}

/* ================================================================
   EVENT TOOLTIP & OVERFLOW POPOVER
   ================================================================ */

.event-tooltip {
    position: fixed;
    z-index: var(--z-tooltip);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-lg);
    max-width: 280px;
    pointer-events: none;
    animation: tooltipFadeIn 150ms var(--ease-out);
    font-size: var(--text-sm);
}

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

.event-tooltip-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.3;
    word-break: break-word;
}

.event-tooltip-row {
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Overflow popover for "+X more" in month view */
.overflow-popover {
    position: fixed;
    z-index: var(--z-dropdown);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-xl);
    min-width: 220px;
    max-width: 320px;
    max-height: 320px;
    overflow-y: auto;
    animation: popoverSlideIn 200ms var(--ease-out);
}

@keyframes popoverSlideIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.overflow-popover-header {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 1;
}

.overflow-popover-item {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    padding-left: calc(var(--space-4) + 3px);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background var(--duration-fast);
    font-size: var(--text-sm);
}

.overflow-popover-item:hover {
    background: var(--hover-overlay);
}

.overflow-item-time {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    white-space: nowrap;
    min-width: 58px;
}

.overflow-item-title {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overflow-popover-footer {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-2) var(--space-3);
    text-align: center;
}

.overflow-day-view-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
}

.overflow-day-view-btn:hover {
    background: var(--accent-primary-bg);
}

/* ================================================================
   REDUCED MOTION — Respect user accessibility preferences
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
    /* Keep hover/active feedback but drop motion */
    .todo-item, .note-card, .agent-task-card {
        animation: none !important;
    }
    .toast {
        transition: opacity 0.15s !important;
        transform: none !important;
    }
    .toast.show {
        transform: none !important;
    }
}
