:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: rgba(5, 5, 5, 0.98);
  --panel-solid: #070707;
  --panel-2: #0d0d0e;
  --panel-3: #151517;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f2f4f7;
  --muted: #9ca3ad;
  --muted-2: #6f7782;
  --accent: #a9b0ba;
  --accent-2: #c4c9d0;
  --accent-soft: rgba(255, 255, 255, 0.065);
  --danger: #ff6b7a;
  --warning: #f7bf6b;
  --code-bg: #090a0c;
  --code-header: #111216;
  --code-text: #e4e7eb;
  --radius: 13px;
  --sidebar: 274px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #d8dde3;
  --panel: rgba(224, 228, 233, 0.98);
  --panel-solid: #e7eaee;
  --panel-2: #cfd5dc;
  --panel-3: #c3cad2;
  --line: rgba(30, 41, 59, 0.12);
  --line-strong: rgba(30, 41, 59, 0.21);
  --text: #19222e;
  --muted: #5f6b79;
  --muted-2: #7c8795;
  --accent: #58616d;
  --accent-2: #414a55;
  --accent-soft: rgba(30, 41, 59, 0.065);
  --danger: #d6465a;
  --warning: #9a650f;
  --code-bg: #d1d6dc;
  --code-header: #c4cad2;
  --code-text: #27313d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid rgba(148, 163, 184, .55);
  outline-offset: 2px;
}

.ambient { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(110px); opacity: 0; }
.ambient-one { width: 440px; height: 440px; background: #000000; left: 22%; top: -280px; }
.ambient-two { width: 360px; height: 360px; background: #64748b; right: -200px; bottom: -220px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100dvh; min-height: 0; overflow: hidden; position: relative; z-index: 1; }
.sidebar { height: 100dvh; min-height: 0; overflow: hidden; background: var(--panel-solid); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; backdrop-filter: none; }
.brand { height: 74px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #2f6bff, #1556c8); color: #ffffff; font-size: 17px; font-weight: 900; box-shadow: 0 0 18px rgba(47, 107, 255, .18); }
.brand > div:nth-child(2) { display: grid; gap: 2px; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand span { color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.brand .icon-btn { margin-left: auto; }

.new-chat-btn { margin: 18px 14px 24px; height: 43px; padding: 0 13px; display: flex; align-items: center; gap: 10px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 11px; font-weight: 650; text-align: left; transition: .18s ease; }
.new-chat-btn:hover { border-color: rgba(255, 255, 255, .16); background: var(--accent-soft); }
.new-chat-btn > span { color: var(--accent); font-size: 19px; }
.new-chat-btn kbd { margin-left: auto; padding: 3px 6px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; font-size: 9px; font-family: inherit; }
.sidebar-label { color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: .17em; padding: 0 19px 10px; }
.conversation-list { overflow-y: auto; padding: 0 9px 16px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.conversation-item { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 44px; border-radius: 9px; margin: 2px 0; position: relative; }
.conversation-item.active { background: var(--accent-soft); }
.conversation-item.active::before { content: ""; position: absolute; left: 0; width: 2px; height: 22px; background: var(--accent); border-radius: 3px; }
.conversation-main { min-width: 0; height: 44px; padding: 0 10px; border: 0; background: transparent; color: #b8c2d0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item.active .conversation-main { color: var(--text); font-weight: 650; }
.conversation-menu { opacity: 0; border: 0; color: var(--muted); background: transparent; width: 30px; height: 30px; border-radius: 7px; }
.conversation-item:hover .conversation-menu, .conversation-menu:focus { opacity: 1; }
.conversation-menu:hover { background: var(--panel-3); color: var(--text); }
.sidebar-footer { border-top: 1px solid var(--line); padding: 13px; display: grid; gap: 9px; }
.storage-status { color: var(--muted-2); display: flex; align-items: center; gap: 8px; font-size: 10px; padding: 0 6px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.sidebar-settings { height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; padding: 0 8px; }
.sidebar-settings:hover { color: var(--text); background: var(--panel-2); }

.workspace { min-width: 0; min-height: 0; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: 74px minmax(0, 1fr) auto; }
.topbar { border-bottom: 1px solid var(--line); background: var(--panel-solid); backdrop-filter: none; display: flex; align-items: center; padding: 0 22px; gap: 15px; }
.eyebrow { color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.model-control { min-width: 250px; display: grid; gap: 5px; }
.model-control select { appearance: none; width: max-content; min-width: 220px; padding: 0 27px 0 0; color: var(--text); background: transparent; border: 0; font-size: 14px; font-weight: 700; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 8px) 8px, calc(100% - 3px) 8px; background-size: 5px 5px; background-repeat: no-repeat; }
.model-control select option { background: var(--panel-solid); }
.topbar-spacer { flex: 1; }
.run-status { display: flex; align-items: center; gap: 8px; color: var(--muted); background: rgba(255,255,255,.025); border: 1px solid var(--line); height: 30px; padding: 0 10px; border-radius: 99px; font-size: 9px; letter-spacing: .08em; }
.run-status span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.run-status.working { color: var(--warning); }
.run-status.searching { color: #c4c9d0; }
.run-status.generating { color: #c4c9d0; }
.run-status.ready { color: var(--accent); }
.run-status.working span, .run-status.searching span, .run-status.generating span { animation: pulse 1s infinite; box-shadow: 0 0 10px currentColor; }
.settings-btn, .theme-btn, .icon-btn { color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 9px; height: 34px; padding: 0 11px; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.settings-btn:hover, .theme-btn:hover, .icon-btn:hover { color: var(--text); border-color: var(--line-strong); }

.chat-viewport { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; position: relative; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.empty-state { min-height: 100%; padding: 40px 24px 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-orbit { width: 112px; height: 112px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; display: grid; place-items: center; margin-bottom: 25px; position: relative; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .045); }
.empty-orbit::before { inset: -18px; }
.empty-orbit::after { width: 7px; height: 7px; background: var(--accent); border: 0; top: 1px; right: 15px; box-shadow: 0 0 12px var(--accent); }
.empty-core { width: 54px; height: 54px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(255, 255, 255, .16); border-radius: 17px; background: var(--accent-soft); font-size: 23px; font-weight: 800; }
.empty-state h1 { margin: 8px 0 10px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.empty-state > p:not(.eyebrow) { max-width: 540px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.capability-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 25px; }
.capability-row span { border: 1px solid var(--line); background: rgba(255,255,255,.02); border-radius: 99px; color: var(--muted); padding: 7px 11px; font-size: 11px; }

.message-list { max-width: 920px; margin: 0 auto; padding: 32px 28px 110px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 13px; margin: 0 0 29px; animation: message-in .24s ease-out; }
.message-avatar { grid-column: 1; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: 10px; font-weight: 900; color: #08111d; background: var(--accent); }
.message.user .message-avatar { color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-strong); }
.message-body { grid-column: 2; min-width: 0; }
.message-header { height: 28px; display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.message-header strong { font-size: 12px; }
.message-header time, .message-header .message-model { color: var(--muted-2); font-size: 10px; }
.message-actions { margin-left: auto; display: flex; gap: 5px; opacity: .82; transition: opacity .15s; }
.message:hover .message-actions { opacity: 1; }
.message-action { color: var(--muted); border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 4px 7px; font-size: 10px; font-weight: 650; }
.message-action:hover { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.message-action.speaking { color: var(--accent); background: var(--accent-soft); border-color: rgba(255,255,255,.14); }
.message-content { color: #d6d9e0; font-size: 14px; line-height: 1.72; overflow-wrap: anywhere; }
.message.user .message-content { display: inline-block; max-width: min(720px, 100%); background: var(--panel-2); border: 1px solid var(--line); padding: 11px 14px; border-radius: 4px 13px 13px 13px; white-space: pre-wrap; color: #e1e4ea; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 13px; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 { color: var(--text); line-height: 1.25; margin: 25px 0 10px; letter-spacing: -.02em; }
.message-content h1 { font-size: 24px; } .message-content h2 { font-size: 20px; } .message-content h3 { font-size: 17px; }
.message-content ul, .message-content ol { padding-left: 23px; margin: 10px 0 15px; }
.message-content li { margin: 4px 0; }
.message-content blockquote { margin: 15px 0; padding: 8px 14px; border-left: 2px solid var(--accent); background: var(--accent-soft); color: #b7c3d3; }
.message-content a { color: var(--accent); text-decoration: none; }
.message-content a:hover { text-decoration: underline; }
.message-content code:not(pre code) { color: #c5cbd3; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.10); padding: 2px 5px; border-radius: 5px; font-size: .9em; }
.table-scroll { overflow-x: auto; margin: 15px 0; border: 1px solid var(--line); border-radius: 9px; }
.message-content table { width: 100%; border-collapse: collapse; min-width: 460px; }
.message-content th, .message-content td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.message-content th { color: var(--text); background: var(--panel-2); font-size: 11px; }
.message-content tr:last-child td { border-bottom: 0; }
.code-frame { border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin: 15px 0; background: var(--code-bg); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.code-header { height: 34px; padding: 0 10px 0 13px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: var(--code-header); color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.code-copy { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 9px; font-weight: 700; }
.code-copy:hover { color: var(--accent); }
.code-frame pre { margin: 0; overflow-x: auto; background: var(--code-bg); }
.code-frame pre code, .code-frame .hljs { padding: 15px !important; font-size: 12px; line-height: 1.65; color: var(--code-text) !important; background: transparent !important; }
html[data-theme="light"] .code-frame .hljs-comment,
html[data-theme="light"] .code-frame .hljs-quote { color: #64748b; }
html[data-theme="light"] .code-frame .hljs-keyword,
html[data-theme="light"] .code-frame .hljs-selector-tag,
html[data-theme="light"] .code-frame .hljs-built_in,
html[data-theme="light"] .code-frame .hljs-type { color: #46515e; }
html[data-theme="light"] .code-frame .hljs-string,
html[data-theme="light"] .code-frame .hljs-attribute,
html[data-theme="light"] .code-frame .hljs-symbol { color: #475569; }
html[data-theme="light"] .code-frame .hljs-number,
html[data-theme="light"] .code-frame .hljs-literal,
html[data-theme="light"] .code-frame .hljs-variable { color: #5a6572; }
html[data-theme="light"] .code-frame .hljs-title,
html[data-theme="light"] .code-frame .hljs-section { color: #334155; font-weight: 700; }
.message-content img { display: block; width: auto; height: auto; max-width: min(420px, 100%); max-height: 320px; object-fit: contain; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.message-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.message-file { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.02); border-radius: 8px; padding: 7px 9px; color: var(--muted); font-size: 10px; text-decoration: none; }
.message-file img { width: 42px; height: 42px; object-fit: cover; border-radius: 5px; }
.message-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 260px)); justify-content: start; align-items: start; gap: 10px; margin-top: 13px; }
.message-gallery a { display: block; width: 100%; max-width: 260px; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.message-gallery img { width: 100%; height: 168px; object-fit: cover; display: block; background: var(--panel-3); }
.gallery-card { position: relative; min-height: 0; }
.gallery-card.image-failed { display: none !important; }
.gallery-fallback { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.gallery-card { position: relative; color: var(--text); text-decoration: none; }
.gallery-badge { position: absolute; top: 7px; left: 7px; padding: 3px 6px; border-radius: 999px; background: rgba(8, 15, 27, .78); border: 1px solid rgba(148, 163, 184, .24); color: #dbeafe; font-size: 8px; font-weight: 850; letter-spacing: .08em; backdrop-filter: blur(8px); }
.gallery-caption { display: block; padding: 7px 9px 9px; color: var(--muted); font-size: 9px; line-height: 1.35; max-height: 3.9em; overflow: hidden; }
.sources { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 10px; }
.sources summary { color: var(--muted); cursor: pointer; font-size: 11px; }
.source-list { display: grid; gap: 6px; margin-top: 9px; }
.source-list a { color: #9aa5b5; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; font-size: 10px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-list a:hover { color: var(--accent); border-color: rgba(255,255,255,.15); }
.message-status { color: var(--danger); font-size: 11px; margin-top: 8px; }
.thinking-caret { display: inline-block; width: 7px; height: 15px; background: var(--accent); vertical-align: -2px; animation: blink .9s infinite; }
.continue-btn { margin-top: 11px; border: 1px solid rgba(247,191,107,.28); color: var(--warning); background: rgba(247,191,107,.06); border-radius: 8px; padding: 8px 11px; font-size: 10px; font-weight: 800; letter-spacing: .05em; }

.composer-zone { position: relative; max-width: 920px; width: calc(100% - 56px); margin: 0 auto; padding: 0 0 10px; }
.composer-card { position: relative; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(20, 24, 33, .94); box-shadow: 0 20px 60px rgba(0,0,0,.28); overflow: hidden; transition: border-color .15s; }
.composer-card:focus-within { border-color: rgba(255,255,255,.18); }
.composer-card textarea { display: block; width: 100%; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); padding: 16px 17px 9px; line-height: 1.55; }
.composer-card textarea::placeholder { color: #738096; }
.composer-actions { min-height: 45px; padding: 5px 7px 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 7px; }
.tool-btn { width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; font-size: 17px; }
.mic-btn { width: auto; min-width: 54px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.mic-btn .mic-icon { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mic-btn:hover { color: var(--text); background: var(--panel-2); }
.mic-btn.recording { color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset; }
.mic-btn.unsupported, .mic-btn:disabled { opacity: .42; cursor: not-allowed; }
.tool-btn:hover { color: var(--text); background: var(--panel-3); }
.tool-btn.recording { color: var(--accent); animation: pulse 1s infinite; }
.internet-control { display: flex; align-items: center; gap: 4px; height: 29px; border-left: 1px solid var(--line); padding-left: 10px; margin-left: 2px; color: var(--muted-2); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.internet-control select { color: var(--accent); border: 0; background: transparent; font-size: 9px; font-weight: 800; }
.internet-control option { background: var(--panel-solid); color: var(--text); }
.send-hint { color: var(--muted-2); font-size: 9px; }
.send-btn, .stop-btn { height: 32px; border-radius: 8px; font-size: 9px; font-weight: 900; letter-spacing: .07em; }
.send-btn { min-width: 84px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); }
.send-btn:hover { background: var(--panel-3); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }
.send-btn span { margin-left: 5px; font-size: 14px; }
.stop-btn { border: 1px solid rgba(255,107,122,.25); background: rgba(255,107,122,.07); color: var(--danger); padding: 0 11px; }
.stop-btn span { display: inline-block; width: 6px; height: 6px; background: var(--danger); margin-right: 5px; }
.composer-note { color: var(--muted-2); font-size: 9px; text-align: center; margin: 7px 0 0; }
.attachment-tray { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 8px; }
.attachment-pill { min-width: 150px; max-width: 230px; display: grid; grid-template-columns: 34px 1fr 24px; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 6px; }
.attachment-pill img, .attachment-icon { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--panel-3); display: grid; place-items: center; color: var(--accent); font-size: 10px; }
.attachment-info { min-width: 0; display: grid; gap: 2px; }
.attachment-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.attachment-info span { color: var(--muted-2); font-size: 9px; }
.attachment-remove { width: 24px; height: 24px; border: 0; color: var(--muted); background: transparent; border-radius: 6px; }
.attachment-remove:hover { color: var(--danger); background: rgba(255,107,122,.07); }
.attachment-pill.uploading { opacity: .6; }
.drop-overlay { position: absolute; z-index: 5; inset: -12px; border: 1px dashed var(--line-strong); background: rgba(5, 5, 5, .98); color: var(--accent); border-radius: 16px; display: grid; place-items: center; font-size: 13px; font-weight: 800; pointer-events: none; }
.drop-overlay[hidden] { display: none !important; }

.settings-dialog { width: min(920px, calc(100vw - 28px)); height: min(890px, calc(100dvh - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: #050505; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.65); }
.settings-dialog::backdrop { background: rgba(5, 10, 18, .74); backdrop-filter: blur(8px); }
.settings-dialog form { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.dialog-header { padding: 20px 23px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; }
.dialog-header h2 { font-size: 23px; margin: 4px 0 4px; letter-spacing: -.03em; }
.dialog-header p { color: var(--muted); margin: 0; font-size: 11px; }
.dialog-close { margin-left: auto; width: 34px; height: 34px; border: 1px solid var(--line); color: var(--muted); background: transparent; border-radius: 8px; font-size: 20px; }
.settings-content { overflow-y: auto; padding: 0 23px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.settings-section { padding: 23px 0 26px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-number { color: var(--accent); font-family: ui-monospace, monospace; font-size: 9px; }
.section-heading h3 { font-size: 14px; margin: 0; }
.section-copy { color: var(--muted); font-size: 11px; margin: -4px 0 14px; }
.form-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings-section label { display: grid; gap: 6px; color: #9aa8bb; font-size: 10px; font-weight: 650; }
.settings-section label small { color: var(--muted-2); font-weight: 400; }
.settings-section input, .settings-section textarea, .settings-section select { width: 100%; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-2); padding: 9px 10px; outline: 0; }
.settings-section input:focus, .settings-section textarea:focus, .settings-section select:focus { border-color: rgba(255,255,255,.18); }
.settings-section textarea { resize: vertical; line-height: 1.45; font-family: inherit; }
.model-table-header, .model-row { display: grid; grid-template-columns: 48px 1fr 155px 1.5fr 34px; gap: 8px; align-items: center; }
.model-table-header { color: var(--muted-2); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; padding: 0 7px 6px; }
.model-row { border: 1px solid var(--line); background: rgba(255,255,255,.018); padding: 7px; border-radius: 9px; margin-bottom: 7px; }
.model-row input, .model-row select { padding: 8px 9px; }
.model-row .active-radio { width: auto; justify-self: center; accent-color: var(--accent); }
.remove-model { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.remove-model:hover { color: var(--danger); background: rgba(255,107,122,.08); }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; padding: 10px 0; }
.switch-row > span { display: grid; gap: 3px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { width: 38px; height: 21px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-strong); position: relative; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch-row input:checked + i { background: var(--accent-soft); border-color: rgba(255,255,255,.20); }
.switch-row input:checked + i::after { transform: translateX(17px); background: var(--accent); }
.dialog-footer { min-height: 70px; padding: 13px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 9px; background: #0c131d; }
.settings-feedback { margin-right: auto; color: var(--muted); font-size: 10px; }
.settings-feedback.success { color: var(--accent); } .settings-feedback.error { color: var(--danger); }
.primary-btn, .secondary-btn { min-height: 34px; border-radius: 8px; padding: 0 12px; font-size: 9px; font-weight: 850; letter-spacing: .05em; }
.primary-btn { background: var(--accent); color: #07111f; border: 0; }
.secondary-btn { color: var(--muted); border: 1px solid var(--line-strong); background: transparent; }
.secondary-btn:hover { color: var(--text); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 30px)); background: #172130; color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; box-shadow: 0 15px 50px rgba(0,0,0,.45); font-size: 11px; }
.mobile-only { display: none; }

html[data-theme="light"] .sidebar { background: #e2e6eb; }
html[data-theme="light"] .topbar { background: #e2e6eb; }
html[data-theme="light"] .conversation-main { color: #526176; }
html[data-theme="light"] .run-status,
html[data-theme="light"] .settings-btn,
html[data-theme="light"] .theme-btn,
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .capability-row span,
html[data-theme="light"] .message-file { background: rgba(51, 65, 85, .035); }
html[data-theme="light"] .message-avatar,
html[data-theme="light"] .send-btn,
html[data-theme="light"] .primary-btn { color: #ffffff; }
html[data-theme="light"] .message-content { color: #334155; }
html[data-theme="light"] .message.user .message-content { color: #1e293b; }
html[data-theme="light"] .message-content blockquote { color: #526176; }
html[data-theme="light"] .message-content code:not(pre code) { color: #46515e; background: rgba(30,41,59,.055); border-color: rgba(30,41,59,.12); }
html[data-theme="light"] .source-list a { color: #5b6b80; }
html[data-theme="light"] .composer-card { background: #e6eaee; box-shadow: 0 18px 50px rgba(51, 65, 85, .09); }
html[data-theme="light"] .composer-card textarea::placeholder { color: #8794a8; }
html[data-theme="light"] .send-btn:hover { background: var(--accent-2); }
html[data-theme="light"] .drop-overlay { background: rgba(220, 225, 231, .98); }
html[data-theme="light"] .settings-dialog { background: #e4e8ed; box-shadow: 0 30px 90px rgba(51, 65, 85, .20); }
html[data-theme="light"] .settings-section label { color: #526176; }
html[data-theme="light"] .model-row { background: rgba(51, 65, 85, .025); }
html[data-theme="light"] .dialog-footer { background: #d3d9e0; }
html[data-theme="light"] .toast { background: #e4e8ed; box-shadow: 0 15px 50px rgba(51, 65, 85, .16); }

@keyframes pulse { 50% { opacity: .3; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 800px) {
  :root { --sidebar: min(86vw, 310px); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 20px 0 70px rgba(0,0,0,.45); background: var(--panel-solid) !important; opacity: 1 !important; backdrop-filter: none !important; }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(0,0,0,.58); }
  .mobile-only { display: inline-grid; place-items: center; }
  .desktop-only, .send-hint { display: none; }
  .workspace { grid-template-rows: 62px minmax(0, 1fr) auto; }
  .topbar { height: 62px; padding: 0 11px; gap: 9px; }
  .model-control { min-width: 0; flex: 1; }
  .model-control select { min-width: 0; max-width: 48vw; font-size: 12px; }
  .topbar-spacer { display: none; }
  .run-status { max-width: 94px; overflow: hidden; }
  .run-status b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .message-list { padding: 24px 14px 90px; }
  .message { grid-template-columns: 28px minmax(0,1fr); gap: 9px; }
  .message-avatar { width: 27px; height: 27px; }
  .message-content { font-size: 13px; }
  .composer-zone { width: calc(100% - 20px); padding-bottom: 6px; }
  .composer-note { display: none; }
  .composer-actions { align-items: flex-end; }
  .internet-control span { display: none; }
  .send-btn { min-width: 72px; }
  .mic-btn { min-width: 30px; width: 30px; padding: 0; }
  .message-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .message-gallery a { max-width: none; }
  .message-gallery img { height: 150px; }
  .message-content img { max-width: 100%; max-height: 280px; }
  .settings-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .dialog-header, .settings-content, .dialog-footer { padding-left: 14px; padding-right: 14px; }
  .form-grid.two, .form-grid.four { grid-template-columns: 1fr; }
  .model-table-header { display: none; }
  .model-row { grid-template-columns: 35px 1fr 31px; }
  .model-row input:nth-of-type(1), .model-row select, .model-row input:nth-of-type(2) { grid-column: 2; }
  .model-row .active-radio { grid-column: 1; grid-row: 1; }
  .remove-model { grid-column: 3; grid-row: 1; }
  .dialog-footer { flex-wrap: wrap; }
  .settings-feedback { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
