/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-elevated: #16213e;
    --bg-hover: rgba(255,255,255,0.05);
    --bg-active: rgba(99,102,241,0.15);
    --border-subtle: rgba(255,255,255,0.06);
    --border-medium: rgba(255,255,255,0.1);
    --border-accent: rgba(99,102,241,0.4);
    --text-primary: #e8e8f0;
    --text-secondary: #9898b0;
    --text-muted: #5a5a78;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99,102,241,0.3);
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --user-bubble: linear-gradient(135deg, #6366f1, #8b5cf6);
    --assistant-bubble: rgba(255,255,255,0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --sidebar-width: 260px;
    --header-height: 56px;
    --input-height: 100px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Layout ===== */
#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), opacity var(--transition);
    z-index: 20;
}

#sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    min-width: 0;
    width: 0;
    opacity: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Nav */
.mode-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--accent-light);
}

.nav-item.active svg {
    stroke: var(--accent-light);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border-subtle);
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 3px 0;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.offline { background: var(--error); box-shadow: 0 0 6px rgba(239,68,68,0.4); }

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.new-chat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ===== Main Content ===== */
#mainContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* Header */
#mainHeader {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(10,10,15,0.8);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 16px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.model-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-active);
    color: var(--accent-light);
    font-weight: 500;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn.active {
    background: var(--bg-active);
    color: var(--accent-light);
}

/* ===== Content Area ===== */
#contentArea {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Welcome */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 24px var(--accent-glow));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-content p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 32px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.quick-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    color: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-btn svg { opacity: 0.7; }
.quick-btn:hover svg { opacity: 1; }

/* Messages */
.messages-container {
    height: 100%;
    overflow-y: auto;
    padding: 24px 0;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 16px;
    padding: 8px 24px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.user .message-avatar {
    background: var(--user-bubble);
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: capitalize;
}

.message-content {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-primary);
    word-break: break-word;
}

/* User bubble */
.message.user .message-content {
    background: var(--user-bubble);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-top-right-radius: 4px;
    display: inline-block;
    max-width: 100%;
}

/* Assistant content - markdown */
.message.assistant .message-content {
    padding: 4px 0;
}

.message.assistant .message-content p { margin-bottom: 12px; }
.message.assistant .message-content p:last-child { margin-bottom: 0; }

.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3 {
    margin: 20px 0 10px;
    font-weight: 600;
}

.message.assistant .message-content h1 { font-size: 1.4em; }
.message.assistant .message-content h2 { font-size: 1.2em; }
.message.assistant .message-content h3 { font-size: 1.1em; }

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message.assistant .message-content li { margin-bottom: 4px; }

.message.assistant .message-content code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.message.assistant .message-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    overflow: hidden;
}

.message.assistant .message-content pre code {
    display: block;
    padding: 16px;
    overflow-x: auto;
    background: none;
    font-size: 13px;
    line-height: 1.5;
}

.message.assistant .message-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-secondary);
}

.message.assistant .message-content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
    font-size: 13px;
}

.message.assistant .message-content th,
.message.assistant .message-content td {
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    text-align: left;
}

.message.assistant .message-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.message.assistant .message-content a {
    color: var(--accent-light);
    text-decoration: none;
}

.message.assistant .message-content a:hover {
    text-decoration: underline;
}

.message.assistant .message-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

.message.assistant .message-content hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 16px 0;
}

/* User attachments in messages */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-attachments img {
    max-width: 300px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition);
}

.message-attachments img:hover {
    transform: scale(1.02);
}

/* Media in messages */
.message-media {
    margin: 12px 0;
}

.message-media img {
    max-width: 100%;
    max-height: 512px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.message-media audio {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-sm);
}

.message-media video {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* Loading spinner */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Input Area ===== */
#inputArea {
    border-top: 1px solid var(--border-subtle);
    background: rgba(10,10,15,0.9);
    backdrop-filter: blur(12px);
    padding: 0 24px 16px;
}

.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.attachment-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.attachment-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
}

.attachment-item .remove-attachment {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-item .audio-attachment {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 40px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    gap: 6px;
    padding: 0 12px;
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color var(--transition);
}

.input-row:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-actions-left {
    display: flex;
    gap: 2px;
    padding-bottom: 2px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn.recording {
    color: var(--error);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.input-center {
    flex: 1;
    min-width: 0;
}

#textInput {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 150px;
    padding: 6px 0;
    font-family: inherit;
}

#textInput::placeholder {
    color: var(--text-muted);
}

.input-actions-right {
    display: flex;
    gap: 4px;
    padding-bottom: 2px;
}

.send-btn, .stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.send-btn {
    background: var(--accent);
    color: white;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-light);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.stop-btn {
    background: var(--error);
    color: white;
}

.stop-btn:hover {
    background: #dc2626;
}

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 6px;
}

/* ===== Recording Overlay ===== */
.recording-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.recording-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    min-width: 320px;
}

.recording-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.recording-pulse {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,71,87,0.15);
    animation: recPulse 1.5s infinite;
}

@keyframes recPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.recording-timer {
    font-size: 36px;
    font-weight: 300;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 16px;
}

.recording-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
}

.rec-cancel-btn {
    padding: 10px 24px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.rec-cancel-btn:hover {
    background: var(--bg-hover);
}

.rec-stop-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--error);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.rec-stop-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(239,68,68,0.4);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    animation: slideIn 0.3s ease;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.info { background: var(--bg-elevated); border: 1px solid var(--border-medium); color: var(--text-primary); }
.toast.success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: var(--success); }
.toast.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--error); }
.toast.warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 30;
    }
    
    #sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .message {
        padding: 8px 12px;
    }
}

/* ===== Image Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-sm);
}

/* ===== Generation progress ===== */
.gen-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin: 8px 0;
}

.gen-progress .spinner {
    width: 24px;
    height: 24px;
}

.gen-progress-text {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ===== Key Status Indicator ===== */
.key-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
    background: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.key-status.set {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.key-status.unset {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245,158,11,0.4);
    animation: pulse 2s infinite;
}

/* ===== Settings Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
}

.setting-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    outline: none;
    transition: border-color var(--transition);
}

.setting-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.api-key-input-row {
    display: flex;
    gap: 8px;
}

.api-key-input-row .setting-input {
    flex: 1;
}

.toggle-visibility-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.toggle-visibility-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.validate-result {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.validate-result.success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: var(--success);
}

.validate-result.error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--error);
}

.validate-result.loading {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--accent-light);
}

.model-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.model-list .model-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-active);
    color: var(--accent-light);
    font-size: 12px;
    font-family: monospace;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== Model Selector ===== */
.model-selector {
    background: var(--bg-tertiary);
    color: var(--accent-light);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.model-selector option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== GPU Status Panel ===== */
.gpu-panel {
    padding: 8px 12px 4px;
}

.gpu-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.gpu-state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--success);
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.gpu-state-dot.sleeping {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245,158,11,0.5);
    animation: pulse 2s infinite;
}

.gpu-state-dot.exclusive {
    background: var(--error);
    box-shadow: 0 0 6px rgba(239,68,68,0.5);
    animation: pulse 1s infinite;
}

.gpu-state-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== Blueprint Bar ===== */
.blueprint-bar {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.blueprint-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blueprint-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.blueprint-select {
    flex: 1;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.blueprint-select:focus {
    border-color: var(--accent);
}

.blueprint-select option {
    background: var(--bg-secondary);
}

.blueprint-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-left: 0;
}
