:root {
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-text-secondary: #6b7280;
    --color-text-tertiary: #9ca3af;
    --color-primary: #111827;
    --color-primary-hover: #374151;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-danger-bg: #fef2f2;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-info: #2563eb;
    --color-info-bg: #eff6ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 200ms ease;
    --sidebar-width: 280px;
}

[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-surface: #141414;
    --color-border: #262626;
    --color-text: #fafafa;
    --color-text-secondary: #a3a3a3;
    --color-text-tertiary: #737373;
    --color-primary: #fafafa;
    --color-primary-hover: #e5e5e5;
    --color-danger: #f87171;
    --color-danger-hover: #ef4444;
    --color-danger-bg: #1c1010;
    --color-success:  #34d399;
    --color-success-bg: #0d1f17;
    --color-warning:  #fbbf24;
    --color-warning-bg: #1c1a0d;
    --color-info: #60a5fa;
    --color-info-bg: #0c1929;
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after {
    margin: 0;
    padding:  0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:  var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    overflow:  hidden;
}

.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* Scrollbar */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--color-border);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* ==================== SIDEBAR ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    animation: fadeIn 0.2s ease;
}

.sidebar-overlay.visible {
    display: block;
}

.sidebar {
    position: fixed;
    left: 0;
    top:  0;
    bottom: 0;
    width:  var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-chat-btn {
    flex: 1;
}

.btn-icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar-btn {
    display: flex;
}

.sidebar-search {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-search svg {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.sidebar-search input {
    flex: 1;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    outline: none;
}

.sidebar-search input::placeholder {
    color: var(--color-text-tertiary);
}

/* Chat History */
.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-group {
    margin-bottom: 16px;
}

.history-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-tertiary);
    padding: 8px 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius:  var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.history-item:hover {
    background: var(--color-bg);
}

.history-item.active {
    background: var(--color-bg);
}

.history-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 14px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-menu {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    opacity: 0;
    transition: all var(--transition);
    background: none;
    border: none;
    cursor: pointer;
}

.history-item:hover .history-item-menu {
    opacity: 1;
}

.history-item-menu:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.history-item.temp {
    border: 1px dashed var(--color-border);
}

.history-item.temp .history-item-icon {
    color: var(--color-warning);
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-tertiary);
    font-size: 14px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap:  8px;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-footer-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.sidebar-footer-btn.user-btn {
    flex:  1;
    justify-content: flex-start;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius:  50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg);
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid var(--color-border);
}

.menu-btn {
    flex-shrink: 0;
}

.chat-title {
    flex: 1;
    min-width: 0;
}

.chat-title h1 {
    font-size:  16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.chat-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.model-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
}

.temp-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--color-warning-bg);
    color: var(--color-warning);
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
}

.temp-badge.hidden {
    display: none;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    margin: 0 auto 24px;
    color: var(--color-text-tertiary);
}

.welcome-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-content > p {
    font-size:  14px;
    color:  var(--color-text-secondary);
    margin-bottom: 32px;
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.suggestion-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.suggestion-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.suggestion-btn svg {
    color: var(--color-text-secondary);
    flex-shrink: 0;
}
 
/* Messages Container */
.messages-container {
    padding: 24px 0;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.messages-container.hidden {
    display: none;
}

/* Message */
.message {
    padding: 24px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: relative;
    background: none;
}

.message:last-child {
    border-bottom: none;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px 18px 4px 18px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    position: relative;
    word-break: break-word;
}

.message.user .message-bubble {
    background: #111827;
    color: #fff;
    border-radius: 18px 18px 18px 4px;
    margin-left: auto;
    margin-right: 0;
}

[data-theme="dark"] .message.user .message-bubble {
    background: #111827;
    color: #fff;
}

.message.assistant .message-bubble {
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 18px 18px 4px 18px;
    margin-right: auto;
    margin-left: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--color-primary);
    color: var(--color-bg);
}

.message.assistant .message-avatar {
    background: var(--color-success);
    color: white;
}

.message-role {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.message-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
}

.message-action-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Message Content */
.message-content {
    font-size: 15px;
    line-height:  1.7;
    color: var(--color-text);
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin:  20px 0 12px;
    font-weight: 600;
    line-height: 1.4;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size:  1.3em; }
.message-content h3 { font-size: 1.15em; }

.message-content p {
    margin:  12px 0;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left:  24px;
}

.message-content li {
    margin: 6px 0;
}

.message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.message-content pre {
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.message-content pre code {
    display: block;
    padding: 16px;
    background: transparent;
    border: none;
    overflow-x: auto;
    line-height: 1.6;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-secondary);
}

.code-block-header button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.code-block-header button:hover {
    color: var(--color-text);
    border-color: var(--color-text-tertiary);
}

.message-content blockquote {
    margin:  16px 0;
    padding:  12px 20px;
    border-left:  3px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content a {
    color: var(--color-info);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content hr {
    margin: 24px 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

/* Message Files */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.message-file svg {
    color: var(--color-text-secondary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--color-text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ==================== CHAT INPUT ==================== */
.chat-input-container {
    padding: 16px 24px 24px;
    background: var(--color-bg);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--color-primary);
}

[data-theme="dark"] .chat-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.attach-btn {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.attach-btn:hover {
    color: var(--color-text);
}

.input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.attached-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.attached-files:empty {
    display: none;
    margin-bottom: 0;
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.attached-file svg {
    width: 14px;
    height: 14px;
    color: var(--color-text-secondary);
}

.attached-file .remove-file {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
}

.attached-file .remove-file:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

#messageInput {
    width: 100%;
    border:  none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--color-text);
    resize: none;
    max-height: 200px;
    line-height: 1.5;
    padding: 8px 0;
    outline: none;
}

#messageInput::placeholder {
    color: var(--color-text-tertiary);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    max-width: 150px;
}

.model-selector:hover {
    color: var(--color-text);
}

.model-selector span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-send {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-bg);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-send:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-hint {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index:  200;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-height: 80vh;
    overflow:  hidden;
    display: flex;
    flex-direction: column;
}

.modal:not(.modal-md):not(.modal-lg) {
    max-width: 420px;
    padding: 24px;
}

.modal.modal-md {
    max-width: 480px;
}

.modal.modal-lg {
    max-width: 560px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding:  20px 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal h2 {
    font-size: 18px;
    font-weight:  600;
    margin-bottom: 8px;
}

.modal p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin:  0 auto 16px;
}

.modal-icon-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: -1px;
}

.modal-tab:hover {
    color:  var(--color-text);
}

.modal-tab.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Settings */
.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 14px;
    font-weight:  600;
    margin-bottom: 16px;
    color: var(--color-text);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
}

.setting-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.setting-description {
    display: block;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* Theme Selector */
.theme-selector {
    display: flex;
    gap: 8px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius:  var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-option:hover {
    border-color: var(--color-text-tertiary);
}

.theme-option.active {
    border-color: var(--color-primary);
    color: var(--color-text);
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor:  pointer;
    inset: 0;
    background: var(--color-border);
    border-radius: 24px;
    transition: all var(--transition);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--color-surface);
    border-radius: 50%;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* API Status */
.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}

.api-status .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.api-status .status-indicator.connected {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.api-status .status-indicator.disconnected {
    background: var(--color-text-tertiary);
}

.api-status .status-indicator.error {
    background: var(--color-danger);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight:  500;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-top: 4px;
}

.input-with-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-toggle .form-input {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Preset List */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.preset-btn:hover {
    border-color: var(--color-primary);
}

.preset-name {
    font-size: 14px;
    font-weight: 500;
    color:  var(--color-text);
}

.preset-url {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* About Content */
.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.about-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    margin-bottom:  16px;
    color: var(--color-text-tertiary);
}

.about-content h3 {
    font-size: 20px;
    font-weight:  600;
    margin-bottom: 4px;
}

.about-content .version {
    font-size:  13px;
    color: var(--color-text-tertiary);
    margin-bottom:  16px;
}

.about-content .description {
    font-size:  14px;
    color: var(--color-text-secondary);
    margin-bottom:  0;
    max-width: 300px;
}

/* Files Modal */
.files-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.files-tab {
    padding:  12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: -1px;
}

.files-tab:hover {
    color: var(--color-text);
}

.files-tab.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}

.files-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    min-height: 250px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.files-list.hidden {
    display: none;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.file-item:hover {
    background: var(--color-border);
}

.file-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-size: 14px;
    font-weight:  500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.file-item-actions {
    display: flex;
    gap: 4px;
}

.files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--color-text-tertiary);
}

.files-empty svg {
    margin-bottom: 12px;
}

.files-empty.hidden {
    display: none;
}

.files-footer {
    padding:  16px 24px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Model Modal */
.model-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
}

.model-search svg {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.model-search input {
    flex: 1;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    outline: none;
}

.model-search input::placeholder {
    color: var(--color-text-tertiary);
}

.model-list {
    padding: 8px;
    max-height: 400px;
    overflow-y:  auto;
}

.model-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--color-text-secondary);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.model-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.model-item:hover {
    background: var(--color-bg);
}

.model-item.selected {
    background: var(--color-bg);
}

.model-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 16px;
    flex-shrink: 0;
}

.model-item-info {
    flex: 1;
    min-width: 0;
}

.model-item-name {
    font-size: 14px;
    font-weight: 500;
    color:  var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-item-id {
    font-size: 12px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-item-check {
    color: var(--color-success);
    flex-shrink: 0;
}

.model-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    text-align: center;
    color: var(--color-text-secondary);
}

.model-error svg {
    color: var(--color-danger);
}

/* Context Menu */
.context-menu {
    position: fixed;
    min-width: 160px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 300;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius:  var(--radius-sm);
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: background var(--transition);
}

.context-menu-item:hover {
    background: var(--color-bg);
}

.context-menu-item svg {
    width: 14px;
    height: 14px;
    color: var(--color-text-secondary);
}

.context-menu-item.danger {
    color: var(--color-danger);
}

.context-menu-item.danger svg {
    color: var(--color-danger);
}

.context-menu-separator {
    height: 1px;
    background: var(--color-border);
    margin: 6px 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-bg);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border:  1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--color-danger-hover);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 400;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform:  translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    flex-shrink: 0;
}

.toast-icon.success { color: var(--color-success); }
.toast-icon.error { color: var(--color-danger); }
.toast-icon.warning { color: var(--color-warning); }
.toast-icon.info { color: var(--color-info); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 500;
    color:  var(--color-text);
}

.toast-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    word-break: break-word;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Utility Classes */
.hidden {
    display: none ! important;
}

/* Responsive */
@media (max-width:  768px) {
    .welcome-suggestions {
        grid-template-columns: 1fr;
    }
    
    .theme-selector {
        flex-direction: column;
    }
    
    .model-selector {
        max-width: 100px;
    }
    
    .chat-input-wrapper {
        flex-wrap: wrap;
    }
    
    .input-actions {
        width: 100%;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid var(--color-border);
        margin-top: 8px;
    }
    
    .modal {
        margin:  16px;
        max-height: calc(100vh - 32px);
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    
    .toast {
        max-width: none;
    }
}

@media (min-width: 1024px) {
    .close-sidebar-btn {
        display: none;
    }
}