/* ══════════════════════════════════════════════════════
   SYNTARA v2.1 — Neumorphism × Liquid Glass
   Brand: ConnectOWL (#ED6A00 / #0C5C91)
   ══════════════════════════════════════════════════════ */

:root {
  --accent: #ED6A00;
  --accent-glow: #FF8A2E;
  --accent-dim: #C45800;
  --secondary: #0C5C91;
  --secondary-glow: #1A7BBF;
  --secondary-dim: #083D61;
  --orange: #ED6A00;
  --green: #34D399;
  --red: #F87171;
  --yellow: #FBBF24;
  --purple: #A78BFA;

  --bg-deep: #111318;
  --bg-primary: #171A21;
  --bg-secondary: #1C2029;
  --bg-tertiary: #222731;
  --bg-hover: #282E3A;
  --bg-glass: rgba(23, 26, 33, 0.6);

  --border: rgba(255,255,255,0.06);
  --border-active: rgba(255,255,255,0.1);
  --glass-border: rgba(255,255,255,0.07);
  --glass-highlight: rgba(255,255,255,0.04);
  --neu-dark: rgba(0,0,0,0.4);
  --neu-light: rgba(255,255,255,0.03);

  --text-primary: #E4E8F0;
  --text-secondary: rgba(228,232,240,0.55);
  --text-muted: rgba(228,232,240,0.3);
  --code-bg: #0D0F14;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Light Mode: Broken White / Warm Cream ─────── */
[data-theme="light"] {
  --bg-deep: #F0EDE8;
  --bg-primary: #F7F5F0;
  --bg-secondary: #FDFCF9;
  --bg-tertiary: #EAE7E1;
  --bg-hover: #E2DFD9;
  --bg-glass: rgba(247,245,240,0.7);
  --border: rgba(60,50,40,0.08);
  --border-active: rgba(60,50,40,0.14);
  --glass-border: rgba(60,50,40,0.07);
  --glass-highlight: rgba(255,255,255,0.5);
  --neu-dark: rgba(60,50,40,0.08);
  --neu-light: rgba(255,255,255,0.6);
  --text-primary: #2C2418;
  --text-secondary: rgba(44,36,24,0.55);
  --text-muted: rgba(44,36,24,0.3);
  --code-bg: #EDE9E3;
  --green: #22C55E;
  --red: #EF4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

/* Icon Base */
.i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; }
.i svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.i-sm { width: 14px; height: 14px; }
.i-sm svg { stroke-width: 2; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }


::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); }

.app { display: none; height: 100vh; background: var(--bg-deep); }
.app.visible { display: flex; }

.sidebar { width: 260px; min-width: 260px; height: 100vh; display: flex; flex-direction: column; background: var(--bg-primary); border-right: 1px solid var(--border); overflow: hidden; }
.sidebar-header { padding: 16px 14px 12px; border-bottom: 1px solid var(--border); }
.logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.logo-img { width: 34px; height: 34px; border-radius: 9px; }
.logo { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; color: var(--accent); line-height: 1.1; }
.logo-sub { font-size: 9px; font-weight: 600; color: var(--secondary); letter-spacing: 1.2px; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; margin-left: auto; background: var(--text-muted); transition: all 0.3s; }
.status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.status-dot.offline { background: var(--red); }

.model-selector { width: 100%; padding: 8px 10px; font-size: 11px; font-family: 'Fira Code', monospace; font-weight: 500; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-sm); outline: none; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23556072' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; transition: border-color 0.2s; }
.model-selector:hover { border-color: var(--border-active); }
.model-selector:focus { border-color: var(--accent); }
.model-selector optgroup { background: var(--bg-secondary); color: var(--text-primary); font-weight: 600; }
.model-selector option { background: var(--bg-secondary); color: var(--text-primary); }

.section-title { display: flex; align-items: center; gap: 6px; padding: 10px 14px 6px; font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }
.section-title .btn-icon { margin-left: auto; }

.btn-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: transparent; color: var(--text-secondary); font-size: 14px; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border-active); color: var(--text-primary); }

.landing-back-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 9px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
.landing-back-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

.project-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.project-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin: 2px 0; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; transition: all 0.2s; }
.project-item:hover { background: var(--bg-secondary); }
.project-item.active { background: var(--bg-tertiary); border-color: var(--border-active); }
.project-item.active .project-name { color: var(--text-primary); }
.project-name { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-name .folder-icon { color: var(--accent); font-size: 14px; }
.project-desc { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sys-monitor { padding: 10px 14px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sys-title { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.sys-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sys-label { font-size: 9px; font-weight: 600; font-family: 'Fira Code', monospace; color: var(--text-muted); width: 32px; flex-shrink: 0; }
.sys-bar-wrap { flex: 1; height: 5px; background: var(--bg-secondary); border-radius: 3px; overflow: hidden; box-shadow: inset 1px 1px 3px var(--neu-dark); }
.sys-bar { height: 100%; border-radius: 3px; transition: width 0.6s var(--ease); background: var(--accent); }
.sys-bar.bar-ram { background: var(--secondary-glow); }
.sys-bar.bar-gpu { background: var(--green); }
.sys-bar.bar-swap { background: var(--purple); }
.sys-bar.bar-disk { background: var(--yellow); }
.sys-val { font-size: 9px; font-family: 'Fira Code', monospace; font-weight: 500; color: var(--text-secondary); width: 72px; min-width: 72px; text-align: right; flex-shrink: 0; }
.sys-detail-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.sys-detail { font-size: 9.5px; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.sys-temp-breakdown { font-size: 9px; color: var(--text-muted); font-family: 'Fira Code', monospace; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-deep); position: relative; }
.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; text-align: center; padding: 40px; opacity: 0.7; }
.welcome h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.welcome p { color: var(--text-secondary); font-size: 13px; line-height: 1.7; }
.welcome code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-family: 'Fira Code', monospace; font-size: 11px; }

.chat-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--bg-primary); min-height: 42px; flex-shrink: 0; }
.chat-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.chat-tab { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; border: 1px solid transparent; font-size: 11.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.chat-tab:hover { background: var(--bg-secondary); }
.chat-tab.active { background: var(--bg-tertiary); border-color: var(--border-active); color: var(--text-primary); }
.chat-tab .pin-icon { color: var(--accent); }
.chat-tab .close-tab { opacity: 0.3; font-size: 10px; cursor: pointer; }
.chat-tab .close-tab:hover { opacity: 1; color: var(--red); }
.chat-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* ctx-badge removed */
/* context-control removed */
/* context-control removed */
/* context-control removed */

.file-bar { padding: 6px 14px; border-bottom: 1px solid var(--border); background: var(--bg-primary); display: none; }
.file-bar-inner { display: flex; gap: 6px; overflow-x: auto; }
.file-tag { display: flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 10px; font-weight: 500; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; white-space: nowrap; }
.file-tag .remove-file { cursor: pointer; opacity: 0.4; }
.file-tag .remove-file:hover { opacity: 1; color: var(--red); }

.search-bar { display: none; padding: 6px 14px; border-bottom: 1px solid var(--border); background: var(--bg-primary); gap: 8px; align-items: center; }
.search-bar input { flex: 1; padding: 6px 10px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-family: inherit; font-size: 12px; outline: none; }
.search-bar input:focus { border-color: var(--accent); }
.search-highlight { background: rgba(237,106,0,0.2); border-radius: 2px; }

.messages-container { flex: 1; overflow-y: auto; padding: 16px 20px; scroll-behavior: smooth; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; opacity: 0.5; }
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 12px; color: var(--text-secondary); line-height: 1.7; }

.message { margin-bottom: 16px; display: flex; flex-direction: column; animation: msgIn 0.3s var(--ease) both; }
@keyframes msgIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.msg-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.msg-role { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.msg-role.user { color: var(--accent); }
.msg-role.assistant { color: var(--secondary-glow); }
.msg-time { font-size: 9px; color: var(--text-muted); font-family: 'Fira Code', monospace; }
.msg-model { font-size: 9px; color: var(--text-muted); font-family: 'Fira Code', monospace; background: var(--bg-secondary); padding: 1px 5px; border-radius: 4px; }

.msg-body { padding: 12px 16px; border-radius: var(--r-md); line-height: 1.7; font-size: 13px; }
.message.user .msg-body { background: linear-gradient(135deg, rgba(237,106,0,0.1), rgba(237,106,0,0.04)); border: 1px solid rgba(237,106,0,0.12); border-bottom-right-radius: 4px; }
.message.assistant .msg-body { background: var(--bg-secondary); border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: 2px 2px 8px var(--neu-dark), -1px -1px 4px var(--neu-light); }
.msg-body p { margin-bottom: 8px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { padding-left: 20px; margin-bottom: 8px; }
.msg-body li { margin-bottom: 3px; }
.msg-body a { color: var(--accent); text-decoration: underline; }
.msg-body strong { font-weight: 600; }
.msg-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-secondary); margin: 8px 0; }
.msg-body pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; margin: 8px 0; }
.msg-body code { font-family: 'Fira Code', monospace; font-size: 11.5px; }
.msg-body :not(pre) > code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; border: 1px solid var(--border); }
.code-block-wrap { position: relative; }
.copy-code-btn { position: absolute; top: 6px; right: 6px; padding: 3px 8px; font-size: 9px; font-weight: 600; font-family: inherit; background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-muted); border-radius: 5px; cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.code-block-wrap:hover .copy-code-btn { opacity: 1; }
.think-block { background: rgba(167,139,250,0.05); border: 1px solid rgba(167,139,250,0.1); border-radius: var(--r-sm); padding: 10px 14px; margin: 8px 0; font-size: 12px; color: var(--text-secondary); }
.think-block summary { cursor: pointer; font-weight: 600; font-size: 10px; color: var(--purple); }
.streaming-dot::after { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-left: 4px; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }
.search-sources { margin-top: 8px; padding: 8px 12px; background: var(--bg-tertiary); border-radius: var(--r-sm); font-size: 10px; }
.search-sources a { color: var(--accent); }

.input-area { padding: 10px 14px 12px; border-top: 1px solid var(--border); background: var(--bg-primary); flex-shrink: 0; }
.attachments-area { display: flex; gap: 6px; flex-wrap: wrap; }
.attachments-area:not(:empty) { margin-bottom: 8px; }
.attachment-chip { display: flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; font-size: 10px; color: var(--text-secondary); }
.attachment-chip .remove { cursor: pointer; color: var(--red); opacity: 0.5; }
.attachment-chip .remove:hover { opacity: 1; }

.input-wrapper { position: relative; display: flex; align-items: flex-end; gap: 6px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 8px; transition: border-color 0.2s; box-shadow: inset 2px 2px 6px var(--neu-dark), inset -1px -1px 3px var(--neu-light); }
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: inset 2px 2px 6px var(--neu-dark), inset -1px -1px 3px var(--neu-light), 0 0 0 1px rgba(237,106,0,0.1); }
.input-box { flex: 1; border: none; background: transparent; color: var(--text-primary); font-family: inherit; font-size: 13px; line-height: 1.5; resize: none; outline: none; max-height: 120px; padding: 4px 2px; }
.input-box::placeholder { color: var(--text-muted); }

.think-toggle { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.2s; flex-shrink: 0; font-size: 14px; }
.think-toggle:hover { background: var(--bg-hover); color: var(--text-secondary); }
.think-toggle.active { background: rgba(167,139,250,0.1); border-color: rgba(167,139,250,0.2); color: var(--purple); }

.send-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: white; cursor: pointer; transition: all 0.2s; flex-shrink: 0; box-shadow: 0 2px 8px rgba(237,106,0,0.25); font-size: 14px; }
.send-btn:hover { box-shadow: 0 4px 12px rgba(237,106,0,0.35); transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.input-meta { display: flex; justify-content: space-between; margin-top: 5px; font-size: 9px; color: var(--text-muted); font-family: 'Fira Code', monospace; }

.modal-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { width: 90%; max-width: 460px; padding: 24px; border-radius: var(--r-lg); background: var(--bg-primary); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 5px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 9px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-primary); font-family: inherit; font-size: 12.5px; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 70px; font-size: 12px; }
.modal-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.btn { padding: 8px 16px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary); transition: all 0.2s; }
.btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: white; border: none; box-shadow: 0 2px 8px rgba(237,106,0,0.2); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(237,106,0,0.3); transform: translateY(-1px); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,0.1); }

.user-info { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-secondary); display: none; }

.mobile-overlay { display: none; position: fixed; inset: 0; z-index: 98; background: rgba(0,0,0,0.4); }
.mobile-menu-btn { display: none; }
@media (max-width: 768px) { .sidebar { position: fixed; left: -280px; top: 0; z-index: 99; transition: left 0.3s var(--ease); width: 280px; min-width: 280px; } .sidebar.open { left: 0; } .sidebar.open ~ .mobile-overlay { display: block; } .mobile-menu-btn { display: flex; } }

.toast { position: fixed; bottom: 20px; right: 20px; z-index: 999; padding: 10px 18px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; background: var(--bg-tertiary); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.3); animation: toastIn 0.3s var(--ease); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }
@keyframes toastIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.i-ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
.folder-icon .i-ico { width: 14px; height: 14px; color: var(--accent); }
.pin-tab .i-ico { width: 12px; height: 12px; }
.pin-tab { opacity: 0.3; cursor: pointer; display: inline-flex; align-items: center; transition: opacity 0.2s; }
.pin-tab:hover, .pin-tab.pinned { opacity: 1; color: var(--accent); }
.attachment-icon .i-ico { width: 16px; height: 16px; color: var(--accent); }
.msg-attachment-title .i-ico { width: 13px; height: 13px; }
.thinking-icon .i-ico { width: 14px; height: 14px; }
.message-role .i-ico { width: 12px; height: 12px; }
.message { margin-bottom: 14px; }
.message-header { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.message-role { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 4px; }
.message-role.user { color: var(--accent); }
.message-role.assistant { color: var(--secondary-glow); }
.message-time { font-size: 9px; color: var(--text-muted); font-family: "Fira Code", monospace; }
.message-content { padding: 10px 14px; border-radius: var(--r-md); line-height: 1.7; font-size: 13px; }
.message.user .message-content { background: linear-gradient(135deg, rgba(237,106,0,0.08), rgba(237,106,0,0.03)); border: 1px solid rgba(237,106,0,0.1); border-bottom-right-radius: 4px; }
.message.assistant .message-content { background: var(--bg-secondary); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.model-badge { font-size: 9px; font-family: "Fira Code", monospace; color: var(--text-muted); background: var(--bg-secondary); display: inline-block; padding: 1px 6px; border-radius: 4px; margin-top: 3px; border: 1px solid var(--border); }
.msg-attachment { margin: 8px 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.msg-attachment-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--bg-tertiary); cursor: pointer; font-size: 11px; }
.msg-attachment-title { display: flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-secondary); }
.msg-attachment-body { display: none; padding: 8px 10px; font-family: "Fira Code", monospace; font-size: 11px; white-space: pre-wrap; background: var(--code-bg); color: var(--text-secondary); max-height: 300px; overflow-y: auto; }
.stream-stats { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 9px; font-family: "Fira Code", monospace; color: var(--text-muted); }
.attachment-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-sm); }
.attachment-icon { display: flex; align-items: center; color: var(--accent); }
.attachment-name { font-weight: 600; font-size: 11px; }
.attachment-meta { font-size: 9px; color: var(--text-muted); font-family: "Fira Code", monospace; }
.attachment-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 4px; }
.attachment-remove:hover { color: var(--red); background: rgba(248,113,113,0.1); }
.project-meta { font-size: 9.5px; color: var(--text-muted); font-family: "Fira Code", monospace; margin-left: 21px; }

/* ── Thinking blocks (fixed) ── */
.think-block { background: rgba(167,139,250,0.04); border: 1px solid rgba(167,139,250,0.1); border-radius: var(--r-sm); margin: 10px 0; overflow: hidden; }
.think-header { display: flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer; transition: background 0.2s; }
.think-header:hover { background: rgba(167,139,250,0.06); }
.think-ico { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--purple); }
.think-ico .i-ico { width: 14px; height: 14px; }
.think-label { font-size: 11px; font-weight: 600; color: var(--purple); letter-spacing: 0.3px; }
.think-toggle-arrow { font-size: 10px; color: var(--text-muted); margin-left: auto; transition: transform 0.2s; }
.think-content { padding: 10px 14px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); border-top: 1px solid rgba(167,139,250,0.08); display: none; }
.think-content.show { display: block; }
.think-spin { animation: thinkSpin 1.5s ease-in-out infinite; }
@keyframes thinkSpin { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Code blocks in messages (fix selector) ── */
.message-content pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; margin: 8px 0; position: relative; }
.message-content code { font-family: 'Fira Code', monospace; font-size: 11.5px; }
.message-content :not(pre) > code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; border: 1px solid var(--border); }
.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { padding-left: 20px; margin-bottom: 8px; }
.message-content li { margin-bottom: 3px; }
.message-content a { color: var(--accent); }
.message-content strong { font-weight: 600; }
.message-content blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-secondary); margin: 8px 0; }
.message-content h1,.message-content h2,.message-content h3 { margin: 12px 0 6px; font-weight: 700; }
.message-content h1 { font-size: 18px; }
.message-content h2 { font-size: 15px; }
.message-content h3 { font-size: 13px; }

/* Code copy button fix */
.code-block-wrap { position: relative; }
.code-block-wrap .copy-code-btn { position: absolute; top: 6px; right: 6px; padding: 3px 10px; font-size: 9px; font-weight: 600; font-family: inherit; background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-muted); border-radius: 5px; cursor: pointer; opacity: 0; transition: opacity 0.2s; z-index: 2; }
.code-block-wrap:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Fix icon sizes globally ── */
.chat-actions .btn-icon { width: 26px; height: 26px; }
.chat-actions .btn-icon svg { width: 13px; height: 13px; }
.section-title .btn-icon { width: 26px; height: 26px; }
.section-title .btn-icon svg { width: 13px; height: 13px; }
.sidebar-header .logo-img { width: 30px; height: 30px; }
/* ctx-badge removed */

/* ── Streaming cursor ── */
.streaming-cursor::after { content: ''; display: inline-block; width: 2px; height: 14px; background: var(--accent); margin-left: 2px; animation: curBlink 1s step-end infinite; vertical-align: text-bottom; }
@keyframes curBlink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ── Thinking body (toggle) ── */
.thinking-body { padding: 12px 16px; font-size: 12px; line-height: 1.65; color: var(--text-secondary); border-top: 1px solid rgba(167,139,250,0.08); background: rgba(167,139,250,0.02); }
.thinking-body p { margin-bottom: 6px; }
.thinking-body ul, .thinking-body ol { padding-left: 18px; margin-bottom: 6px; }

/* Active thinking (streaming) */
.think-active { border-color: rgba(167,139,250,0.2); }
.think-active .think-header { background: rgba(167,139,250,0.04); }

/* ── Chat message spacing fix ── */
.message + .message { margin-top: 4px; }
.message.user + .message.assistant { margin-top: 10px; }
.message.assistant + .message.user { margin-top: 14px; }

/* ── Stream stats bar ── */
.stream-stats { display: flex; align-items: center; gap: 8px; padding: 4px 0; margin-top: 4px; font-size: 9px; font-family: 'Fira Code', monospace; color: var(--text-muted); border-top: 1px solid var(--border); flex-wrap: wrap; }
.stream-stats .stat { display: inline-flex; align-items: center; gap: 3px; }
.stat-divider { color: var(--text-muted); opacity: 0.3; }

/* ── Tables in messages ── */
.message-content table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12px; }
.message-content th { padding: 6px 10px; text-align: left; font-weight: 700; font-size: 11px; color: var(--text-primary); background: var(--bg-tertiary); border: 1px solid var(--border); }
.message-content td { padding: 5px 10px; border: 1px solid var(--border); color: var(--text-secondary); }
.message-content tr:hover td { background: rgba(255,255,255,0.02); }
[data-theme="light"] .message-content tr:hover td { background: rgba(0,0,0,0.02); }

/* ── Horizontal rule ── */
.message-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── Chat File Bar ── */
.chat-file-bar { display: flex; align-items: center; gap: 8px; padding: 5px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, rgba(12,92,145,0.04), rgba(12,92,145,0.01)); }
.chat-file-bar-label { font-size: 9px; font-weight: 600; color: var(--secondary); letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.chat-file-chip { border-color: rgba(12,92,145,0.15); }
.chat-file-chip .i-ico { width: 12px; height: 12px; color: var(--secondary); }

/* Project file bar label */
.file-bar-label { font-size: 9px; font-weight: 600; color: var(--accent); letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 10px; font-family: 'Fira Code', monospace; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; white-space: nowrap; }
.file-chip .i-ico { width: 12px; height: 12px; }
.file-size { color: var(--text-muted); font-size: 9px; }
.file-remove { cursor: pointer; opacity: 0.4; margin-left: 2px; font-size: 11px; }
.file-remove:hover { opacity: 1; color: var(--red); }

/* ── Chat attach button (in input bar) ── */
.chat-attach-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.chat-attach-btn:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }
.chat-attach-btn .i-ico { width: 15px; height: 15px; }

/* ── Chat files area (above input box) ── */
.chat-files-area { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
.chat-files-area:not(:empty) { margin-bottom: 8px; }
.chat-file-tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; background: var(--bg-secondary); border: 1px solid rgba(12,92,145,0.15); border-radius: 8px; font-size: 11px; color: var(--text-secondary); animation: cfIn 0.2s ease; }
@keyframes cfIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }
.chat-file-tag .i-ico { width: 13px; height: 13px; color: var(--secondary-glow); flex-shrink: 0; }
.cf-name { font-weight: 600; color: var(--text-primary); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-size { font-size: 9px; color: var(--text-muted); font-family: 'Fira Code', monospace; }
.cf-remove { cursor: pointer; color: var(--text-muted); font-size: 12px; margin-left: 2px; opacity: 0.5; transition: all 0.15s; }
.cf-remove:hover { opacity: 1; color: var(--red); }

/* Upload spinner */
.chat-file-tag.uploading { border-color: var(--accent); color: var(--accent); }
.cf-spinner { width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: cfSpin 0.6s linear infinite; flex-shrink: 0; }
@keyframes cfSpin { to{transform:rotate(360deg)} }
.chat-file-tag.upload-error { border-color: var(--red); color: var(--red); }

/* ── Quick Command Hints ──────────────────────────────────── */
.command-hints {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary, #1a1a2e);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}
.cmd-hint {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.cmd-hint:hover {
  background: var(--bg-tertiary, #252540);
}
.cmd-name {
  color: var(--accent, #ED6A00);
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  font-size: 12px;
}
.cmd-desc {
  color: var(--text-secondary, #888);
  font-size: 12px;
}

/* ── Diff View ──────────────────────────────────── */
.diff-add { color: #2ed573; background: rgba(46,213,115,0.1); display: inline-block; width: 100%; padding: 0 4px; margin: 0 -4px; }
.diff-del { color: #ff4757; background: rgba(255,71,87,0.1); display: inline-block; width: 100%; padding: 0 4px; margin: 0 -4px; text-decoration: line-through; }
.diff-hunk { color: #a78bfa; font-weight: 500; }

/* Fix: attachment area should not block send button */
.attachments-area { position: relative; z-index: 1; }
.input-wrapper { position: relative; z-index: 2; }
.send-btn { position: relative; z-index: 3; cursor: pointer; }
.attachment-image img { pointer-events: none; }

/* ── Message Action Buttons (Phase 1) ── */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.message:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.msg-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-active);
}
.msg-action-btn .i-ico { width: 11px; height: 11px; }
.msg-action-btn.copied {
  color: var(--green);
  border-color: rgba(52,211,153,0.2);
}

/* ── Streaming Typing Indicator (Phase 1) ── */
.stream-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
}
.typing-dots { display: flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: typeDot 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typeDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}
.stream-elapsed {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: var(--text-muted);
}

/* ── Collapsible System Monitor (Phase 1) ── */
.sys-monitor.collapsed .sys-rows { display: none; }
.sys-monitor.collapsed .sys-detail-row { display: none !important; }
.sys-toggle-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  cursor: pointer;
}
.sys-monitor.collapsed .sys-toggle-arrow { transform: rotate(-90deg); }
.sys-title { cursor: pointer; user-select: none; }
.sys-title:hover { color: var(--text-secondary); }
.sys-rows { transition: max-height 0.3s ease; }

/* ── Command Help Tooltip (Phase 2) ── */
.cmd-help-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all 0.2s; flex-shrink: 0;
  font-size: 12px; font-weight: 700; font-family: inherit;
}
.cmd-help-btn:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }
.cmd-help-popup {
  display: none;
  position: absolute;
  bottom: 100%; right: 0;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.3);
  z-index: 100;
}
.cmd-help-popup.show { display: block; }
.cmd-help-popup h4 {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 8px;
}
.cmd-help-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px;
  cursor: pointer; transition: background 0.15s;
}
.cmd-help-item:hover { background: var(--bg-hover); }
.cmd-help-item .cmd-k {
  font-family: 'Fira Code', monospace; font-size: 11px;
  font-weight: 600; color: var(--accent);
  min-width: 64px;
}
.cmd-help-item .cmd-d {
  font-size: 10.5px; color: var(--text-secondary);
}
.cmd-help-divider {
  height: 1px; background: var(--border); margin: 6px 0;
}
.cmd-help-shortcut {
  font-size: 9px; color: var(--text-muted); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.cmd-help-shortcut kbd {
  padding: 1px 5px; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: 'Fira Code', monospace; font-size: 9px;
}

/* ── Sidebar Enhancements (Phase 3) ── */
.project-color-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.sys-bar.gpu-idle { opacity: 0.35; }
.sys-temp-icon { font-size: 12px; }
.sys-temp-value { font-family: 'Fira Code', monospace; font-size: 10px; font-weight: 600; }
.sys-temp-cool { color: var(--green); }
.sys-temp-warm { color: #f59e0b; }
.sys-temp-hot { color: var(--red); }

/* ── Context Indicator (Phase 2) ── */
.ctx-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-family: 'Fira Code', monospace;
  color: var(--text-muted);
}
.ctx-bar {
  width: 48px; height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}
.ctx-bar-fill {
  height: 100%; border-radius: 2px;
  background: var(--green);
  transition: width 0.3s ease, background 0.3s ease;
}
.ctx-bar-fill.warn { background: #f59e0b; }
.ctx-bar-fill.danger { background: var(--red); }

/* ── Fix: Attachment expand toggle ── */
.msg-attachment-body.expanded { display: block; }
