/* ── Google Font ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --bg:          #09090b;
  --surface:     #111113;
  --surface2:    #1c1c1f;
  --surface3:    #26262b;
  --border:      #2e2e35;
  --border2:     #3a3a42;
  --text:        #f4f4f5;
  --text2:       #a1a1aa;
  --text3:       #71717a;
  --accent:      #7c6af7;
  --accent-h:    #6d5ce6;
  --accent-glow: rgba(124,106,247,0.18);
  --accent-soft: rgba(124,106,247,0.1);
  --green:       #22c55e;
  --green-soft:  rgba(34,197,94,0.12);
  --red:         #f87171;
  --yellow:      #fbbf24;
  --teal:        #06b6d4;
  --teal-soft:   rgba(6,182,212,0.1);
  --teal-glow:   rgba(6,182,212,0.18);
  --user-bg:     #16161a;
  --sidebar-w:   272px;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --trans:       0.15s ease;
  --trans-slow:  0.25s ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--trans-slow), min-width var(--trans-slow), opacity var(--trans-slow);
  overflow: hidden;
  z-index: 10;
}
.sidebar.collapsed { width: 0; min-width: 0; opacity: 0; }

/* brand */
.sidebar-top { padding: 18px 14px 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand-logo-wrap {
  background: #ffffff;
  border-radius: 8px;
  padding: 4px 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.brand-logo-img {
  height: 24px;
  width: auto;
  object-fit: contain;
  display: block;
}
.brand-text {
  display: flex; flex-direction: column; gap: 0; min-width: 0;
}
.brand-name {
  font-size: 14px; font-weight: 700;
  background: linear-gradient(90deg, #fff 60%, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px; white-space: nowrap; line-height: 1.2;
}
.brand-tag {
  font-size: 10px; font-weight: 500; color: var(--text3);
  letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.2;
}

/* new chat */
.new-chat-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface3); color: var(--text);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 9px 14px; font-size: 13px; font-weight: 500;
  transition: all var(--trans);
}
.new-chat-btn svg { width: 15px; height: 15px; }
.new-chat-btn:hover {
  background: var(--accent-soft); border-color: var(--accent);
  color: #fff; box-shadow: 0 0 12px var(--accent-glow);
}

/* search */
.session-search { padding: 8px 14px 10px; }
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 11px;
  transition: border-color var(--trans);
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap svg { width: 14px; height: 14px; color: var(--text3); flex-shrink: 0; }
.search-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 13px;
}
.search-wrap input::placeholder { color: var(--text3); }

/* session list */
.session-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.sessions-loading { padding: 20px 12px; color: var(--text3); font-size: 13px; text-align: center; }
.session-group-label {
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 12px 8px 5px;
}
.session-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--radius);
  cursor: pointer; margin-bottom: 1px;
  transition: background var(--trans); position: relative;
  border: 1px solid transparent;
}
.session-item:hover { background: var(--surface2); }
.session-item.active {
  background: var(--accent-soft);
  border-color: rgba(124,106,247,0.25);
}
.session-item.active .si-title { color: var(--text); }
.si-icon { font-size: 13px; flex-shrink: 0; opacity: 0.7; }
.si-title {
  flex: 1; font-size: 13px; color: var(--text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.session-item.active .si-icon { opacity: 1; }
.si-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--trans); flex-shrink: 0; }
.session-item:hover .si-actions { opacity: 1; }
.si-actions button {
  background: none; border: none; color: var(--text3);
  padding: 3px 5px; border-radius: 5px; font-size: 12px; line-height: 1;
  transition: all var(--trans);
}
.si-actions button:hover { background: var(--surface3); color: var(--text); }

/* sidebar bottom */
.sidebar-bottom {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.model-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.6px; }
.model-select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: 13px; font-weight: 500;
  padding: 8px 10px; outline: none; transition: border-color var(--trans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
  padding-right: 30px;
}
.model-select:focus { border-color: var(--accent); }
.model-select option { background: var(--surface2); }

.global-mem-btn {
  width: 100%; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text2); font-size: 13px;
  padding: 8px 10px; display: flex; align-items: center; gap: 7px;
  transition: all var(--trans);
}
.global-mem-btn:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.btn-text-truncate {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}

/* ── Main ────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* header */
.chat-header {
  height: 58px; padding: 0 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(12px);
  flex-shrink: 0; position: relative; z-index: 5;
}
.sidebar-toggle {
  background: none; border: 1px solid transparent;
  color: var(--text3); border-radius: var(--radius-sm);
  padding: 6px; display: flex; align-items: center;
  transition: all var(--trans); flex-shrink: 0;
}
.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }

.chat-title {
  flex: 1; font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text2);
}

.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* reasoning toggle */
.reasoning-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px 5px 8px;
  cursor: pointer; transition: all var(--trans);
  position: relative;
}
.reasoning-pill:hover { border-color: var(--accent); }
.reasoning-pill input { display: none; }
.reasoning-pill.active {
  background: var(--accent-soft); border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.rp-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text3); transition: background var(--trans);
}
.reasoning-pill.active .rp-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.rp-label { font-size: 12px; font-weight: 500; color: var(--text2); white-space: nowrap; }
.reasoning-pill.active .rp-label { color: #a78bfa; }

/* sources block — appended below assistant message when web search is used */
.sources-block {
  margin-top: 14px; padding: 12px 14px;
  background: var(--teal-soft); border: 1px solid rgba(6,182,212,0.25);
  border-radius: var(--radius-lg);
}
.sources-label {
  font-size: 11px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 8px;
}
.source-link {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; text-decoration: none;
  border-bottom: 1px solid rgba(6,182,212,0.12);
  transition: opacity var(--trans);
}
.source-link:last-child { border-bottom: none; }
.source-link:hover { opacity: 0.8; }
.src-num {
  font-size: 10px; font-weight: 700; color: var(--teal);
  background: rgba(6,182,212,0.15); border-radius: 4px;
  padding: 1px 6px; flex-shrink: 0;
}
.src-title {
  font-size: 12px; color: #67e8f9;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* header icon buttons */
.h-btn {
  position: relative; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text2);
  padding: 6px 11px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--trans); white-space: nowrap;
}
.h-btn svg { width: 14px; height: 14px; }
.h-btn:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.h-btn.danger:hover { border-color: var(--red); color: var(--red); }
.h-btn-icon {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text3); padding: 6px 8px; display: flex; align-items: center;
  transition: all var(--trans);
}
.h-btn-icon svg { width: 16px; height: 16px; }
.h-btn-icon:hover { background: var(--surface2); color: var(--text); }

/* divider */
.h-divider { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

/* ── Chat area ───────────────────────────────────────────────── */
.chat-area { flex: 1; overflow-y: auto; scroll-behavior: smooth; }

/* ── Welcome ─────────────────────────────────────────────────── */
.welcome {
  max-width: 680px; margin: 0 auto;
  padding: 60px 24px 40px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.welcome-brand {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.welcome-logo-wrap {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.2),
    0 0 0 1px rgba(255,255,255,0.06),
    0 0 50px rgba(245,158,11,0.06);
}
.welcome-logo-img {
  height: 56px;
  width: auto;
  object-fit: contain;
  display: block;
}
.welcome-badge {
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124,106,247,0.2);
  border-radius: 20px;
  padding: 4px 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.welcome h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 10px; }
.welcome-sub { color: var(--text2); font-size: 14px; margin-bottom: 36px; line-height: 1.6; }

.feature-cards {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; width: 100%; margin-bottom: 28px;
}
.fcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  text-align: left; transition: border-color var(--trans);
}
.fcard:hover { border-color: var(--border2); }
.fcard-icon { font-size: 20px; margin-bottom: 8px; }
.fcard b { font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; color: var(--text); }
.fcard p { font-size: 12px; color: var(--text2); margin: 0; line-height: 1.5; }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sug-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text2); font-size: 13px;
  padding: 8px 16px; transition: all var(--trans);
}
.sug-btn:hover {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--text);
}

/* ── Messages ────────────────────────────────────────────────── */
.messages { max-width: 780px; margin: 0 auto; padding: 12px 24px 32px; }

.msg {
  display: flex; gap: 14px; padding: 14px 0;
  animation: msgIn 0.22s ease;
}
@keyframes msgIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; margin-top: 2px; font-weight: 600;
}
.msg.user .msg-avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 11px;
}
.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  color: #fff; font-size: 14px;
}

.msg-body { flex: 1; min-width: 0; }
.msg-meta {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
}
.msg-role { font-size: 13px; font-weight: 600; color: var(--text); }
.msg-time { font-size: 11px; color: var(--text3); }
.model-badge {
  font-size: 10px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(124,106,247,0.2);
  border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* user bubble */
.msg.user .msg-bubble {
  background: var(--user-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  padding: 12px 16px;
  display: inline-block; max-width: 100%;
}

/* assistant text */
.msg-text {
  font-size: 14px; line-height: 1.8; color: var(--text);
  word-wrap: break-word;
}
.msg-text p { margin-bottom: 12px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text h1, .msg-text h2, .msg-text h3 {
  font-weight: 700; margin: 18px 0 8px; letter-spacing: -0.3px;
}
.msg-text h1 { font-size: 20px; }
.msg-text h2 { font-size: 17px; }
.msg-text h3 { font-size: 15px; }
.msg-text ul, .msg-text ol { padding-left: 22px; margin: 10px 0; }
.msg-text li { margin-bottom: 6px; }
.msg-text a { color: #a78bfa; text-decoration: none; border-bottom: 1px solid rgba(167,139,250,0.3); transition: border-color var(--trans); }
.msg-text a:hover { border-color: #a78bfa; }
.msg-text strong { color: #fff; font-weight: 600; }
.msg-text em { color: var(--text2); }
.msg-text blockquote {
  border-left: 3px solid var(--accent); padding: 8px 0 8px 16px;
  color: var(--text2); margin: 12px 0; font-style: italic;
}
.msg-text hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.msg-text table { border-collapse: collapse; width: 100%; margin: 14px 0; border-radius: var(--radius); overflow: hidden; }
.msg-text th { background: var(--surface2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text2); }
.msg-text th, .msg-text td { border: 1px solid var(--border); padding: 9px 14px; font-size: 13px; }
.msg-text tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* code */
.msg-text code:not(pre code) {
  background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 5px; padding: 2px 7px; font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 12.5px; color: #e879f9;
}
.msg-text pre {
  background: #0d0d10; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin: 14px 0;
  position: relative;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.code-copy {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  color: var(--text3); font-size: 11px; padding: 3px 10px;
  transition: all var(--trans); font-family: inherit;
}
.code-copy:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.msg-text pre code {
  display: block; padding: 16px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 13px; line-height: 1.65; overflow-x: auto;
}

/* ── Thinking block ──────────────────────────────────────────── */
.think-block {
  background: rgba(124,106,247,0.06); border: 1px solid rgba(124,106,247,0.2);
  border-radius: var(--radius-lg); margin: 12px 0; overflow: hidden;
}
.think-header {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  cursor: pointer; user-select: none;
}
.think-header-text { font-size: 12px; font-weight: 600; color: #a78bfa; letter-spacing: 0.3px; }
.think-chevron {
  width: 14px; height: 14px; color: #a78bfa; flex-shrink: 0;
  transition: transform var(--trans); margin-left: auto;
}
.think-block.open .think-chevron { transform: rotate(180deg); }
.think-body {
  display: none; padding: 0 16px 14px;
  font-size: 13px; line-height: 1.7; color: #c4b5fd;
}
.think-block.open .think-body { display: block; }
.think-step { display: flex; gap: 8px; margin-bottom: 6px; }
.think-step::before { content: '·'; color: #7c6af7; flex-shrink: 0; }

/* ── Typing indicator ────────────────────────────────────────── */
.typing-wrap { display: flex; gap: 5px; align-items: center; padding: 8px 0; }
.t-dot {
  width: 7px; height: 7px; background: var(--text3);
  border-radius: 50%; animation: tBounce 1.3s infinite;
}
.t-dot:nth-child(2) { animation-delay: 0.16s; }
.t-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes tBounce { 0%,60%,100% { transform:translateY(0); opacity:0.4; } 30% { transform:translateY(-6px); opacity:1; } }

/* ── Message actions ─────────────────────────────────────────── */
.msg-actions { display: flex; gap: 4px; margin-top: 8px; opacity: 0; transition: opacity var(--trans); }
.msg:hover .msg-actions { opacity: 1; }
.ma-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text3); font-size: 11px; padding: 3px 9px;
  display: flex; align-items: center; gap: 4px;
  transition: all var(--trans);
}
.ma-btn svg { width: 11px; height: 11px; }
.ma-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }

/* ── Input bar ───────────────────────────────────────────────── */
.input-bar {
  padding: 12px 24px 14px;
  background: linear-gradient(to top, var(--bg) 80%, transparent);
  flex-shrink: 0; position: relative;
}

/* attach preview */
.attach-preview {
  max-width: 780px; margin: 0 auto 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.attach-preview:empty { display: none; }
.attach-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 5px 8px 5px 10px;
  font-size: 12px; max-width: 200px; animation: msgIn 0.2s ease;
}
.chip-icon { font-size: 14px; flex-shrink: 0; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.chip-size { color: var(--text3); flex-shrink: 0; font-size: 11px; }
.chip-remove {
  background: none; border: none; color: var(--text3);
  font-size: 13px; padding: 0 2px; flex-shrink: 0;
  transition: color var(--trans); line-height: 1;
}
.chip-remove:hover { color: var(--red); }

/* input box */
.input-wrap {
  max-width: 780px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color var(--trans), box-shadow var(--trans);
  box-shadow: var(--shadow-sm);
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}
#msgInput {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 14px; line-height: 1.6;
  resize: none; max-height: 200px; overflow-y: auto; min-height: 22px;
  width: 100%;
}
#msgInput::placeholder { color: var(--text3); }

/* toolbar row below the textarea */
.input-toolbar {
  display: flex; align-items: center; justify-content: space-between;
}
.toolbar-left { display: flex; align-items: center; gap: 4px; }

/* attach icon button */
.tool-icon-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text3);
  padding: 5px 8px; display: flex; align-items: center;
  transition: all var(--trans);
}
.tool-icon-btn svg { width: 16px; height: 16px; }
.tool-icon-btn:hover {
  background: var(--surface2); color: var(--text); border-color: var(--border2);
}

/* web search toggle button */
.ws-toggle {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 10px; cursor: pointer;
  color: var(--text3); font-size: 12px; font-weight: 500;
  background: none; transition: all var(--trans);
  user-select: none; white-space: nowrap;
}
.ws-toggle input { display: none !important; }
.ws-toggle svg { width: 14px; height: 14px; flex-shrink: 0; }
.ws-toggle:hover {
  background: var(--surface2); color: var(--text); border-color: var(--border2);
}
.ws-toggle.active {
  background: var(--teal-soft); border-color: var(--teal);
  color: var(--teal); box-shadow: 0 0 8px var(--teal-glow);
}
.ws-toggle.active svg { stroke: var(--teal); }
.ws-label { white-space: nowrap; }

.send-btn {
  width: 36px; height: 36px; background: var(--accent); border: none;
  border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); flex-shrink: 0;
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:hover { background: var(--accent-h); transform: scale(1.05); box-shadow: 0 0 14px var(--accent-glow); }
.send-btn:disabled { background: var(--surface3); transform: none; box-shadow: none; color: var(--text3); }

/* Stop button (replaces send while streaming) */
.send-btn.stop-mode {
  background: rgba(248,113,113,0.15);
  border: 1.5px solid rgba(248,113,113,0.5);
  color: var(--red);
  animation: stopPulse 1.6s ease-in-out infinite;
}
.send-btn.stop-mode:hover {
  background: rgba(248,113,113,0.28);
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(248,113,113,0.3);
  transform: scale(1.05);
}
@keyframes stopPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); }
  50%       { box-shadow: 0 0 0 5px rgba(248,113,113,0.15); }
}

/* Stopped badge */
.stopped-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text3);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 9px; margin-top: 10px;
}

.disclaimer {
  max-width: 780px; margin: 8px auto 0;
  text-align: center; font-size: 11px; color: var(--text3); letter-spacing: 0.1px;
}

/* ── Edit prompt inline ──────────────────────────────────────── */
.edit-wrap { margin-top: 8px; animation: msgIn 0.18s ease; }
.edit-textarea {
  width: 100%; min-height: 80px; max-height: 260px;
  background: var(--surface2); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); color: var(--text);
  font-size: 14px; line-height: 1.65; font-family: inherit;
  padding: 12px 14px; outline: none; resize: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
  transition: border-color var(--trans);
}
.edit-textarea:focus { border-color: #a78bfa; }
.edit-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px;
}
.edit-actions .btn-primary {
  display: flex; align-items: center; gap: 6px;
}
.edit-actions .btn-primary svg { width: 13px; height: 13px; }
.edit-cancel-btn { padding: 7px 14px; }

/* ── File cards in messages ──────────────────────────────────── */
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.file-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 13px; max-width: 220px;
}
.fc-icon { font-size: 22px; flex-shrink: 0; }
.fc-info { overflow: hidden; }
.fc-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-size { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.72); z-index: 500;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: none;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); width: 520px; max-width: 95vw;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow), 0 0 60px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.96) translateY(8px); } to { opacity:1; transform:none; } }
.modal-sm { width: 380px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text3); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all var(--trans);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-desc { padding: 12px 20px 0; font-size: 13px; color: var(--text2); line-height: 1.6; }

.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}
.btn-primary {
  background: var(--accent); border: none; border-radius: var(--radius);
  color: #fff; font-size: 13px; font-weight: 500; padding: 8px 16px;
  transition: all var(--trans);
}
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 0 12px var(--accent-glow); }
.btn-outline {
  background: none; border: 1px solid var(--border2); border-radius: var(--radius);
  color: var(--text2); font-size: 13px; font-weight: 500; padding: 8px 16px;
  transition: all var(--trans);
}
.btn-outline:hover { background: var(--surface2); color: var(--text); }

/* memory items */
.mem-empty { color: var(--text3); font-size: 13px; text-align: center; padding: 28px 0; }
.mem-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px;
  transition: border-color var(--trans);
}
.mem-item:hover { border-color: var(--border2); }
.mem-key { font-size: 12px; font-weight: 700; color: var(--accent); min-width: 90px; padding-top: 1px; flex-shrink: 0; }
.mem-val { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text2); }
.mem-del {
  background: none; border: none; color: var(--text3); font-size: 14px;
  padding: 0 2px; flex-shrink: 0; transition: color var(--trans); line-height: 1;
}
.mem-del:hover { color: var(--red); }

/* text input */
.text-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  padding: 10px 14px; outline: none; transition: border-color var(--trans);
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Custom Dialogs ──────────────────────────────────────────── */
.dialog-modal {
  padding: 32px 28px 24px;
  align-items: center; text-align: center;
  gap: 0; max-width: 360px;
}
.dialog-icon {
  font-size: 36px; margin-bottom: 14px;
  line-height: 1;
}
.dialog-title {
  font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
  letter-spacing: -0.2px;
}
.dialog-msg {
  font-size: 13px; color: var(--text2);
  line-height: 1.6; margin-bottom: 20px;
  min-height: 0;
}
.dialog-modal .text-input {
  width: 100%; margin-bottom: 20px; text-align: left;
}
.dialog-actions {
  display: flex; gap: 10px; width: 100%; justify-content: flex-end;
}
.dialog-actions .btn-outline,
.dialog-actions .btn-primary,
.dialog-actions .btn-danger { flex: 1; justify-content: center; }

.btn-danger {
  background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35);
  border-radius: var(--radius); color: var(--red);
  font-size: 13px; font-weight: 600; padding: 8px 16px;
  transition: all var(--trans);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.22); border-color: var(--red);
  box-shadow: 0 0 14px rgba(248,113,113,0.2);
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); color: var(--text);
  padding: 11px 20px; font-size: 13px; font-weight: 500;
  z-index: 9999; display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow); animation: toastIn 0.2s ease;
  white-space: nowrap;
}
.toast.warn { border-color: rgba(251,191,36,0.4); }
.toast.warn::before { content: '⚠️'; }
.toast.ok::before { content: '✓'; color: var(--green); }
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* ── Responsive ─────────────────────────────────────────────── */

/* Sidebar overlay backdrop (mobile only) */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 9;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.sidebar-backdrop.visible { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Tablet: <= 900px ────────────────────────────── */
@media (max-width: 900px) {
  .h-btn span { display: none; }
  .user-name { display: none; }
  .reasoning-pill .rp-label { display: none; }
  .welcome { padding: 40px 20px 30px; }
  .welcome h1 { font-size: 24px; }
  .feature-cards { gap: 8px; }
  .fcard { padding: 14px 14px; }
}

/* ── Mobile: <= 700px ────────────────────────────── */
@media (max-width: 700px) {

  /* --- Sidebar: slide-in overlay --- */
  .sidebar {
    position: fixed; left: 0; top: 0;
    height: 100vh; height: 100dvh;
    width: 280px; min-width: 280px;
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
    transform: translateX(0);
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 10;
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
    opacity: 1; width: 280px; min-width: 280px;
  }

  /* --- Header: compact --- */
  .chat-header { height: 52px; padding: 0 12px; gap: 8px; }
  .chat-title { font-size: 13px; }
  .header-actions { gap: 4px; }
  .h-btn { padding: 6px 8px; }
  .h-btn span { display: none; }
  .h-divider { margin: 0; }
  .reasoning-pill { padding: 5px 8px 5px 6px; }
  .reasoning-pill .rp-label { display: none; }
  .ws-label { display: none; }
  .user-name { display: none; }
  .user-badge { padding: 3px 6px 3px 3px; }
  .user-chevron { display: none; }

  /* --- User dropdown: full-width on small screens --- */
  .user-menu { width: calc(100vw - 24px); right: -8px; }

  /* --- Welcome: single column --- */
  .welcome { padding: 32px 16px 24px; }
  .welcome h1 { font-size: 20px; }
  .welcome-sub { font-size: 13px; margin-bottom: 24px; }
  .welcome-logo-img { height: 42px; }
  .welcome-logo-wrap { padding: 10px 16px; border-radius: 12px; }
  .feature-cards { grid-template-columns: 1fr; gap: 8px; }
  .fcard { padding: 14px; }
  .suggestions { gap: 6px; }
  .sug-btn { font-size: 12px; padding: 7px 12px; }

  /* --- Messages --- */
  .messages { padding: 10px 12px 24px; }
  .msg { gap: 10px; padding: 10px 0; }
  .msg-avatar { width: 28px; height: 28px; font-size: 12px; }
  .msg-text { font-size: 13px; line-height: 1.7; }
  .msg-text pre code { font-size: 12px; padding: 12px 14px; }
  .msg-actions { opacity: 1; }

  /* --- Input bar --- */
  .input-bar { padding: 8px 10px 10px; }
  .input-wrap { padding: 10px 12px 8px; border-radius: var(--radius-lg); }
  #msgInput { font-size: 14px; }
  .disclaimer { font-size: 10px; }
  .attach-preview { margin: 0 auto 6px; }
  .attach-chip { max-width: 160px; }

  /* --- Context bar --- */
  .context-bar { padding: 5px 12px; gap: 4px; }

  /* --- Modals: near full-screen --- */
  .modal { width: 100%; max-width: 100vw; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 90vh; }
  .modal-sm { width: 100%; max-width: 100vw; }
  .modal-overlay.open { align-items: flex-end; }
  .modal-head { padding: 16px 16px 14px; }
  .modal-head h2 { font-size: 14px; }
  .modal-desc { padding: 10px 16px 0; font-size: 12px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; }

  /* --- Dialog modals --- */
  .dialog-modal { padding: 24px 20px 20px; border-radius: var(--radius-lg); max-width: calc(100vw - 32px); }

  /* --- Toast --- */
  .toast { bottom: 16px; font-size: 12px; padding: 9px 16px; max-width: calc(100vw - 32px); }

  /* --- Sources block --- */
  .sources-block { padding: 10px 12px; }
  .src-title { font-size: 11px; }
}

/* ── Small phone: <= 400px ───────────────────────── */
@media (max-width: 400px) {
  .sidebar { width: 260px; min-width: 260px; }
  .sidebar.collapsed { width: 260px; min-width: 260px; }
  .chat-header { height: 48px; padding: 0 10px; gap: 6px; }
  .chat-title { font-size: 12px; }
  .welcome { padding: 24px 12px 20px; }
  .welcome h1 { font-size: 18px; }
  .welcome-logo-img { height: 36px; }
  .messages { padding: 8px 10px 20px; }
  .input-bar { padding: 6px 8px 8px; }
  .input-wrap { padding: 8px 10px 6px; }
  .fcard b { font-size: 12px; }
  .fcard p { font-size: 11px; }
  .h-btn { padding: 5px 6px; }
  .user-avatar { width: 24px; height: 24px; font-size: 9px; }
}

/* ── User badge (header) ───────────────────────── */
.user-badge-wrap { position: relative; }

.user-badge {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 4px 10px 4px 4px;
  cursor: pointer; transition: all var(--trans);
}
.user-badge:hover { border-color: var(--accent); }

.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name {
  font-size: 12px; font-weight: 600; color: var(--text2);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chevron {
  width: 13px; height: 13px; color: var(--text3);
  transition: transform var(--trans); flex-shrink: 0;
}
.user-badge-wrap.open .user-chevron { transform: rotate(180deg); }

/* ── Dropdown menu ─────────────────────────────── */
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 268px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); box-shadow: 0 20px 56px rgba(0,0,0,0.55);
  display: none; flex-direction: column; z-index: 300; overflow: hidden;
  animation: menuIn 0.15s ease;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-badge-wrap.open .user-menu { display: flex; }

.um-profile {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px;
}
.um-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.um-info   { display: flex; flex-direction: column; gap: 2px; overflow: hidden; min-width: 0; }
.um-name   { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-detail { font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.um-meta {
  padding: 8px 16px 14px;
  display: flex; flex-direction: column; gap: 5px;
  border-top: 1px solid var(--border);
}
.um-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 11px;
}
.um-row span:first-child { color: var(--text3); flex-shrink: 0; }
.um-row span:last-child  { color: var(--text2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.um-divider { height: 1px; background: var(--border); }

.um-logout {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 12px 16px;
  background: none; border: none; color: var(--red);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background var(--trans);
}
.um-logout:hover { background: rgba(248,113,113,0.08); }
.um-logout svg   { width: 14px; height: 14px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   SIDEBAR TABS — Projects & Gems navigation
   ══════════════════════════════════════════════════ */

.sb-tabs {
  display: flex; align-items: center;
  padding: 6px 10px 0;
  gap: 2px;
  flex-shrink: 0;
}

.sb-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 5px; background: none; border: none;
  border-radius: var(--radius); padding: 7px 4px;
  font-size: 12px; font-weight: 500; color: var(--text3);
  cursor: pointer; transition: all var(--trans);
  white-space: nowrap;
}
.sb-tab svg { width: 13px; height: 13px; flex-shrink: 0; }
.sb-tab:hover { background: var(--surface2); color: var(--text2); }
.sb-tab.active {
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(124,106,247,0.2);
}
.sb-tab.active svg { stroke: var(--accent); }

/* ── Sidebar panels (one visible at a time) ───────── */
.sb-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.sb-panel.active { display: flex; }

/* Projects / Gems panel header */
.sb-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px;
  flex-shrink: 0;
}
.sb-panel-title { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.7px; }

.sb-add-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface3); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text2);
  font-size: 11px; font-weight: 600; padding: 4px 9px;
  cursor: pointer; transition: all var(--trans);
}
.sb-add-btn svg { width: 11px; height: 11px; }
.sb-add-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Empty state */
.sb-empty {
  padding: 28px 16px; text-align: center;
  font-size: 12px; color: var(--text3); line-height: 1.7;
}
.sb-empty b { color: var(--text2); }

/* Scrollable content area inside a panel */
.proj-list, .gem-list {
  flex: 1; overflow-y: auto; padding: 4px 8px 8px;
}

/* ── Project / Gem list items ─────────────────────── */
.proj-item, .gem-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--radius);
  cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background var(--trans), border-color var(--trans);
}
.proj-item:hover, .gem-item:hover { background: var(--surface2); }

.proj-item.active {
  background: var(--accent-soft);
  border-color: rgba(124,106,247,0.25);
}
.gem-item.active {
  background: var(--teal-soft);
  border-color: rgba(6,182,212,0.25);
}

.pi-icon { font-size: 16px; flex-shrink: 0; line-height: 1; }

.pi-info { flex: 1; min-width: 0; }
.pi-name {
  font-size: 13px; font-weight: 500; color: var(--text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proj-item.active .pi-name,
.gem-item.active  .pi-name { color: var(--text); }
.pi-desc {
  font-size: 11px; color: var(--text3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pi-actions {
  display: flex; gap: 1px; opacity: 0;
  transition: opacity var(--trans); flex-shrink: 0;
}
.proj-item:hover .pi-actions,
.gem-item:hover  .pi-actions { opacity: 1; }
.pi-actions button {
  background: none; border: none; color: var(--text3);
  padding: 3px 5px; border-radius: 5px; font-size: 12px; line-height: 1;
  cursor: pointer; transition: all var(--trans);
}
.pi-actions button:hover { background: var(--surface3); color: var(--text); }

/* ══════════════════════════════════════════════════
   CONTEXT BAR — Active project / gem indicator
   ══════════════════════════════════════════════════ */

.context-bar {
  display: none; /* shown by JS */
  align-items: center; gap: 6px;
  padding: 6px 18px;
  background: rgba(124,106,247,0.05);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ctx-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 3px 8px 3px 7px;
  font-size: 12px;
}
.ctx-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.proj-dot { background: var(--accent); box-shadow: 0 0 5px var(--accent-glow); }
.gem-dot  { background: var(--teal);   box-shadow: 0 0 5px var(--teal-glow); }

.ctx-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.ctx-name  { font-size: 12px; font-weight: 600; color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ctx-remove {
  background: none; border: none; color: var(--text3);
  font-size: 14px; line-height: 1; padding: 0 0 0 2px;
  cursor: pointer; transition: color var(--trans);
}
.ctx-remove:hover { color: var(--red); }

.ctx-sep {
  width: 1px; height: 14px; background: var(--border2); margin: 0 2px;
}

/* ══════════════════════════════════════════════════
   FORM ELEMENTS inside modals
   ══════════════════════════════════════════════════ */

.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text2); margin-bottom: 6px; letter-spacing: 0.1px;
}

.form-textarea {
  resize: vertical; min-height: 90px; line-height: 1.6;
  font-family: inherit;
}

/* ══════════════════════════════════════════════════
   PROJECT / GEM EXPANDED SESSIONS — folder view
   ══════════════════════════════════════════════════ */

/* Wrapper that shows/hides session list below the item */
.proj-expand-area, .gem-expand-area {
  border-left: 2px solid var(--accent-soft);
  margin: 0 0 4px 20px;
  padding: 4px 0 2px;
  display: none;
}
.proj-expand-area.open, .gem-expand-area.open { display: block; }

/* "New Chat in Project" button inside expand area */
.ctx-new-chat-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 10px;
  background: none; border: none; color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--trans);
  font-family: inherit;
}
.ctx-new-chat-btn:hover { background: var(--accent-soft); }
.ctx-new-chat-btn svg { width: 12px; height: 12px; flex-shrink: 0; }

/* Individual session row inside folder */
.psi-item {
  display: flex; align-items: center;
  padding: 5px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; color: var(--text2);
  transition: background var(--trans);
  gap: 7px;
}
.psi-item:hover { background: var(--surface2); }
.psi-item.active { background: var(--surface3); color: var(--text); font-weight: 500; }
.psi-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.psi-del {
  background: none; border: none; color: var(--text3);
  font-size: 13px; padding: 2px 4px; cursor: pointer;
  opacity: 0; border-radius: 4px; transition: all var(--trans);
  line-height: 1;
}
.psi-item:hover .psi-del { opacity: 1; }
.psi-del:hover { background: var(--surface3); color: var(--red); }

/* ══════════════════════════════════════════════════
   FILES MODAL — file list items
   ══════════════════════════════════════════════════ */

.file-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface2);
  margin-bottom: 6px;
}
.file-list-item:last-child { margin-bottom: 0; }
.file-icon { font-size: 16px; flex-shrink: 0; }
.file-name { flex: 1; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-del-btn {
  background: none; border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text3);
  font-size: 11px; padding: 3px 8px; cursor: pointer;
  transition: all var(--trans);
}
.file-del-btn:hover { border-color: var(--red); color: var(--red); background: rgba(248,113,113,0.07); }
