        :root {
            --primary-color: #4f46e5;
            --secondary-color: #f9fafb;
            --text-color: #374151;
            --border-color: #e5e7eb;
            --success-color: #10b981;
            --error-color: #ef4444;
            --code-bg: #f3f4f6;
            --sidebar-width: 280px;
            --sidebar-bg: #f8fafc;
        }
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            line-height: 1.6;
            color: var(--text-color);
            background-color: #f8fafc;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            position: relative;
        }
        .sidebar-toggle {
            position: fixed;
            left: 0;
            top: 1rem;
            z-index: 100;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 0 6px 6px 0;
            padding: 0.75rem;
            cursor: pointer;
            display: none;
            transition: all 0.3s;
        }
        .sidebar-toggle:hover {
            background-color: #4338ca;
        }
        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--sidebar-bg);
            border-right: 1px solid var(--border-color);
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            padding: 1.5rem 1rem;
            overflow-y: auto;
            transition: transform 0.3s ease;
            z-index: 90;
        }
        .sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }
        .sidebar-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--primary-color);
        }
        .sidebar-actions {
            display: flex;
            gap: 0.5rem;
        }
        .sidebar-btn {
            background: none;
            border: none;
            color: var(--primary-color);
            cursor: pointer;
            font-size: 1rem;
            padding: 0.25rem;
            border-radius: 4px;
        }
        .sidebar-btn:hover {
            background-color: rgba(79, 70, 229, 0.1);
        }
        .notes-list {
            list-style: none;
        }
        .note-item {
            padding: 0.75rem;
            border-radius: 6px;
            margin-bottom: 0.5rem;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .note-item:hover {
            background-color: rgba(79, 70, 229, 0.05);
        }
        .note-item.active {
            background-color: rgba(79, 70, 229, 0.1);
            font-weight: 500;
        }
        .note-name {
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .note-actions {
            display: none;
        }
        .note-item:hover .note-actions {
            display: flex;
            gap: 0.25rem;
        }
        .note-action-btn {
            background: none;
            border: none;
            color: var(--text-color);
            cursor: pointer;
            font-size: 0.75rem;
            padding: 0.25rem;
            border-radius: 4px;
        }
        .note-action-btn:hover {
            background-color: rgba(0, 0, 0, 0.05);
        }
        .add-note-form {
            margin-top: 1rem;
            display: flex;
            gap: 0.5rem;
        }
        .add-note-input {
            flex: 1;
            padding: 0.5rem;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 0.875rem;
        }
        .add-note-btn {
            padding: 0.5rem;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .container {
            max-width: 1400px;
            margin: 2rem auto 2rem calc(var(--sidebar-width) + 2rem);
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            padding: 2rem;
            flex: 1;
            width: calc(100% - var(--sidebar-width) - 4rem);
            transition: margin 0.3s ease;
        }
        .header {
            margin-bottom: 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }
        .title {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--primary-color);
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        .title i {
            font-size: 1.5rem;
        }
        .back-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            background-color: var(--primary-color);
            color: white;
            border-radius: 6px;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.2s;
        }
        .back-btn:hover {
            background-color: #4338ca;
            transform: translateY(-1px);
        }
        .grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
        }
        @media (max-width: 1024px) {
            .sidebar {
                transform: translateX(-100%);
            }
            .sidebar.active {
                transform: translateX(0);
            }
            .container {
                margin-left: 2rem;
                width: calc(100% - 2rem);
            }
            .sidebar-toggle {
                display: block;
            }
        }
        @media (max-width: 768px) {
            .grid {
                grid-template-columns: 1fr;
            }
        }
        .panel {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .label {
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--text-color);
        }
        .word-count {
            font-size: 0.75rem;
            color: #6b7280;
        }
        .textarea {
            width: 100%;
            height: 500px;
            padding: 1rem;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            resize: vertical;
            font-size: 0.9375rem;
            line-height: 1.7;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .textarea:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
        }
        .preview-container {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            height: 100%;
        }
        .preview {
            width: 100%;
            height: 500px;
            padding: 1rem;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            overflow-y: auto;
            background-color: white;
            font-size: 0.9375rem;
            line-height: 1.7;
        }
        .toolbar {
            display: flex;
            justify-content: flex-end;
            gap: 0.75rem;
        }
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            font-size: 0.875rem;
            font-weight: 500;
            color: white;
            background-color: var(--primary-color);
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .btn:hover {
            background-color: #4338ca;
            transform: translateY(-1px);
        }
        .btn i {
            font-size: 0.875rem;
        }
        .btn-secondary {
            background-color: white;
            color: var(--text-color);
            border: 1px solid var(--border-color);
        }
        .btn-secondary:hover {
            background-color: var(--secondary-color);
            transform: translateY(-1px);
        }
        /* Preview Styles */
        .preview h1 {
            font-size: 2em;
            margin: 0.67em 0;
            padding-bottom: 0.3em;
            border-bottom: 1px solid var(--border-color);
        }
        .preview h2 {
            font-size: 1.5em;
            margin: 0.83em 0;
            padding-bottom: 0.3em;
            border-bottom: 1px solid var(--border-color);
        }
        .preview h3 {
            font-size: 1.25em;
            margin: 1em 0;
        }
        .preview ul,
        .preview ol {
            padding-left: 2em;
            margin: 1em 0;
        }
        .preview p {
            margin: 1em 0;
        }
        .preview blockquote {
            margin: 1em 0;
            padding: 0 1em;
            color: #6b7280;
            border-left: 4px solid var(--border-color);
        }
        .preview code {
            background-color: var(--code-bg);
            padding: 0.2em 0.4em;
            border-radius: 4px;
            font-size: 0.9em;
        }
        .preview pre {
            background-color: var(--code-bg);
            padding: 1em;
            border-radius: 6px;
            overflow-x: auto;
            margin: 1em 0;
        }
        .preview pre code {
            background-color: transparent;
            padding: 0;
        }
        .preview a {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 500;
        }
        .preview a:hover {
            text-decoration: underline;
        }
        .preview table {
            border-collapse: collapse;
            width: 100%;
            margin: 1em 0;
        }
        .preview th,
        .preview td {
            border: 1px solid var(--border-color);
            padding: 0.5em 1em;
        }
        .preview th {
            background-color: var(--secondary-color);
        }
        .preview img {
            max-width: 100%;
            border-radius: 6px;
        }
        .preview hr {
            border: none;
            height: 1px;
            background-color: var(--border-color);
            margin: 1.5em 0;
        }
        /* Toast notification */
        .toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: var(--success-color);
            color: white;
            padding: 0.75rem 1.25rem;
            border-radius: 6px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            display: flex;
            align-items: center;
            gap: 0.75rem;
            z-index: 100;
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.3s ease;
        }
        .toast.show {
            opacity: 1;
            transform: translateY(0);
        }
        .toast.error {
            background-color: var(--error-color);
        }
        .footer {
            text-align: center;
            padding: 1rem;
            background-color: var(--primary-color);
            color: white;
            font-size: 0.875rem;
            text-decoration: none;
        }
        .math-block {
            margin: 1em 0;
            padding: 1em;
            overflow-x: auto;
            text-align: center;
            background-color: #f8f9fa;
            border-radius: 4px;
        }
        .math-inline {
            background-color: #f8f9fa;
            padding: 0.2em 0.4em;
            border-radius: 3px;
        }
        .mjx-chtml {
            outline: none;
        }
        .md-image {
            max-width: 100%;
            border-radius: 4px;
            margin: 0.5em 0;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        .md-link {
            color: #4f46e5;
            text-decoration: none;
            border-bottom: 1px solid #c7d2fe;
            transition: all 0.3s;
        }
        .processing .loader {
            display: inline-block;
        }
        .loader {
            display: none;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top: 2px solid white;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            animation: spin 1s linear infinite;
            margin-left: 8px;
        }
        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }