
        /* --- Variables & Reset --- */
        :root {
            --primary-gradient: linear-gradient(135deg, #ff4d97 0%, #37cfdc 50%, #4a56ff 100%);
            --bg-color: #f5f6f7;
            --sidebar-bg: #ffffff;
            --primary: #4a56ff;
            --secondary: #ff4d97d6;
            --text-main: #282a38;
            --text-sub: #716f6f;
            --sidebar-width: 200px;
            --sidebar-collapsed: 80px;
            --card-radius: 15px;
        }
        .material-symbols-rounded {
  font-display: block; /* Tells the browser to hide the text until the icon is ready */
  width: 1em;
  height: 1em;
  overflow: hidden;
  /* Optional: Set a fixed size so the layout doesn't jump */
  font-size: 24px; 
}

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Plus Jakarta Sans', sans-serif;
            outline: none;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            height: 100vh;
            overflow: hidden;
        }

        .hidden { display: none !important; }

        /* --- Login Overlay --- */
        #login-overlay {
            position: fixed;
            inset: 0;
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--primary-gradient);
            transition: opacity 0.5s ease;
        }

        .login-card {
            width: 400px;
            padding: 50px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 40px;
            text-align: center;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }

        .btn-google {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            width: 100%;
            color: rgb(28, 27, 27);
            margin-top: 20px;
            padding: 12px 24px;
            background: rgba(255, 255, 255, 0.158);
            border: 1px solid #e0e0e0;
            border-radius: 50px;
            font-weight: 700;
            cursor: pointer;
            transition: 0.3s;
        }
        .btn-google:hover { 
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
        }

        /* --- Dashboard Structure --- */
        #dashboard {
            display: flex;
            height: 100vh;
            width: 100vw;
        }

        .sidebar {
            display: flex;
            flex-direction: column;
            width: var(--sidebar-width);
            padding: 25px 15px;
            background: var(--sidebar-bg);
            border-right: 1px solid #e1e4f0;
            transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 100;
        }
        .sidebar.collapsed { width: var(--sidebar-collapsed); }
        
        .sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 40px;
            padding: 0 10px;
        }
        
        .sidebar-title-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .brand-text {
            font-size: 1.5rem;
            font-weight: 800;
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            white-space: nowrap;
        }
        .sidebar.collapsed .brand-text { display: none; }
        
        .toggle-btn {
            cursor: pointer;
            background: none;
            border: none;
            color: var(--text-sub);
            transition: transform 0.3s ease;
        }
        .sidebar.collapsed .toggle-btn { transform: rotate(180deg); }
        
        .nav-item {
            display: flex;
            align-items: center;
            margin-bottom: 8px;
            padding: 15px;
            color: var(--text-sub);
            border-radius: 12px;
            cursor: pointer;
            text-decoration: none;
            transition: 0.2s;
        }
        .nav-item:hover, .nav-item.active {
            background: #f4f7fe;
            color: var(--primary);
        }
        .nav-item span.material-symbols-rounded { margin-right: 15px; font-size: 22px; }
        .nav-label { white-space: nowrap; opacity: 1; transition: opacity 0.2s; }
        .sidebar.collapsed .nav-label { display: none; opacity: 0; }
        
        /* Search Box in Sidebar */
        .search-box {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #f4f7fe;
            border-radius: 30px;
            padding: 12px 20px;
            margin-bottom: 30px;
            transition: all 0.3s;
        }
        .sidebar.collapsed .search-box {
            padding: 12px;
            justify-content: center;
            width: 40px;
            height: 40px;
            margin-left: 5px;
        }
        .search-box input {
            background: transparent;
            border: none;
            width: 100%;
            color: var(--text-main);
            font-weight: 500;
        }
        .sidebar.collapsed .search-box input { display: none; }
        .sidebar.collapsed .search-box span { margin: 0; }


        /* --- Main Content --- */
        .main-content {
            display: flex;
            flex-direction: column;
            flex: 1;
            overflow: hidden;
            position: relative;
        }
        
        .top-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 15px 30px;
            background: rgba(255, 255, 255, 0.5);
            backdrop-filter: blur(10px);
            z-index: 10;
        }
        
        .top-bar-start {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #mobile-menu-toggle {
            display: none; /* Hidden on desktop */
        }
        
        .toppest-bar {
            flex: 1;
            display: flex;
            justify-content: center;
        }
        .toppest-links {
            display: flex;
            gap: 10px;
            list-style: none;
            background: white;
            padding: 5px 10px;
            border-radius: 50px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
        }
        .toppest-links li {
            padding: 8px 20px;
            border-radius: 30px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9rem;
            color: var(--text-sub);
            transition: 0.2s;
        }
        .toppest-links li.active, .toppest-links li:hover {
            background: #f4f7fe;
            color: var(--primary);
        }
        
        .user-pill {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 6px;
            background: white;
            border-radius: 30px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        }
        .user-pill img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
        .user-pill span { font-weight: 600; font-size: 0.9rem; }
        
        .content-area {
            flex: 1;
            padding: 20px 30px;
            overflow-y: auto;
        }

        /* Hero Banner */
        .hero-banner {
            margin-bottom: 35px;
            padding: 40px;
            background-image: url('https://images.unsplash.com/photo-1557683316-973673baf926?auto=format&fit=crop&w=1000&q=80');
            backdrop-filter: opacity(0.3);
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
            border-radius: 40px;
            text-align: center;
            color: rgb(8, 8, 8);
            box-shadow: 0 20px 40px rgba(74, 86, 255, 0.2);
        }
        
        /* --- Create Note Input --- */
        .create-note-wrapper {
            max-width: 600px;
            margin: 0 auto 40px auto;
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.05);
            overflow: visible;
            transition: all 0.3s ease;
            border: 1px solid transparent;
            position: relative;
        }
        .create-note-wrapper.active {
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
            border-color: #e2e8f0;
        }
        
        /* Editor Toolbar */
        .editor-toolbar {
            display: flex;
            gap: 5px;
            padding: 5px 15px;
            border-top: 1px solid rgba(0,0,0,0.05);
            margin-top: 5px;
        }
        .toolbar-btn {
            background: none;
            border: none;
            cursor: pointer;
            padding: 5px;
            border-radius: 4px;
            color: var(--text-sub);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .toolbar-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }
        .toolbar-btn span { font-size: 20px; }

        .note-input-title {
            width: 100%;
            padding: 15px 50px 5px 20px;
            font-size: 1.1rem;
            font-weight: 600;
            border: none;
            display: none;
        }
        .note-input-body, .modal-body {
            width: 100%;
            padding: 15px 90px 15px 20px;
            font-size: 1rem;
            border: none;
            outline: none;
            min-height: 46px;
            max-height: 400px;
            overflow-y: auto;
            line-height: 1.5;
        }
        /* Placeholder for contenteditable */
        [contenteditable]:empty::before {
            content: attr(data-placeholder);
            color: var(--text-sub);
            cursor: text;
        }
        
        #toggle-list-mode {
            position: absolute;
            top: 10px;
            right: 10px;
            z-index: 5;
            color: var(--text-sub);
        }
        #toggle-list-mode:hover {
            background: rgba(0,0,0,0.05);
            color: var(--primary);
        }

        /* Images in notes */
        .note-input-body img, .modal-body img, .note-card img {
            max-width: 100%;
            border-radius: 8px;
        }

        .create-footer { display: none; flex-direction: column; }
        .create-note-wrapper.active .create-footer { display: flex; }

        .create-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 15px 15px 15px;
        }
        .create-note-wrapper.active .note-input-title { display: flex; }
        
        .actions-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        
        /* --- Rich Text Styling for AI Content --- */
        .note-input-body p, .modal-body p, .note-content-html p {
            margin-bottom: 0.8em;
        }
        .note-input-body ul, .modal-body ul, .note-content-html ul,
        .note-input-body ol, .modal-body ol, .note-content-html ol {
            margin-left: 1.2em;
            margin-bottom: 0.8em;
        }
        .note-input-body li, .modal-body li, .note-content-html li {
            margin-bottom: 0.3em;
        }
        .note-input-body h1, .note-input-body h2, .note-input-body h3,
        .modal-body h1, .modal-body h2, .modal-body h3 {
            font-size: 1.1em;
            font-weight: 700;
            margin-top: 1em;
            margin-bottom: 0.5em;
        }

        /* --- Masonry Grid for Notes --- */
        .notes-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 20px;
            grid-auto-flow: dense;
            padding-bottom: 50px;
        }
        
        .note-card {
            display: flex;
            flex-direction: column;
            background: white;
            border-radius: var(--card-radius);
            padding: 20px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            border: 1px solid #e1e4f0;
            transition: all 0.2s;
            cursor: pointer;
            position: relative;
        }
        .note-card.wide {
            grid-column: span 2;
        }
        @media (max-width: 600px) {
            .note-card.wide { grid-column: span 1; }
        }

        .note-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.08);
        }
        .note-card h3 {
            font-size: 1.1rem;
            margin-bottom: 10px;
            font-weight: 700;
        }
        .note-card p {
            font-size: 0.95rem;
            color: var(--text-muted);
            line-height: 1.5;
        }
        .note-content-html {
            max-height: 250px;
            overflow: hidden;
            position: relative;
            /* Fade out effect for long content */
            mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
            -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
        }
        .note-actions {
            margin-top: 15px;
            display: flex;
            justify-content: flex-end;
            gap: 5px;
            opacity: 0;
            transition: opacity 0.2s;
        }
        .note-card:hover .note-actions { opacity: 1; }
        
        /* --- Modal --- */
        #note-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            backdrop-filter: blur(5px);
            z-index: 2000;
            display: none;
            align-items: center;
            justify-content: center;
        }
        .modal-content {
            background: white;
            width: 600px;
            max-width: 90%;
            border-radius: 20px;
            padding: 25px;
            box-shadow: 0 20px 50px rgba(0,0,0,0.2);
            display: flex;
            flex-direction: column;
            position: relative;
        }
        .modal-title {
            font-size: 1.5rem;
            font-weight: 700;
            border: none;
            margin-bottom: 15px;
            padding-right: 40px;
        }
        input, textarea, [contenteditable] {
            background-color: transparent;
        }
        .modal-body {
            min-height: 200px;
            margin-bottom: 10px;
        }
        .modal-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-close-icon {
            position: absolute;
            top: 15px;
            right: 15px;
            background: transparent;
            border: none;
            cursor: pointer;
            color: var(--text-sub);
            padding: 5px;
            border-radius: 50%;
            transition: background 0.2s;
        }
        .modal-close-icon:hover {
            background: rgba(0,0,0,0.05);
            color: var(--text-main);
        }
        
        /* Color Palette */
        .color-palette {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        .color-circle {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            cursor: pointer;
            border: 1px solid rgba(0,0,0,0.1);
        }
        .color-circle:hover { transform: scale(1.1); }
        .color-circle.active { border: 2px solid var(--primary); }
        
        /* Scrollbar */
        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
        
        /* Animations */
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        .fade-in { animation: fadeIn 0.3s ease forwards; }
        @keyframes spin { 100% { transform: rotate(360deg); } }
        
        /* Dark Mode Support (Basic) */
        body.dark-mode { --bg-color: #121212; --sidebar-bg: #1e1e1e; --text-main: #e0e0e0; --text-sub: #a0a0a0; }
        body.dark-mode .sidebar, body.dark-mode .user-pill, 
        body.dark-mode .create-note-wrapper, body.dark-mode .note-card, body.dark-mode .modal-content {
            background: #1e1e1e; color: #e0e0e0; border-color: #333;
        }
        body.dark-mode .search-box input, body.dark-mode .note-input-title,
        body.dark-mode .modal-title, body.dark-mode .modal-body {
            background: transparent; color: #e0e0e0;
        }
        body.dark-mode .search-box, body.dark-mode .toppest-links {
            background: #1e1e1e;
        }
        body.dark-mode .nav-item:hover, body.dark-mode .nav-item.active, body.dark-mode .toppest-links li.active, body.dark-mode .toppest-links li:hover { background: #2d2d2d; }
        body.dark-mode .top-bar { background: rgba(18, 18, 18, 0.8); }
        
        /* Fix for btn-google in dark mode */
        body.dark-mode .btn-google { border-color: #444; color: white;}

        /* Mobile */
        #sidebar-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.4);
            z-index: 99; /* Below sidebar, above content */
            display: none;
        }

        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                transform: translateX(-100%);
                height: 100%;
            }
            .sidebar.open {
                transform: translateX(0);
            }
            .sidebar .toggle-btn {
                display: none; /* Hide desktop toggle */
            }

            #mobile-menu-toggle {
                display: inline-flex; /* It's an .icon-btn */
                color: var(--text-main);
            }

            .top-bar {
                flex-direction: row;
                justify-content: space-between;
            }
            .meta-wrapper, .create-actions{
                flex-direction: column;
                gap: 10px;
            }

            .toppest-bar { display: none; } /* Redundant on mobile */
        }

        /* Modal specific adjustments */

        /* --- Note Card Tags & Reminders --- */
        .note-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 12px;
        }
        .icon-btn {
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            border-radius: 50%;
            color: var(--text-sub);
            transition: 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .icon-btn:hover {color: var(--text-main); }
        .actions-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        .note-tag {
            background: rgba(0, 0, 0, 0.05);
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--text-sub);
            border: 1px solid rgba(0,0,0,0.05);
        }
        .note-reminder-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 12px;
            padding: 4px 12px;
            background: rgba(0, 0, 0, 0.06);
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 500;
            color: inherit;
            width: fit-content;
        }
        
        /* Event Chip in Editor */
        .events-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 0 20px 10px 20px;
        }
        .event-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin: 0 20px 5px 20px;
            padding: 6px 12px;
            background: rgba(74, 86, 255, 0.1);
            border: 1px solid rgba(74, 86, 255, 0.2);
            border-radius: 8px;
            color: var(--primary);
            font-size: 0.85rem;
            font-weight: 500;
            width: fit-content;
            cursor: pointer;
        }
        .note-event-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 12px;
            margin-right: 8px;
            padding: 4px 12px;
            background: rgba(74, 86, 255, 0.1);
            border: 1px solid rgba(74, 86, 255, 0.2);
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 500;
            color: var(--primary);
            width: fit-content;
        }

        /* --- Todo List Styles --- */
        .note-todo-list {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .note-todo-list li {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 4px;
        }
        .note-todo-list li span.checked-item {
            text-decoration: line-through;
            opacity: 0.7;
        }

        /* Create Note List Input */
        .list-input-group {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
            padding: 10px 20px;
        }
        .list-input-group input {
            flex: 1;
            border: none;
            border-bottom: 1px solid #e0e0e0;
            padding: 8px 0;
            font-size: 1rem;
            background: transparent;
            color: var(--text-main);
            transition: border-color 0.2s;
        }
        .list-input-group input:focus {
            border-bottom-color: var(--primary);
        }
        .list-input-group button {
            padding: 6px 16px;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 6px;
            font-weight: 600;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .list-input-group button:hover {
            opacity: 0.9;
            transform: translateY(-1px);
        }
        #todo-preview-list {
            list-style: none;
            padding: 0 20px 15px 20px;
            margin: 0;
        }
        #todo-preview-list li {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 6px 0;
            animation: fadeIn 0.2s ease;
        }
        #todo-preview-list li input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: var(--primary);
            cursor: pointer;
        }
        #todo-preview-list li span {
            font-size: 0.95rem;
            color: var(--text-main);
        }

        /* Modal List Items */
        .modal-list-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
            padding: 4px 0;
        }
        .modal-item-check {
            width: 18px;
            height: 18px;
            accent-color: var(--primary);
            cursor: pointer;
        }
        .modal-item-text {
            flex: 1;
            border: none;
            border-bottom: 1px solid transparent;
            background: transparent;
            font-size: 1.1rem;
            color: var(--text-main);
            padding: 4px 0;
        }
        .modal-item-text:focus {
            border-bottom-color: var(--primary);
        }

        /* --- More Options Menu --- */
        .more-menu-wrapper { position: relative; }
        .more-options-menu {
            position: absolute;
            bottom: 100%;
            left: 0;
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.15);
            padding: 8px;
            min-width: 220px;
            display: none;
            z-index: 100;
            margin-bottom: 10px;
        }
        .more-options-menu.show { display: block; animation: fadeIn 0.2s ease; }
        
        .menu-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            border-radius: 8px;
            color: var(--text-sub);
        }
        .menu-item:hover { background: #f4f7fe; color: var(--primary); }
        .menu-item span { font-size: 20px; }
        
        .menu-input {
            border: none;
            background: transparent;
            font-size: 0.9rem;
            color: var(--text-main);
            width: 100%;
            font-family: inherit;
        }
        body.dark-mode .more-options-menu { background: #2d2d2d; border: 1px solid #444; }
        body.dark-mode .menu-item:hover { background: #3d3d3d; }
        body.dark-mode .menu-input { color: #e0e0e0; }

        /* --- AI Dropdown --- */
        .ai-tools-wrapper {
            position: absolute;
            top: 10px;
            right: 45px;
            z-index: 6;
        }
        .modal-ai-tools { top: 15px; }

        @media (max-width: 768px) {
            .ai-tools-wrapper {
                position: relative;
                top: auto;
                right: auto;
                margin-left: 20px;
                margin-top: 10px;
                margin-bottom: 10px;
                display: inline-block;
                vertical-align: middle;
            }

            .calendar-top-btn {
                position: relative;
                top: auto;
                right: auto;
                margin-left: 5px;
                display: inline-block;
                vertical-align: middle;
            }
        }

        .ai-dropdown-menu {
            position: absolute;
            top: 100%;
            right: 0;
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(74, 86, 255, 0.15);
            padding: 8px;
            min-width: 180px;
            display: none;
            z-index: 100;
            border: 1px solid rgba(74, 86, 255, 0.1);
        }
        .ai-dropdown-menu.show { display: block; animation: fadeIn 0.2s ease; }
        
        .ai-menu-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border-radius: 8px;
            color: var(--text-main);
            font-size: 0.9rem;
            cursor: pointer;
            position: relative;
        }
        .ai-menu-item:hover { background: #f4f7fe; color: var(--primary); }
        .ai-menu-item span { font-size: 18px; }
        
        /* Nested Submenu */
        .ai-submenu {
            display: none;
            position: absolute;
            top: 0;
            right: 100%;
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
            padding: 8px;
            min-width: 150px;
            margin-right: 5px;
        }
        .ai-menu-item.has-submenu:hover .ai-submenu { display: block; animation: fadeIn 0.2s ease; }
        
        @media (max-width: 768px) {
            .ai-menu-item.has-submenu { flex-direction: column; align-items: flex-start; }
            .ai-submenu { 
                position: static; 
                width: 100%; 
                box-shadow: none; 
                border: 1px solid rgba(0,0,0,0.05); 
                margin-top: 5px; 
            }
        }

        body.dark-mode .ai-dropdown-menu, body.dark-mode .ai-submenu { background: #2d2d2d; border-color: #444; }
        body.dark-mode .ai-menu-item:hover { background: #3d3d3d; }

        /* Calendar Button Position */
        .calendar-top-btn {
            position: absolute;
            top: 10px;
            right: 85px;
            z-index: 6;
        }
        .modal-cal-btn {
            top: 15px;
        }

        /* AI Icon */
        .ai-icon-square {
            width: 14px;
            height: 14px;
            background-color: black;
            transform: rotate(15deg);
            display: inline-block;
            border-radius: 1px;
        }
        body.dark-mode .ai-icon-square { background-color: #e0e0e0; }

        /* --- Settings View --- */
        .settings-container {
            max-width: 800px;
            margin: 0 auto;
            animation: fadeIn 0.3s ease;
        }
        .setting-section {
            background: white;
            padding: 25px;
            border-radius: 20px;
            margin-bottom: 25px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
        }
        .setting-section h3 {
            margin-bottom: 5px;
            font-size: 1.2rem;
        }
        /* Color settings text as requested */
        .settings-container h2, .settings-container h3 { color: var(--primary); }

        .setting-desc {
            color: var(--text-sub);
            margin-bottom: 20px;
            font-size: 0.95rem;
        }

        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        /* Theme Options */
        .theme-toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 28px;
        }
        .theme-toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
        }
        input:checked + .slider {
            background-color: var(--primary);
        }
        input:checked + .slider:before {
            transform: translateX(22px);
        }
        .slider.round { border-radius: 34px; }
        .slider.round:before { border-radius: 50%; }
        
        /* Banner Options */
        .banner-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }
        .banner-option {
            height: 80px;
            border-radius: 10px;
            overflow: hidden;
            cursor: pointer;
            border: 2px solid transparent;
            transition: 0.2s;
        }
        .banner-option:hover { transform: scale(1.05); }
        .banner-option img { width: 100%; height: 100%; object-fit: cover; }
        .banner-option.active {
            border-color: var(--primary);
            transform: scale(1.05);
        }
        
        .custom-banner-input { display: flex; gap: 10px; }
        .custom-banner-input input {
            flex: 1;
            padding: 10px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
        }
        .custom-banner-input button {
            padding: 0 20px;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
        }
        
        /* Dark Mode for Settings */
        body.dark-mode .setting-section { background: #1e1e1e; }
        body.dark-mode .custom-banner-input input { 
            background: #2d2d2d; 
            border-color: #444; 
            color: white; 
        }

        /* --- Calendar Modal --- */
        #cal-modal {
            position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px);
            z-index: 3000; display: none; align-items: center; justify-content: center;
        }
        .cal-modal-content {
            background: white; width: 450px; max-width: 90%; border-radius: 20px; padding: 25px;
            box-shadow: 0 20px 50px rgba(0,0,0,0.2); display: flex; flex-direction: column;
        }
        .cal-tabs { display: flex; gap: 15px; margin-bottom: 20px; border-bottom: 1px solid #eee; }
        .cal-tab { padding-bottom: 10px; cursor: pointer; font-weight: 600; color: var(--text-sub); border-bottom: 2px solid transparent; transition: 0.2s; }
        .cal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
        .cal-view { display: none; }
        .cal-view.active { display: flex; flex-direction: column; gap: 15px; }
        .cal-event-list { max-height: 250px; overflow-y: auto; border: 1px solid #eee; border-radius: 10px; margin-bottom: 15px; }
        .cal-event-item { padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; transition: 0.2s; }
        .cal-event-item:last-child { border-bottom: none; }
        .cal-event-item:hover, .cal-event-item.selected { background: #f4f7fe; }
        .cal-event-item.selected { border-left: 3px solid var(--primary); }
        .cal-event-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
        .cal-event-meta { font-size: 0.85rem; color: var(--text-sub); display: flex; align-items: center; gap: 5px; }
        
        body.dark-mode .cal-modal-content { background: #1e1e1e; color: #e0e0e0; }
        body.dark-mode .cal-event-list { border-color: #333; }
        body.dark-mode .cal-event-item { border-bottom-color: #333; }
        body.dark-mode .cal-event-item:hover, body.dark-mode .cal-event-item.selected { background: #2d2d2d; }