:root {
  --bg: #0b0d12;
  --surface: #11141c;
  --surface-2: #171b25;
  --surface-3: #1d2230;
  --text: #f1f3f7;
  --text-muted: #969eaf;
  --text-faint: #626b7c;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --accent: #7b6cff;
  --accent-2: #9b75ff;
  --green: #39d98a;
  --shadow: 0 18px 60px rgba(0, 0, 0, .35);
}

body[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e8ebf2;
  --text: #171a22;
  --text-muted: #697184;
  --text-faint: #9ca4b3;
  --border: rgba(20, 28, 45, .09);
  --border-strong: rgba(20, 28, 45, .16);
  --shadow: 0 18px 60px rgba(39, 49, 79, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, .search-box { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; background: var(--bg); }
.sidebar { width: 276px; flex: 0 0 276px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 100vh; transition: transform .24s ease, width .24s ease; }
.sidebar-top { padding: 22px 16px 14px; }
.brand-row, .topbar, .topbar-left, .topbar-actions, .workspace-title, .account-card, .composer-toolbar, .composer-tools, .composer-actions, .section-label, .setting-row, .modal-header { display: flex; align-items: center; }
.brand-row { gap: 11px; padding: 0 6px 22px; }
.brand-mark, .mini-logo, .project-logo, .welcome-mark { display: grid; place-items: center; font-weight: 800; letter-spacing: -.07em; }
.brand-mark { width: 31px; height: 31px; border-radius: 10px; color: white; font-size: 11px; background: linear-gradient(135deg, #786bff, #c071ff); box-shadow: 0 5px 20px rgba(123,108,255,.34); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.08; flex: 1; }
.brand-copy strong { font-size: 14px; letter-spacing: -.01em; }
.brand-copy span { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.icon-btn { border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-muted); border-radius: 9px; transition: background .16s, color .16s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.sidebar-close { display: none; font-size: 24px; width: 28px; height: 28px; }
.new-chat-btn { border: 1px solid var(--border-strong); background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-radius: 10px; height: 42px; width: 100%; display: flex; align-items: center; gap: 10px; padding: 0 12px; cursor: pointer; font-size: 13px; font-weight: 650; transition: border .16s, transform .16s, background .16s; }
.new-chat-btn:hover { border-color: rgba(123,108,255,.45); background: var(--surface-3); transform: translateY(-1px); }
.plus-icon { font-size: 21px; line-height: 1; font-weight: 350; color: var(--text-muted); }
kbd { font-size: 10px; color: var(--text-faint); background: var(--surface-3); border: 1px solid var(--border); padding: 2px 5px; border-radius: 5px; margin-left: auto; }
.search-box { height: 36px; margin-top: 12px; border: 1px solid transparent; background: var(--surface-2); border-radius: 9px; display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--text-muted); }
.search-box:focus-within { border-color: rgba(123,108,255,.5); }
.search-box svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.search-box input::placeholder { color: var(--text-faint); }
.search-box kbd { background: transparent; border: 0; padding: 0; }
.sidebar-nav { display: grid; gap: 3px; padding: 10px 10px 18px; }
.nav-item { border: 0; background: transparent; border-radius: 8px; height: 36px; color: var(--text-muted); display: flex; align-items: center; gap: 11px; padding: 0 11px; cursor: pointer; font-size: 12px; text-align: left; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--surface-2); }
.nav-item.active { box-shadow: inset 2px 0 var(--accent); }
.nav-item em { font-style: normal; margin-left: auto; color: var(--text-faint); font-size: 11px; }
.nav-icon { width: 18px; text-align: center; font-size: 17px; color: currentColor; }
.project-section, .history-section { padding: 0 16px; }
.section-label { color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; height: 30px; }
.tiny-btn { background: transparent; border: 0; color: var(--text-muted); cursor: pointer; font-size: 17px; margin-left: auto; padding: 2px 4px; }
.project-card { width: 100%; border: 1px solid rgba(123,108,255,.28); background: linear-gradient(110deg, rgba(123,108,255,.17), rgba(123,108,255,.04)); border-radius: 10px; padding: 9px 9px; display: flex; align-items: center; gap: 9px; cursor: pointer; text-align: left; }
.project-logo { width: 26px; height: 26px; background: rgba(123,108,255,.22); border-radius: 7px; font-size: 9px; color: #b7adff; letter-spacing: -.05em; }
.project-meta { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.project-meta strong { font-size: 12px; font-weight: 650; }
.project-meta small { color: var(--text-muted); font-size: 10px; }
.project-more { color: var(--text-faint); font-size: 11px; letter-spacing: 1px; }
.history-section { padding-top: 18px; flex: 1; overflow: auto; }
.history-group { display: grid; gap: 2px; margin-bottom: 16px; }
.history-date { color: var(--text-faint); font-size: 10px; padding: 0 5px 6px; }
.history-item { position: relative; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; color: var(--text-muted); border-radius: 7px; padding: 8px 5px; min-width: 0; text-align: left; cursor: pointer; font-size: 11px; }
.history-item:hover { background: var(--surface-2); color: var(--text); }
.history-item > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-faint); flex: 0 0 auto; }
.history-star { opacity: 0; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; margin-left: auto; font-size: 15px; line-height: 1; padding: 0; }
.history-item:hover .history-star { opacity: 1; }
.history-star.starred { opacity: 1; color: #f1bb64; }
.muted-history { opacity: .72; }
.sidebar-bottom { border-top: 1px solid var(--border); padding: 12px; }
.account-card { border: 0; background: transparent; width: 100%; text-align: left; gap: 9px; padding: 7px; cursor: pointer; border-radius: 8px; }
.account-card:hover { background: var(--surface-2); }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; background: linear-gradient(145deg, #3f8fff, #795cf4); }
.account-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.account-card strong { font-size: 12px; }
.account-card small { color: var(--text-muted); font-size: 10px; }
.chevron { color: var(--text-faint); }
.settings-link { width: 100%; border: 0; background: transparent; color: var(--text-muted); display: flex; gap: 11px; align-items: center; text-align: left; cursor: pointer; font-size: 12px; padding: 9px 7px 4px; border-radius: 8px; }
.settings-link:hover { background: var(--surface-2); color: var(--text); }

.main-panel { flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.topbar { justify-content: space-between; height: 64px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.topbar-left, .topbar-actions { gap: 14px; }
.menu-btn { display: none; width: 30px; height: 30px; gap: 3px; }
.menu-btn span { width: 16px; height: 1.5px; background: currentColor; display: block; }
.workspace-title { gap: 9px; }
.mini-logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #786bff, #c071ff); color: white; font-size: 9px; }
.workspace-title > div { display: flex; flex-direction: column; gap: 3px; }
.workspace-title strong { font-size: 13px; letter-spacing: -.01em; }
.workspace-title small { color: var(--text-muted); font-size: 10px; }
.connection-status { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 99px; padding: 6px 10px; color: var(--text-muted); font-size: 10px; }
.status-pulse, .connector-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(57,217,138,.11); }
.theme-toggle { width: 31px; height: 31px; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.theme-toggle .moon-icon { display: none; fill: currentColor; stroke: none; }
body[data-theme="light"] .sun-icon { display: none; }
body[data-theme="light"] .moon-icon { display: block; }
.top-more { width: 31px; height: 31px; letter-spacing: 2px; }
.chat-stage { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; }
.welcome-view { max-width: 860px; margin: auto; width: min(90%, 860px); padding: 40px 0 220px; text-align: center; }
.welcome-mark { position: relative; width: 68px; height: 68px; margin: 0 auto 20px; border-radius: 22px; color: #fff; font-size: 20px; background: linear-gradient(145deg, #7569ff, #a771ff); box-shadow: 0 16px 40px rgba(123,108,255,.26); }
.welcome-mark i { position: absolute; right: -3px; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: #46df9a; border: 3px solid var(--bg); }
.eyebrow { margin: 0; color: var(--text-muted); font-size: 12px; letter-spacing: .01em; }
.welcome-view h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.05em; margin: 10px 0 11px; font-weight: 700; }
.welcome-subtitle { margin: 0; color: var(--text-muted); font-size: 13px; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 700px; margin: 38px auto 0; text-align: left; }
.suggestion-card { min-height: 70px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; display: flex; align-items: center; gap: 11px; padding: 13px; cursor: pointer; transition: border .16s, background .16s, transform .16s; }
.suggestion-card:hover { border-color: rgba(123,108,255,.42); background: var(--surface-2); transform: translateY(-2px); }
.suggestion-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.suggestion-card strong { font-size: 12px; font-weight: 650; }
.suggestion-card small { color: var(--text-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-icon { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; flex: 0 0 auto; }
.suggestion-icon.purple { color: #b9adff; background: rgba(123,108,255,.17); }
.suggestion-icon.blue { color: #83c5ff; background: rgba(66,146,255,.15); }
.suggestion-icon.amber { color: #ffd27c; background: rgba(242,174,59,.15); }
.suggestion-icon.green { color: #6de3ac; background: rgba(57,217,138,.14); }
.arrow { margin-left: auto; color: var(--text-faint); font-size: 15px; }
.composer-wrap { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: min(90%, 780px); }
.composer { border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); border-radius: 16px; padding: 15px 13px 11px; box-shadow: var(--shadow); transition: border .18s, box-shadow .18s; }
.composer:focus-within { border-color: rgba(123,108,255,.55); box-shadow: 0 20px 65px rgba(0,0,0,.34), 0 0 0 3px rgba(123,108,255,.08); }
.composer textarea { width: 100%; max-height: 145px; border: 0; outline: 0; background: transparent; color: var(--text); resize: none; line-height: 1.5; font-size: 14px; padding: 0 2px; min-height: 25px; }
.composer textarea::placeholder { color: var(--text-faint); }
.composer-toolbar { justify-content: space-between; padding-top: 12px; }
.composer-tools, .composer-actions { gap: 9px; }
.round-tool, .send-btn, .voice-btn { border: 0; cursor: pointer; display: grid; place-items: center; }
.round-tool { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); font-size: 21px; font-weight: 300; }
.round-tool:hover, .tool-label:hover, .model-select:hover, .voice-btn:hover { color: var(--text); background: var(--surface-3); }
.tool-label, .model-select { border: 0; background: transparent; color: var(--text-muted); border-radius: 7px; cursor: pointer; height: 29px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11px; }
.tool-spark { color: var(--accent-2); }
.down-caret { color: var(--text-faint); font-size: 13px; }
.model-select { border: 1px solid var(--border); padding: 0 8px; color: var(--text); }
.model-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.chatgpt-dot { background: #76d7bb; box-shadow: 0 0 0 3px rgba(118,215,187,.12); }
.gemini-dot { display: grid; place-items: center; color: #79aaff; background: linear-gradient(135deg, #4285f4, #b86cff); font-size: 8px; }
.auto-dot { background: linear-gradient(135deg, #a78bfa, #67e8f9); }
.voice-btn { width: 28px; height: 28px; background: transparent; color: var(--text-muted); border-radius: 8px; }
.voice-btn svg, .send-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.send-btn { width: 30px; height: 30px; border-radius: 9px; color: #fff; background: var(--accent); box-shadow: 0 5px 15px rgba(123,108,255,.28); }
.send-btn:hover { background: #8b7cff; transform: translateY(-1px); }
.composer-note { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--text-faint); font-size: 10px; margin: 11px 0 0; }
.connector-dot { width: 5px; height: 5px; box-shadow: none; }
.model-menu { position: absolute; right: max(5%, calc((100% - 780px) / 2)); bottom: 102px; width: 218px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 5px; box-shadow: var(--shadow); z-index: 5; }
.model-menu-label { padding: 7px 8px 6px; color: var(--text-faint); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.model-divider { height: 1px; background: var(--border); margin: 4px 5px; }
.model-option { border: 0; background: transparent; border-radius: 8px; width: 100%; display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px 8px; cursor: pointer; }
.model-option:hover, .model-option.selected { background: var(--surface-2); }
.model-option > span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.model-option strong { font-size: 11px; font-weight: 650; }
.model-option strong b { color: var(--text-muted); font-weight: 500; }
.model-option small { font-size: 9px; color: var(--text-muted); }
.model-option .check { opacity: 0; color: var(--accent-2); }
.model-option.selected .check { opacity: 1; }
.hidden { display: none !important; }

.conversation-view { flex: 1; overflow: auto; padding: 40px 20px 190px; }
.conversation-inner { width: min(100%, 760px); margin: 0 auto; display: grid; gap: 28px; }
.message-row { display: flex; gap: 12px; align-items: flex-start; animation: rise .2s ease both; }
.message-row.user { justify-content: flex-end; }
.message-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; font-size: 9px; font-weight: 800; }
.message-avatar.ai { background: linear-gradient(145deg, #7569ff, #a771ff); color: #fff; }
.message-avatar.user { background: linear-gradient(145deg, #3f8fff, #795cf4); color: #fff; }
.message-content { max-width: min(680px, 78%); }
.message-row.user .message-content { background: var(--surface-2); border: 1px solid var(--border); padding: 11px 14px; border-radius: 14px 4px 14px 14px; }
.message-content p { margin: 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.message-meta { color: var(--text-faint); font-size: 10px; margin-top: 7px; }
.typing { display: inline-flex; gap: 4px; padding: 11px 0; }
.typing i { width: 5px; height: 5px; background: var(--text-muted); border-radius: 50%; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(3,5,9,.62); display: grid; place-items: center; z-index: 10; backdrop-filter: blur(5px); }
.settings-modal { width: min(92%, 470px); border: 1px solid var(--border-strong); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; }
.modal-header { justify-content: space-between; align-items: flex-start; }
.modal-header h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.04em; }
.modal-header .icon-btn { width: 30px; height: 30px; font-size: 22px; }
.settings-list { margin-top: 26px; display: grid; gap: 4px; }
.setting-row { justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); padding: 15px 0; }
.setting-row > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.setting-row strong { font-size: 12px; }.setting-row small { color: var(--text-muted); font-size: 10px; }
.select-chip, .setting-status { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); border-radius: 8px; padding: 7px 9px; font-size: 10px; white-space: nowrap; }
.setting-status { border: 0; background: transparent; color: var(--green); display: flex; align-items: center; gap: 5px; }.setting-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.switch { width: 35px; height: 20px; border-radius: 99px; padding: 2px; border: 0; background: var(--surface-3); cursor: pointer; }.switch i { width: 16px; height: 16px; display: block; border-radius: 50%; background: var(--text-muted); transition: transform .2s; }.switch.on { background: var(--accent); }.switch.on i { transform: translateX(15px); background: #fff; }
.settings-footnote { border-top: 1px solid var(--border); padding-top: 15px; color: var(--text-faint); font-size: 10px; line-height: 1.6; margin: 5px 0 0; }
.toast { position: fixed; right: 23px; bottom: 23px; z-index: 20; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); padding: 10px 13px; border-radius: 9px; box-shadow: var(--shadow); font-size: 11px; }

@media (max-width: 800px) {
  .sidebar { position: fixed; z-index: 8; left: 0; top: 0; bottom: 0; transform: translateX(-102%); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 15px; }
  .connection-status { display: none; }
  .welcome-view { padding-bottom: 220px; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .composer-wrap { width: calc(100% - 24px); bottom: 15px; }
  .conversation-view { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 460px) {
  .welcome-view h1 { font-size: 30px; }
  .workspace-title small { display: none; }
  .top-more { display: none; }
  .composer { padding: 12px 10px 9px; }
  .tool-label { display: none; }
  .model-select { max-width: 100px; }
}
