        :root {
            --bg-main: #ffffff;
            --bg-sidebar: #f9f9f9;
            --bg-card: #fdfdfd;
            --bg-input: #ffffff;
            --border-color: #e5e5e5;
            --text-primary: #0d0d0d;
            --text-secondary: #6e6e80;
            --accent: #10a37f;
            --accent-hover: #0d8a6a;
            --bg-code: #f6f6f8;
            --danger: #ef4146;
            --danger-hover: #c92a2e;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
        }

        body {
            background-color: var(--bg-main);
            color: var(--text-primary);
            display: flex;
            height: 100vh;
            overflow: hidden;
            font-size: 15px;
        }

        /* ======================= SIDEBAR ======================= */
        .sidebar {
            width: 260px;
            background-color: var(--bg-sidebar);
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            transition: transform 0.3s ease;
        }

        .sidebar-header {
            padding: 12px;
        }

        .new-chat-btn {
            width: 100%;
            padding: 12px 16px;
            background: transparent;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background 0.2s;
        }

        .new-chat-btn:hover {
            background: #ececec;
        }

        .sidebar-section-title {
            padding: 16px 12px 8px;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
        }

        .history-list {
            flex: 1;
            overflow-y: auto;
            padding: 0 8px;
        }

        .history-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            color: var(--text-primary);
            cursor: pointer;
            border-radius: 8px;
            transition: background 0.2s;
            font-size: 14px;
            margin-bottom: 2px;
        }

        .history-item:hover {
            background: #ececec;
        }

        .history-item.active {
            background: #e3e3e3;
            font-weight: 500;
        }

        .history-title {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
        }

        .delete-history-btn {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s, color 0.2s;
            font-size: 16px;
            padding: 0 4px;
        }

        .history-item:hover .delete-history-btn {
            opacity: 1;
        }

        .delete-history-btn:hover {
            color: var(--danger);
        }

        .sidebar-footer {
            padding: 12px;
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            color: var(--text-secondary);
            cursor: pointer;
            border-radius: 8px;
            transition: background 0.2s, color 0.2s;
            font-size: 14px;
        }

        .nav-item:hover,
        .nav-item.active {
            background: #ececec;
            color: var(--text-primary);
        }

        .nav-item.active {
            font-weight: 600;
        }

        .nav-item i {
            font-size: 18px;
        }

        /* ======================= MAIN CONTENT ======================= */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--bg-main);
            position: relative;
            overflow: hidden;
        }

        .view-section {
            display: none;
            flex: 1;
            overflow: hidden;
            flex-direction: column;
        }

        .view-section.active {
            display: flex;
        }

        .content-scrollable {
            flex: 1;
            overflow-y: auto;
            padding: 32px 24px;
            max-width: 860px;
            width: 100%;
            margin: 0 auto;
        }

        /* ======================= CHAT VIEW ======================= */
        .chat-header {
            padding: 16px 24px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 600;
            color: var(--text-secondary);
            font-size: 14px;
        }

        .chat-scroll-area {
            flex: 1;
            overflow-y: auto;
            padding: 24px 0;
        }

        .chat-container {
            max-width: 768px;
            margin: 0 auto;
            padding: 0 24px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .message-row {
            display: flex;
            gap: 16px;
            animation: slideUp 0.3s ease;
            width: 100%;
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .msg-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            color: white;
            flex-shrink: 0;
        }

        .ai-avatar {
            background: var(--accent);
        }

        .user-avatar {
            background: #5436DA;
        }

        .msg-content-wrapper {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .msg-role {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 4px;
        }

        .msg-content {
            line-height: 1.6;
            font-size: 15px;
            color: var(--text-primary);
            word-wrap: break-word;
        }

        .typing-indicator {
            display: flex;
            gap: 6px;
            align-items: center;
            height: 20px;
        }

        .typing-indicator span {
            width: 8px;
            height: 8px;
            background: var(--text-secondary);
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out;
        }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes bounce {

            0%,
            80%,
            100% {
                transform: translateY(0);
                opacity: 0.5;
            }

            40% {
                transform: translateY(-8px);
                opacity: 1;
            }
        }

        .chat-input-area {
            padding: 16px 24px 24px;
            background: var(--bg-main);
        }

        .input-wrapper {
            max-width: 768px;
            margin: 0 auto;
            border: 1px solid var(--border-color);
            border-radius: 24px;
            padding: 8px 8px 8px 20px;
            display: flex;
            align-items: flex-end;
            background: var(--bg-input);
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
            transition: border-color 0.2s;
        }

        .input-wrapper:focus-within {
            border-color: var(--accent);
        }

        #prompt-input {
            flex: 1;
            border: none;
            outline: none;
            background: transparent;
            font-size: 15px;
            color: var(--text-primary);
            resize: none;
            max-height: 200px;
            line-height: 1.5;
            padding: 8px 0;
        }

        .send-btn {
            background: var(--accent);
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            color: white;
            font-size: 18px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-left: 8px;
            transition: background 0.2s;
        }

        .send-btn:hover {
            background: var(--accent-hover);
        }

        .send-btn:disabled {
            background: #d9d9e3;
            cursor: not-allowed;
        }

        /* ======================= SETTINGS & DOCS UI ======================= */
        .page-title {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .page-desc {
            color: var(--text-secondary);
            margin-bottom: 28px;
            font-size: 14px;
        }

        .setting-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .setting-card-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .setting-card-desc {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 16px;
        }

        .btn-group {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .btn {
            padding: 10px 16px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border: 1px solid var(--border-color);
            background: white;
            color: var(--text-primary);
            transition: all 0.2s;
        }

        .btn:hover {
            background: #f5f5f5;
        }

        .btn-primary {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
        }

        .btn-primary:hover {
            background: var(--accent-hover);
        }

        .btn-danger {
            background: var(--danger);
            color: white;
            border-color: var(--danger);
        }

        .btn-danger:hover {
            background: var(--danger-hover);
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-group label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 6px;
        }

        .form-control {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }

        .form-control:focus {
            border-color: var(--accent);
        }

        .range-slider {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .range-slider input {
            flex: 1;
        }

        .range-value {
            font-weight: 600;
            font-size: 14px;
            width: 40px;
            text-align: right;
        }

        .code-block {
            background: var(--bg-code);
            border: 1px solid var(--border-color);
            padding: 16px;
            border-radius: 8px;
            margin-top: 10px;
            position: relative;
            overflow-x: auto;
        }

        .code-block pre {
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 13px;
            color: #333;
        }

        .copy-btn {
            position: absolute;
            top: 8px;
            right: 8px;
            background: white;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }

        /* ======================= MODAL & TOAST ======================= */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(2px);
        }

        .modal-box {
            background: white;
            padding: 24px;
            border-radius: 12px;
            width: 340px;
            text-align: center;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
            animation: popIn 0.25s ease;
        }

        @keyframes popIn {
            from {
                transform: scale(0.9);
                opacity: 0;
            }

            to {
                transform: scale(1);
                opacity: 1;
            }
        }

        .modal-box h3 {
            margin-bottom: 8px;
            font-size: 18px;
        }

        .modal-box p {
            color: var(--text-secondary);
            font-size: 14px;
            margin-bottom: 20px;
            line-height: 1.4;
        }

        .modal-actions {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        .toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: #2a2a2a;
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s, transform 0.3s;
            transform: translateY(20px);
            pointer-events: none;
            z-index: 9999;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .toast.show {
            opacity: 1;
            transform: translateY(0);
        }

        @media (max-width: 768px) {
            .sidebar {
                position: absolute;
                height: 100%;
                z-index: 10;
                transform: translateX(-100%);
            }

            .sidebar.open {
                transform: translateX(0);
            }

            .menu-toggle {
                display: block !important;
            }
        }

        .menu-toggle {
            display: none;
            position: absolute;
            top: 14px;
            left: 14px;
            font-size: 24px;
            cursor: pointer;
            z-index: 20;
            background: white;
            border-radius: 50%;
            padding: 4px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }