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

:root {
  color-scheme: dark;
  --bg:         #0a0d18;
  --surface:    rgba(19, 24, 42, .82);
  --surface-sd: #131a2e;
  --surface-2:  rgba(255,255,255,.03);
  --border:     rgba(148, 163, 184, .14);
  --border-lt:  rgba(148, 163, 184, .08);
  --primary:    #818cf8;
  --primary-h:  #a5b0ff;
  --primary-lt: rgba(129, 140, 248, .14);
  --grad:       linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --grad-soft:  linear-gradient(135deg, rgba(99,102,241,.22), rgba(168,85,247,.18));
  --text:       #e7ecf5;
  --muted:      #8b96ad;
  --danger:     #f87171;
  --danger-bg:  rgba(248, 113, 113, .12);
  --cag-bg:     rgba(52, 211, 153, .14);
  --cag-txt:    #34d399;
  --rag-bg:     rgba(251, 191, 36, .13);
  --rag-txt:    #fbbf24;
  --r:          12px;
  --shadow:     0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.5);
  --glow:       0 0 0 1px rgba(129,140,248,.25), 0 4px 20px -4px rgba(99,102,241,.5);
  --panel-w:    380px;
}

html, body {
  height: 100%;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient animated background ── */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .45;
  will-change: transform;
}
.orb-1 {
  width: 520px; height: 520px; top: -180px; left: -120px;
  background: radial-gradient(circle, rgba(99,102,241,.55), transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.orb-2 {
  width: 460px; height: 460px; bottom: -160px; right: -100px;
  background: radial-gradient(circle, rgba(168,85,247,.45), transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.orb-3 {
  width: 380px; height: 380px; top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(56,189,248,.28), transparent 70%);
  animation: drift3 38s ease-in-out infinite alternate;
}
@keyframes drift1 { from { transform: translate(0,0) scale(1); }   to { transform: translate(120px, 80px) scale(1.15); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1.1); } to { transform: translate(-140px, -90px) scale(.95); } }
@keyframes drift3 { from { transform: translate(0,0); }            to { transform: translate(-160px, 100px); } }

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

/* ── Layout ── */
.app  { display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 1; }
.main { display: flex; flex: 1; overflow: hidden; position: relative; }

/* ── Header ── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  z-index: 10; flex-shrink: 0;
  position: relative;
}
header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129,140,248,.6), rgba(168,85,247,.5), transparent);
  background-size: 200% 100%;
  animation: headerGlow 8s linear infinite;
}
@keyframes headerGlow { from { background-position: 0% 0; } to { background-position: 200% 0; } }

.header-left { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 20px; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad); border-radius: 12px;
  box-shadow: 0 4px 18px -2px rgba(124, 92, 246, .55);
  animation: logoPulse 4s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 4px 18px -2px rgba(124, 92, 246, .55); }
  50%      { box-shadow: 0 4px 26px 2px rgba(124, 92, 246, .75); }
}
header h1 {
  font-size: 17px; font-weight: 700; letter-spacing: -.3px;
  background: linear-gradient(90deg, #fff 20%, #c7d2fe 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent; transition: transform .2s ease;
}
.badge:hover     { transform: translateY(-1px); }
.badge-purple    { background: var(--primary-lt); color: var(--primary-h); border-color: rgba(129,140,248,.25); }
.badge-blue      { background: rgba(56,189,248,.12); color: #7dd3fc; border-color: rgba(56,189,248,.2); }
.badge-green     { background: var(--cag-bg); color: var(--cag-txt); border-color: rgba(52,211,153,.22); }
.badge-amber     { background: var(--rag-bg); color: var(--rag-txt); border-color: rgba(251,191,36,.22); }

/* ── Panel toggle strip ── */
.panel-toggle {
  width: 16px; flex-shrink: 0;
  background: rgba(148,163,184,.06); border: none; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 700;
  align-self: stretch; transition: background .2s, color .2s;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
}
.panel-toggle:hover { background: var(--primary-lt); color: var(--primary-h); }

/* ── Document Panel ── */
.doc-panel {
  width: var(--panel-w); min-width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width .3s cubic-bezier(.4,0,.2,1), min-width .3s cubic-bezier(.4,0,.2,1);
}
.doc-panel.collapsed { width: 0; min-width: 0; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-lt);
  background: var(--surface-2);
  flex-shrink: 0; gap: 8px;
}
.panel-head h2 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; flex: 1; }
.panel-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-secondary {
  background: rgba(148,163,184,.08); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 6px 11px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .2s ease;
}
.btn-secondary:hover {
  background: rgba(148,163,184,.16);
  border-color: rgba(148,163,184,.3);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }

.drop-zone {
  margin: 12px 12px 6px;
  border: 1.5px dashed rgba(148,163,184,.3);
  border-radius: var(--r);
  padding: 13px 14px;
  text-align: center; font-size: 12px; color: var(--muted);
  cursor: pointer; flex-shrink: 0;
  transition: all .25s ease;
  background: var(--surface-2);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-lt);
  color: var(--primary-h);
  box-shadow: inset 0 0 24px rgba(99,102,241,.08), 0 0 0 4px rgba(99,102,241,.08);
}
.drop-zone.drag-over { animation: dropPulse 1s ease-in-out infinite; }
@keyframes dropPulse {
  0%, 100% { box-shadow: inset 0 0 24px rgba(99,102,241,.08), 0 0 0 3px rgba(99,102,241,.12); }
  50%      { box-shadow: inset 0 0 32px rgba(99,102,241,.16), 0 0 0 6px rgba(99,102,241,.06); }
}

.doc-list { flex: 1; overflow-y: auto; padding: 8px; }
.doc-list::-webkit-scrollbar,
.messages::-webkit-scrollbar { width: 6px; }
.doc-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb { background: rgba(148,163,184,.2); border-radius: 3px; }
.doc-list::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.35); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 50px 20px; line-height: 1.7; }

/* ── Folder sections ── */
.folder-section { margin-bottom: 6px; }

.folder-header {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: 9px;
  cursor: pointer; user-select: none;
  transition: background .18s;
}
.folder-header:hover { background: rgba(148,163,184,.07); }

.folder-toggle { font-size: 10px; color: var(--muted); width: 12px; flex-shrink: 0; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.folder-section.collapsed .folder-toggle { transform: rotate(-90deg); }

.folder-icon  { font-size: 15px; flex-shrink: 0; }
.folder-name  { font-size: 13px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-count {
  font-size: 10px; font-weight: 600; color: var(--muted); flex-shrink: 0;
  background: rgba(148,163,184,.1); padding: 1px 7px; border-radius: 10px;
}

.folder-chk { accent-color: #6366f1; width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.folder-del-btn {
  background: none; border: none; color: var(--muted); font-size: 13px;
  cursor: pointer; padding: 2px 5px; border-radius: 5px;
  opacity: 0; transition: all .18s; flex-shrink: 0;
}
.folder-header:hover .folder-del-btn { opacity: .7; }
.folder-del-btn:hover { background: var(--danger-bg); color: var(--danger); opacity: 1 !important; }

.folder-docs { padding-left: 10px; }
.folder-section.collapsed .folder-docs { display: none; }

/* ── Doc Cards ── */
.doc-card {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 10px; border-radius: var(--r);
  border: 1px solid transparent; cursor: pointer;
  transition: all .2s ease; margin-bottom: 4px; position: relative;
}
.doc-card:hover {
  background: rgba(148,163,184,.06);
  border-color: var(--border);
  transform: translateX(2px);
}
.doc-card.selected {
  background: var(--primary-lt);
  border-color: rgba(129,140,248,.4);
  box-shadow: inset 2px 0 0 var(--primary), 0 2px 12px -4px rgba(99,102,241,.35);
}
.doc-card .chk { margin-top: 2px; accent-color: #6366f1; width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.doc-icon      { font-size: 19px; flex-shrink: 0; }
.doc-body      { flex: 1; min-width: 0; }
.doc-name      { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.doc-tags      { display: flex; flex-wrap: wrap; gap: 3px; }
.tag { padding: 1.5px 7px; border-radius: 20px; font-size: 10px; font-weight: 500; }
.tag-type  { background: rgba(56,189,248,.12); color: #7dd3fc; }
.tag-grey  { background: rgba(148,163,184,.1); color: var(--muted); }
.tag-cag   { background: var(--cag-bg); color: var(--cag-txt); }
.tag-rag   { background: var(--rag-bg); color: var(--rag-txt); }
.doc-date  { font-size: 10px; color: var(--muted); margin-top: 4px; opacity: .8; }

.doc-actions { display: flex; gap: 2px; flex-shrink: 0; }
.btn-move, .btn-del {
  background: none; border: none; font-size: 14px;
  cursor: pointer; padding: 2px 5px; border-radius: 5px;
  opacity: 0; transition: all .18s;
}
.doc-card:hover .btn-move,
.doc-card:hover .btn-del { opacity: .7; }
.btn-move { color: var(--muted); }
.btn-move:hover { background: var(--primary-lt); color: var(--primary-h); opacity: 1 !important; }
.btn-del  { color: var(--muted); }
.btn-del:hover  { background: var(--danger-bg); color: var(--danger); opacity: 1 !important; }

/* ── Folder picker dropdown ── */
.folder-picker {
  position: fixed; z-index: 100;
  background: var(--surface-sd);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  min-width: 170px; overflow: hidden;
  animation: pickerIn .18s cubic-bezier(.34,1.4,.64,1);
}
@keyframes pickerIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.folder-picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; font-size: 13px; cursor: pointer;
  transition: background .12s;
}
.folder-picker-item:hover  { background: var(--primary-lt); }
.folder-picker-item.active { color: var(--primary-h); }
.folder-picker-item.unassign { color: var(--muted); font-style: italic; }
.folder-picker-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* ── Selection Summary ── */
.sel-summary {
  border-top: 1px solid var(--border);
  padding: 13px 14px;
  background: var(--surface-2);
  flex-shrink: 0;
  animation: slideUp .3s cubic-bezier(.34,1.3,.64,1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sel-row   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.sel-chars { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bar       { height: 5px; background: rgba(148,163,184,.12); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar-fill  {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7, #8b5cf6, #6366f1);
  background-size: 200% 100%;
  animation: barShimmer 3s linear infinite;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}
@keyframes barShimmer { from { background-position: 0% 0; } to { background-position: 200% 0; } }
.bar-fill.over { background: linear-gradient(90deg, #f59e0b, #f87171, #f59e0b); background-size: 200% 100%; }
.btn-clear { background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all .15s; }
.btn-clear:hover { background: rgba(148,163,184,.12); color: var(--text); }

/* ── Buttons ── */
.btn-primary {
  background: var(--grad);
  color: #fff;
  border: none; border-radius: 9px;
  padding: 7px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s ease;
  box-shadow: 0 2px 12px -2px rgba(99,102,241,.5);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px -2px rgba(99,102,241,.7);
  filter: brightness(1.1);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 18, .65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-sd);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px; width: 330px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(129,140,248,.08);
  animation: modalIn .3s cubic-bezier(.34,1.3,.64,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; outline: none; font-family: inherit;
  background: rgba(148,163,184,.06); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
  margin-bottom: 14px;
}
.modal-input::placeholder { color: rgba(139,150,173,.6); }
.modal-input:focus {
  border-color: var(--primary);
  background: rgba(148,163,184,.03);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.modal-wide  { width: 460px; max-width: 92vw; }
.modal-desc  { font-size: 12.5px; color: var(--muted); margin: -6px 0 16px; line-height: 1.5; }
.field-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field-opt   { font-weight: 400; opacity: .55; }
.llm-status  { font-size: 12px; margin-left: 6px; }
.llm-status.ok  { color: var(--cag-txt); }
.llm-status.err { color: var(--danger); }
select.modal-input { appearance: auto; background: var(--surface-sd); }
select.modal-input option { background: var(--surface-sd); color: var(--text); }

/* ── Chat Panel ── */
.chat-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  padding: 10px 18px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-lt);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 46px;
}
.ctx-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.ctx-doc {
  font-size: 11px; padding: 3px 10px;
  background: var(--primary-lt); color: var(--primary-h);
  border: 1px solid rgba(129,140,248,.2);
  border-radius: 12px; max-width: 170px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: chipIn .25s cubic-bezier(.34,1.4,.64,1);
}
@keyframes chipIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.ctx-empty { font-size: 13px; color: var(--muted); font-style: italic; }

.model-bar {
  display: flex; align-items: center;
  padding: 7px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-lt);
  font-size: 12px; color: var(--muted);
}

/* ── Messages ── */
.messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}

.welcome { text-align: center; margin: auto; color: var(--muted); animation: welcomeIn .6s cubic-bezier(.34,1.2,.64,1); }
@keyframes welcomeIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.welcome-icon {
  font-size: 40px; width: 88px; height: 88px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-soft);
  border: 1px solid rgba(129,140,248,.25);
  border-radius: 26px;
  box-shadow: 0 8px 40px -8px rgba(124,92,246,.45);
  animation: floaty 4.5s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.welcome h3 { font-size: 17px; margin-bottom: 6px; color: var(--text); font-weight: 700; }
.welcome p  { font-size: 13px; }

.msg      { display: flex; flex-direction: column; max-width: 82%; }
.msg.anim { animation: msgIn .35s cubic-bezier(.34,1.2,.64,1); }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.msg-user { align-self: flex-end; }
.msg-ai   { align-self: flex-start; }

.msg-meta   { margin-bottom: 5px; display: flex; gap: 6px; align-items: center; }
.msg-method { font-size: 10px; font-weight: 700; padding: 2.5px 9px; border-radius: 12px; letter-spacing: .4px; }
.msg-method.cag { background: var(--cag-bg); color: var(--cag-txt); border: 1px solid rgba(52,211,153,.25); }
.msg-method.rag { background: var(--rag-bg); color: var(--rag-txt); border: 1px solid rgba(251,191,36,.25); }

.bubble {
  padding: 13px 17px; border-radius: 18px;
  font-size: 14px; line-height: 1.7;
}
.msg-user .bubble {
  background: var(--grad);
  color: #fff; border-bottom-right-radius: 5px;
  white-space: pre-wrap;
  box-shadow: 0 4px 20px -6px rgba(99,102,241,.55);
}
.msg-ai .bubble {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  box-shadow: var(--shadow);
}

/* ── Markdown inside AI bubbles ── */
.bubble h1, .bubble h2, .bubble h3 { margin: 12px 0 6px; line-height: 1.3; color: var(--text); }
.bubble h1 { font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.bubble h2 { font-size: 15px; font-weight: 700; }
.bubble h3 { font-size: 14px; font-weight: 600; }
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }
.bubble p  { margin: 4px 0; }
.bubble p:first-child { margin-top: 0; }
.bubble strong { font-weight: 700; color: #fff; }
.msg-ai .bubble strong { color: #f1f5ff; }
.bubble em { font-style: italic; }
.bubble code {
  background: rgba(129,140,248,.12); border: 1px solid rgba(129,140,248,.18);
  border-radius: 5px; padding: 1px 6px;
  font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace; font-size: 12.5px;
  color: #c7d2fe;
}
.bubble pre {
  background: rgba(5,8,18,.6); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 15px; margin: 8px 0; overflow-x: auto;
}
.bubble pre code { background: none; border: none; padding: 0; color: #dbe3f5; }
.bubble ul, .bubble ol { margin: 6px 0 6px 18px; }
.bubble li { margin: 3px 0; }
.bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.bubble br { display: block; content: ''; margin: 2px 0; }

/* typing */
.typing .bubble { display: flex; gap: 6px; align-items: center; padding: 16px 18px; }
.typing .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad);
  animation: bounce 1.2s infinite;
}
.typing .dot:nth-child(2) { animation-delay: .18s; }
.typing .dot:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-6px); opacity: 1; } }

/* Rating */
.rating-row   { display: flex; align-items: center; gap: 4px; margin-top: 7px; }
.rating-label { font-size: 11px; color: var(--muted); }
.star {
  background: none; border: none; font-size: 17px; cursor: pointer;
  color: rgba(148,163,184,.3); padding: 0 1px;
  transition: color .15s, transform .15s cubic-bezier(.34,2,.64,1);
}
.star:hover { transform: scale(1.25); }
.star.lit, .star:hover { color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,.5); }

/* ── Input ── */
.input-area {
  padding: 14px 18px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.input-row { display: flex; gap: 10px; align-items: flex-end; }

textarea.prompt {
  flex: 1; border: 1.5px solid var(--border); border-radius: 14px;
  padding: 11px 15px; font-size: 14px; font-family: inherit;
  resize: none; outline: none; line-height: 1.5;
  background: rgba(148,163,184,.06); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
  max-height: 160px;
}
textarea.prompt::placeholder { color: rgba(139,150,173,.6); }
textarea.prompt:focus {
  border-color: var(--primary);
  background: rgba(148,163,184,.03);
  box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
textarea.prompt:disabled { opacity: .45; cursor: not-allowed; }

.btn-send {
  background: var(--grad); color: #fff;
  border: none; border-radius: 14px;
  width: 46px; height: 46px;
  font-size: 19px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
  box-shadow: 0 4px 16px -4px rgba(99,102,241,.6);
}
.btn-send:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px -4px rgba(99,102,241,.8);
  filter: brightness(1.12);
}
.btn-send:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn-send:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.input-hint { display: flex; justify-content: space-between; margin-top: 7px; font-size: 11px; color: var(--muted); }
.session-id { font-family: 'Fira Code', monospace; opacity: .55; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--surface-sd); color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid #6366f1;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  z-index: 999; opacity: 0; transform: translateY(16px) scale(.96);
  transition: all .3s cubic-bezier(.34,1.3,.64,1);
  pointer-events: none;
  max-width: 380px;
}
.toast.show  { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-left-color: var(--danger); background: #1f1220; }

.uploading-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-lt); color: var(--primary-h);
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --panel-w: 300px; }
  .header-badges .badge-blue, .header-badges .badge-green, .header-badges .badge-amber { display: none; }
}
