/* =========================================================
   RaselAI — Chat + Cowork interface
   Warm, editorial, Claude‑inspired design system
   ========================================================= */

:root {
  --bg: #faf9f5;
  --sidebar: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #f5f4ee;
  --user-bubble: #efece3;
  --border: rgba(31, 30, 29, 0.12);
  --border-strong: rgba(31, 30, 29, 0.22);
  --text: #1f1e1d;
  --text-2: #3d3c39;
  --muted: #75736c;
  --faint: #a8a59c;
  --accent: #c6613f;
  --accent-hover: #b0522f;
  --accent-soft: rgba(198, 97, 63, 0.12);
  --ok: #3f7d4e;
  --ok-soft: rgba(63, 125, 78, 0.12);
  --danger: #b4412f;
  --code-bg: #f4f2ec;
  --code-head: #ebe8df;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 18px rgba(31,30,29,.06);
  --shadow-lg: 0 8px 40px rgba(31,30,29,.14);
  --radius: 14px;
  --font-sans: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif Bengali", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 272px;
  --panel-w: 400px;
  --content-w: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624; --sidebar: #1f1e1d; --surface: #30302e; --surface-2: #2b2b29;
    --user-bubble: #141413; --border: rgba(255,255,255,.09); --border-strong: rgba(255,255,255,.18);
    --text: #f2f0e8; --text-2: #dcd9cf; --muted: #a39f94; --faint: #78756d;
    --accent: #d97757; --accent-hover: #e48a6b; --accent-soft: rgba(217,119,87,.16);
    --ok: #6fbf82; --ok-soft: rgba(111,191,130,.14); --danger: #e0715f;
    --code-bg: #1d1d1b; --code-head: #252523;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.25);
    --shadow-lg: 0 8px 40px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624; --sidebar: #1f1e1d; --surface: #30302e; --surface-2: #2b2b29;
  --user-bubble: #141413; --border: rgba(255,255,255,.09); --border-strong: rgba(255,255,255,.18);
  --text: #f2f0e8; --text-2: #dcd9cf; --muted: #a39f94; --faint: #78756d;
  --accent: #d97757; --accent-hover: #e48a6b; --accent-soft: rgba(217,119,87,.16);
  --ok: #6fbf82; --ok-soft: rgba(111,191,130,.14); --danger: #e0715f;
  --code-bg: #1d1d1b; --code-head: #252523;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */
.app { display: flex; height: 100dvh; width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: margin-left .22s ease, transform .22s ease;
  z-index: 40;
}
.app.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 16px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; background: var(--accent-soft); }
.brand-name { font-family: var(--font-serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.sb-nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  font-size: 14px; color: var(--text-2); text-align: left; width: 100%;
  transition: background .12s;
}
.nav-item svg { width: 18px; height: 18px; color: var(--muted); }
.nav-item:hover { background: var(--border); }
.nav-item.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.nav-item.active svg { color: var(--accent); }
.nav-item.primary { color: var(--text); font-weight: 500; }
.nav-item.primary .plus {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; margin-left: -2px;
}
.nav-item.primary .plus svg { width: 15px; height: 15px; color: #fff; }
.nav-badge { margin-left: auto; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; }

.sb-search { margin: 6px 12px 4px; position: relative; }
.sb-search input {
  width: 100%; padding: 7px 10px 7px 32px; border-radius: 9px;
  border: 1px solid var(--border); background: transparent; font-size: 13.5px; outline: none;
}
.sb-search input:focus { border-color: var(--border-strong); background: var(--surface); }
.sb-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }

.sb-section-label { font-size: 12px; color: var(--muted); padding: 14px 20px 6px; font-weight: 500; }
.sb-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.sb-empty { font-size: 13px; color: var(--faint); padding: 6px 10px; }
.conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text-2);
  cursor: pointer; position: relative;
}
.conv-item:hover { background: var(--border); }
.conv-item.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.conv-item .ci-icon { width: 15px; height: 15px; color: var(--faint); }
.conv-item .ci-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .ci-actions { display: none; gap: 2px; }
.conv-item:hover .ci-actions, .conv-item.active .ci-actions { display: flex; }
.conv-item .ci-actions button { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.conv-item .ci-actions button:hover { background: var(--border-strong); color: var(--text); }
.conv-item .ci-actions svg { width: 14px; height: 14px; }

.sb-foot { border-top: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.hire-card {
  display: block; text-decoration: none; padding: 12px 13px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, transform .15s;
}
.hire-card:hover { border-color: var(--accent); }
.hire-card strong { display: block; font-size: 13.5px; font-weight: 600; }
.hire-card span { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--accent); margin-top: 2px; }
.hire-card span svg { width: 13px; height: 13px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--text); color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.sb-user .who { flex: 1; min-width: 0; }
.sb-user .who b { display: block; font-size: 13.5px; font-weight: 500; }
.sb-user .who small { font-size: 12px; color: var(--muted); }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar {
  height: 54px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  flex-shrink: 0;
}
.topbar .title {
  font-size: 14.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
  padding: 5px 8px; border-radius: 8px;
}
.topbar .spacer { flex: 1; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.mode-pill svg { width: 13px; height: 13px; }
.topbar .open-sb { display: none; }
.app.sidebar-collapsed .topbar .open-sb { display: inline-flex; }

.workspace { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

.scroller { flex: 1; overflow-y: auto; scroll-behavior: auto; }
.thread { max-width: var(--content-w); margin: 0 auto; padding: 18px 24px 40px; }

/* ---------- Welcome ---------- */
.welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px 12vh;
}
.welcome .greet {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-serif); font-weight: 400; font-size: clamp(30px, 4.4vw, 42px);
  letter-spacing: -.02em; color: var(--text); margin: 0 0 30px; text-align: center;
}
.welcome .greet .spark { width: 40px; height: 40px; color: var(--accent); }
.welcome .sub { color: var(--muted); font-size: 15px; margin: -18px 0 28px; text-align: center; max-width: 520px; }
.welcome .composer-wrap { width: 100%; max-width: 680px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; max-width: 680px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; font-size: 13.5px; color: var(--text-2);
  transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--surface); border-color: var(--border-strong); }
.chip svg { width: 16px; height: 16px; color: var(--muted); }

.cowork-intro {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  width: 100%; max-width: 680px; margin-top: 18px;
}
.cowork-intro .ci {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; background: var(--surface-2);
}
.cowork-intro .ci svg { width: 18px; height: 18px; color: var(--accent); margin-bottom: 6px; }
.cowork-intro .ci b { display: block; font-size: 13.5px; font-weight: 600; }
.cowork-intro .ci span { font-size: 12.5px; color: var(--muted); }

/* ---------- Messages ---------- */
.msg { margin: 0 0 26px; }
.msg.user { display: flex; justify-content: flex-end; }
.user-bubble {
  max-width: 85%;
  background: var(--user-bubble); border-radius: 18px;
  padding: 10px 16px; white-space: pre-wrap; word-wrap: break-word;
  font-size: 15.5px; line-height: 1.55;
}
.user-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.user-stack { display: flex; flex-direction: column; align-items: flex-end; max-width: 85%; }
.user-stack .user-bubble { max-width: 100%; }

.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 7px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; max-width: 240px;
}
.file-chip .fi {
  width: 26px; height: 26px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-chip .fi svg { width: 14px; height: 14px; }
.file-chip .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-chip .fs { color: var(--muted); font-size: 11.5px; }
.file-chip .x { margin-left: 2px; color: var(--muted); border-radius: 5px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.file-chip .x:hover { background: var(--border); color: var(--text); }
.file-chip .x svg { width: 12px; height: 12px; }

.msg.assistant { position: relative; }
.prose {
  font-family: var(--font-serif);
  font-size: 16.5px; line-height: 1.68; color: var(--text);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose p { margin: 0 0 14px; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-serif); font-weight: 600; line-height: 1.3; letter-spacing: -.01em;
  margin: 26px 0 10px;
}
.prose h1 { font-size: 1.5em; }
.prose h2 { font-size: 1.28em; }
.prose h3 { font-size: 1.1em; }
.prose h4 { font-size: 1em; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.5em; }
.prose li { margin: 5px 0; padding-left: 2px; }
.prose li::marker { color: var(--muted); }
.prose li > p { margin: 0 0 6px; }
.prose strong { font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.prose blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 16px; border-left: 3px solid var(--border-strong); color: var(--text-2);
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .84em;
  background: var(--code-bg); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px; color: var(--danger);
}
.prose table {
  border-collapse: collapse; width: 100%; margin: 0 0 16px;
  font-family: var(--font-sans); font-size: 14px; display: block; overflow-x: auto;
}
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; border-bottom: 1.5px solid var(--border-strong); white-space: nowrap; }
.prose img { max-width: 100%; border-radius: 10px; }

.code-block {
  margin: 0 0 16px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: var(--code-bg);
  font-family: var(--font-sans);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 14px; background: var(--code-head); font-size: 12px; color: var(--muted);
}
.code-head button {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted);
  padding: 4px 8px; border-radius: 6px;
}
.code-head button:hover { background: var(--border); color: var(--text); }
.code-head svg { width: 13px; height: 13px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code-block code { font-family: var(--font-mono); font-size: 13.2px; line-height: 1.6; background: none !important; padding: 0 !important; }

/* streaming caret + thinking */
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; height: 30px; }
.spark-anim { width: 26px; height: 26px; color: var(--accent); animation: spin-pulse 1.6s ease-in-out infinite; }
@keyframes spin-pulse {
  0% { transform: rotate(0) scale(.9); opacity: .75; }
  50% { transform: rotate(90deg) scale(1.08); opacity: 1; }
  100% { transform: rotate(180deg) scale(.9); opacity: .75; }
}
.msg-foot { display: flex; align-items: center; gap: 2px; margin-top: 10px; min-height: 30px; }
.msg-foot .spark-sm { width: 22px; height: 22px; color: var(--accent); margin-right: 6px; }
.msg-foot .spark-sm.live { animation: spin-pulse 1.6s ease-in-out infinite; }
.msg-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.msg.assistant:hover .msg-actions, .msg.assistant.last .msg-actions { opacity: 1; }
.msg-actions button {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.msg-actions button:hover { background: var(--border); color: var(--text); }
.msg-actions svg { width: 16px; height: 16px; }
.msg-actions button.on { color: var(--accent); }

.error-box {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.error-box b { color: var(--danger); }

/* ---------- Cowork in thread ---------- */
.cw-card {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  overflow: hidden; margin: 6px 0 14px; font-family: var(--font-sans);
}
.cw-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cw-head svg { width: 18px; height: 18px; color: var(--accent); }
.cw-head b { font-size: 14px; font-weight: 600; flex: 1; }
.cw-head small { font-size: 12.5px; color: var(--muted); }
.step { border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: 0; }
.step-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 14px; font-size: 14px;
}
.step-row:hover { background: var(--surface-2); }
.step-row .st { width: 20px; height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.step-row .st svg { width: 18px; height: 18px; }
.step-row .st .ring { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--faint); }
.step-row .st .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.step-row .st.done { color: var(--ok); }
.step-row .st.err { color: var(--danger); }
.step-row .stt { flex: 1; }
.step-row .stt small { display: block; color: var(--muted); font-size: 12.5px; }
.step-row .chev { width: 16px; height: 16px; color: var(--faint); transition: transform .15s; }
.step.open .chev { transform: rotate(90deg); }
.step-body {
  display: none; padding: 2px 16px 14px 44px;
  font-family: var(--font-sans); font-size: 14px; line-height: 1.6; color: var(--text-2);
}
.step.open .step-body { display: block; }
.step-body.prose { font-family: var(--font-sans); font-size: 14px; }
.step-body.prose h1, .step-body.prose h2, .step-body.prose h3 { font-family: var(--font-sans); font-size: 15px; margin: 12px 0 6px; }

.out-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  padding: 12px 14px; margin: 4px 0 14px; transition: border-color .15s, box-shadow .15s;
  font-family: var(--font-sans);
}
.out-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.out-card .oi {
  width: 42px; height: 50px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0;
}
.out-card .oi svg { width: 20px; height: 20px; }
.out-card .ot { flex: 1; min-width: 0; }
.out-card .ot b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.out-card .ot small { color: var(--muted); font-size: 12.5px; }
.out-card .oa { display: flex; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 15px; height: 15px; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-hover); }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }

/* ---------- Composer ---------- */
.composer-dock { padding: 0 20px 14px; flex-shrink: 0; }
.composer-wrap { max-width: var(--content-w); margin: 0 auto; padding: 0 4px; }
.composer {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow);
  padding: 12px 12px 10px 16px; transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.composer.drag { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.composer .attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px -4px; }
.composer .attachments:empty { display: none; }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; background: transparent;
  font-size: 16px; line-height: 1.5; max-height: 240px; min-height: 26px; padding: 2px 0;
}
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.composer-row .grow { flex: 1; }
.tool-btn {
  height: 32px; min-width: 32px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px;
}
.tool-btn:hover { background: var(--surface-2); color: var(--text); }
.tool-btn svg { width: 17px; height: 17px; }
.tool-btn.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }

.model-select { position: relative; }
.model-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 9px; border-radius: 9px;
  font-size: 13.5px; color: var(--text-2);
}
.model-btn:hover { background: var(--surface-2); }
.model-btn svg { width: 14px; height: 14px; color: var(--muted); }
.menu {
  position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none;
}
.menu.open { display: block; }
.menu button {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
}
.menu button:hover { background: var(--surface-2); }
.menu button b { display: block; font-size: 13.5px; font-weight: 500; }
.menu button small { display: block; font-size: 12px; color: var(--muted); }
.menu button .chk { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; visibility: hidden; }
.menu button.sel .chk { visibility: visible; }

.send-btn {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, opacity .15s;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: default; }
.send-btn svg { width: 18px; height: 18px; }
.send-btn.stop { background: var(--text); }
.send-btn.stop svg { width: 14px; height: 14px; }

.disclaimer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.site-footer { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.site-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.welcome .composer-wrap .disclaimer, .welcome .composer-wrap .site-footer { display: none; }
.welcome-foot { position: absolute; left: 0; right: 0; bottom: 12px; padding: 0 16px; pointer-events: none; }
.welcome-foot a { pointer-events: auto; }
@media (max-height: 640px) { .welcome-foot { position: static; padding-bottom: 10px; } }

.to-bottom {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 132px;
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); display: none; align-items: center; justify-content: center; color: var(--text-2); z-index: 5;
}
.to-bottom.show { display: inline-flex; }
.to-bottom svg { width: 17px; height: 17px; }

/* ---------- Right panel (Cowork) ---------- */
.panel {
  width: var(--panel-w); flex-shrink: 0; border-left: 1px solid var(--border);
  background: var(--sidebar); display: none; flex-direction: column; min-height: 0;
}
.app.panel-open .panel { display: flex; }
.panel-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 0 12px; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tab {
  padding: 7px 11px; border-radius: 8px; font-size: 13px; color: var(--muted); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); background: var(--border); }
.tab.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.tab .count { font-size: 11px; background: var(--border); border-radius: 999px; padding: 0 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px; }
.p-section { margin-bottom: 18px; }
.p-label { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 0 8px 2px; }
.p-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.p-empty { color: var(--faint); font-size: 13px; padding: 18px 6px; text-align: center; }
.p-title { font-family: var(--font-serif); font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.p-sum { color: var(--muted); font-size: 13px; margin: 0; }
.progress-bar { height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 12px 0 4px; }
.progress-bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .35s ease; }
.p-steps { list-style: none; margin: 0; padding: 0; }
.p-steps li { display: flex; gap: 10px; padding: 8px 2px; font-size: 13.5px; align-items: flex-start; }
.p-steps li .st { margin-top: 1px; }
.p-steps li.done .lbl { color: var(--muted); }
.p-steps li.running .lbl { font-weight: 600; }
.p-steps .st { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.p-steps .st svg { width: 17px; height: 17px; color: var(--ok); }
.p-steps .st .ring { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--faint); }
.p-steps .st .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: rot .8s linear infinite; }
.p-file { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 6px; font-size: 13px; }
.p-file .fi { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.p-file .fi svg { width: 15px; height: 15px; }
.p-file .fn { flex: 1; min-width: 0; }
.p-file .fn b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-file .fn small { color: var(--muted); font-size: 11.5px; }
.p-file .fa { display: flex; gap: 4px; }

.doc-view { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.doc-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-toolbar b { flex: 1; font-size: 13px; font-weight: 600; min-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-content { padding: 18px 20px; }
.doc-content.prose { font-size: 15px; }

/* ---------- Overlays / toast / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; display: none; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 45; box-shadow: var(--shadow-lg); max-width: 92vw; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.sidebar-collapsed .sidebar { margin-left: 0; }
  .app.sidebar-mobile-open .sidebar { transform: translateX(0); }
  .app.sidebar-mobile-open .scrim { display: block; }
  .topbar .open-sb { display: inline-flex !important; }
  .thread { padding: 12px 16px 30px; }
  .composer-dock { padding: 0 12px 10px; }
  .prose { font-size: 16px; }
  .user-bubble, .user-stack { max-width: 92%; }
  .cowork-intro { grid-template-columns: 1fr; }
  .welcome { padding-bottom: 6vh; }
  .out-card { flex-wrap: wrap; }
  .out-card .oa { width: 100%; }
  .to-bottom { bottom: 118px; }
}

/* highlight.js theme (warm, both modes) */
.hljs { color: var(--text); }
.hljs-comment, .hljs-quote { color: var(--faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: #a1458a; }
.hljs-string, .hljs-attr-value, .hljs-template-tag, .hljs-addition { color: #3f7d4e; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #b5651d; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: #2f5fa7; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: #8a5a00; }
.hljs-built_in, .hljs-class .hljs-title { color: #0f7c7c; }
.hljs-meta, .hljs-deletion { color: #b4412f; }
:root[data-theme="dark"] .hljs-keyword, :root[data-theme="dark"] .hljs-selector-tag, :root[data-theme="dark"] .hljs-literal, :root[data-theme="dark"] .hljs-type { color: #d58fc4; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-addition { color: #9fd08f; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-bullet { color: #e6a26a; }
:root[data-theme="dark"] .hljs-title, :root[data-theme="dark"] .hljs-section { color: #8fb3ec; }
:root[data-theme="dark"] .hljs-attr, :root[data-theme="dark"] .hljs-attribute, :root[data-theme="dark"] .hljs-variable, :root[data-theme="dark"] .hljs-property { color: #e3c37a; }
:root[data-theme="dark"] .hljs-built_in { color: #6fd0cf; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hljs-keyword, :root:not([data-theme="light"]) .hljs-literal, :root:not([data-theme="light"]) .hljs-type { color: #d58fc4; }
  :root:not([data-theme="light"]) .hljs-string { color: #9fd08f; }
  :root:not([data-theme="light"]) .hljs-number { color: #e6a26a; }
  :root:not([data-theme="light"]) .hljs-title, :root:not([data-theme="light"]) .hljs-section { color: #8fb3ec; }
  :root:not([data-theme="light"]) .hljs-attr, :root:not([data-theme="light"]) .hljs-variable, :root:not([data-theme="light"]) .hljs-property { color: #e3c37a; }
  :root:not([data-theme="light"]) .hljs-built_in { color: #6fd0cf; }
}

/* ---------- Modals: About / Bots / Plans ---------- */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(20,20,19,.45); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal-card { position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 26px 26px 22px; }
.modal-card.wide { max-width: 760px; }
.modal-card.xwide { max-width: 980px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.modal-title { margin: 2px 0 4px; font-family: var(--font-serif); font-size: 25px; font-weight: 600; letter-spacing: -.01em; }
.modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.about-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; padding-right: 30px; }
.about-avatar { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(135deg, #e5835c, #b2462a); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-serif); font-size: 22px; font-weight: 600; flex-shrink: 0; }
.about-kicker { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.about-head h2 { margin: 2px 0 2px; font-family: var(--font-serif); font-size: 23px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.about-head h2 span { color: var(--muted); font-weight: 400; }
.about-role { margin: 0; color: var(--muted); font-size: 13.5px; }
.about-bio { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.65; color: var(--text-2); margin: 0 0 16px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.about-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.about-box b { display: block; font-size: 13.5px; font-weight: 600; }
.about-box span { font-size: 12.5px; color: var(--muted); }
.about-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.about-links a { text-decoration: none; }
.about-ask { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; border-radius: 12px; border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13.5px; }
.about-ask:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.about-ask svg { width: 16px; height: 16px; color: var(--accent); }
.plan-link { font-size: 12px; color: var(--muted); text-align: left; }
.plan-link span { color: var(--accent); }
.plan-link:hover span { text-decoration: underline; }

/* mode menu + bot pill */
.menu-left { left: 0; right: auto; }
.menu button > svg:first-child { width: 17px; height: 17px; margin-top: 2px; color: var(--muted); }
.menu button.sel > svg:first-child { color: var(--accent); }
.mode-select .tool-btn svg:last-child { width: 13px; height: 13px; }
.bot-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 10px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; cursor: pointer; max-width: 190px; }
.bot-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-pill svg { width: 15px; height: 15px; }
.bot-pill button { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.bot-pill button:hover { background: var(--accent-soft); }
.bot-pill button svg { width: 12px; height: 12px; }

/* agent tool cards */
.tool-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 0 0 10px; overflow: hidden; font-family: var(--font-sans); }
.tool-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; }
.tool-row:hover { background: var(--surface-2); }
.tool-ic { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.tool-ic svg { width: 14px; height: 14px; }
.tool-ic .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: rot .8s linear infinite; }
.tool-t { flex: 1; min-width: 0; }
.tool-t b { display: block; font-size: 13.5px; font-weight: 500; }
.tool-t small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.tool-row .chev { width: 15px; height: 15px; color: var(--faint); transition: transform .15s; }
.tool-card.open .chev { transform: rotate(90deg); }
.tool-body { display: none; padding: 0 12px 12px 48px; }
.tool-card.open .tool-body { display: block; }
.tool-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
.tool-body pre { margin: 0; padding: 9px 11px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.agent-note { font-size: 15px; color: var(--text-2); margin-bottom: 8px; }
.thinking .spark-anim { display: inline-flex; }

/* bots */
.bot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
.bot-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; position: relative; transition: border-color .15s, background .15s; }
.bot-card:hover { border-color: var(--accent); background: var(--surface); }
.bot-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bot-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bot-ic svg { width: 17px; height: 17px; }
.bot-t { flex: 1; min-width: 0; padding-right: 18px; }
.bot-t b { display: block; font-size: 14px; font-weight: 600; }
.bot-t small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.bot-del { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.bot-del:hover { background: var(--border); color: var(--danger); }
.bot-del svg { width: 14px; height: 14px; }
.bot-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; }
.bot-form b { font-size: 14px; }
.bot-form input, .bot-form textarea { width: 100%; border: 1px solid var(--border-strong); background: var(--bg); border-radius: 10px; padding: 9px 12px; font-size: 14px; outline: none; resize: vertical; }
.bot-form input:focus, .bot-form textarea:focus { border-color: var(--accent); }
.bot-form .btn { align-self: flex-start; }

/* plans */
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.plan { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); }
.plan.hot { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-badge { position: absolute; top: -10px; right: 12px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.plan-name { font-size: 15px; font-weight: 600; }
.plan-price { font-family: var(--font-serif); font-size: 30px; font-weight: 600; margin: 6px 0 0; letter-spacing: -.02em; }
.plan-price small { font-family: var(--font-sans); font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan-note { color: var(--muted); font-size: 12.5px; margin: 2px 0 12px; min-height: 34px; }
.plan ul { list-style: none; margin: 0 0 14px; padding: 0; flex: 1; }
.plan li { display: flex; gap: 7px; font-size: 13px; padding: 4px 0; align-items: flex-start; }
.plan li svg { width: 15px; height: 15px; color: var(--ok); margin-top: 2px; }
.plan .btn { width: 100%; }
.plan .btn:disabled { opacity: .75; cursor: default; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .bot-grid, .about-grid, .plan-grid { grid-template-columns: 1fr; } .modal-card { padding: 22px 18px 18px; } .mode-select .tool-btn > span { display: none; } }

/* ---------- RaselAI brand identity (emerald) ---------- */
:root {
  --bg: #f6f8f7; --sidebar: #edf2f0; --surface: #ffffff; --surface-2: #f3f6f5;
  --user-bubble: #e2f1eb; --border: rgba(16,42,35,.11); --border-strong: rgba(16,42,35,.2);
  --text: #12201c; --text-2: #34443f; --muted: #66756f; --faint: #9aa8a2;
  --accent: #0f8a6c; --accent-hover: #0b735a; --accent-soft: rgba(15,138,108,.12);
  --ok: #0f8a6c; --code-bg: #f2f5f4; --code-head: #e6ece9;
  --font-display: "Plus Jakarta Sans", "Hind Siliguri", system-ui, sans-serif;
  --font-serif: "Inter", "Hind Siliguri", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513; --sidebar: #0b100f; --surface: #17201d; --surface-2: #131b18;
    --user-bubble: #1c2e27; --border: rgba(255,255,255,.08); --border-strong: rgba(255,255,255,.16);
    --text: #e8efec; --text-2: #c9d4d0; --muted: #8fa09a; --faint: #62716b;
    --accent: #2fc79c; --accent-hover: #4fd8b0; --accent-soft: rgba(47,199,156,.15);
    --ok: #2fc79c; --code-bg: #0c1210; --code-head: #121a17;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513; --sidebar: #0b100f; --surface: #17201d; --surface-2: #131b18;
  --user-bubble: #1c2e27; --border: rgba(255,255,255,.08); --border-strong: rgba(255,255,255,.16);
  --text: #e8efec; --text-2: #c9d4d0; --muted: #8fa09a; --faint: #62716b;
  --accent: #2fc79c; --accent-hover: #4fd8b0; --accent-soft: rgba(47,199,156,.15);
  --ok: #2fc79c; --code-bg: #0c1210; --code-head: #121a17;
}
.brand-name, .welcome .greet, .prose h1, .prose h2, .prose h3, .prose h4, .p-title, .modal-title, .about-head h2, .plan-price { font-family: var(--font-display); }
.brand-name { font-weight: 700; letter-spacing: -.02em; font-size: 20px; }
.welcome .greet { font-weight: 700; letter-spacing: -.035em; margin-bottom: 10px; }
.welcome .greet .spark { width: 46px; height: 46px; }
.welcome .sub { margin: 0 0 26px; }
.prose { font-size: 15.5px; line-height: 1.72; }
.prose h1, .prose h2, .prose h3 { font-weight: 700; letter-spacing: -.02em; }
.msg.assistant { padding-left: 42px; }
.msg.assistant::before { content: ""; position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px; background: url(logo.svg) center / cover no-repeat; }
.msg-foot .spark-sm:not(.live) { display: none; }
@keyframes spin-pulse { 0%, 100% { transform: scale(.9); opacity: .65; } 50% { transform: scale(1.06); opacity: 1; } }
.user-bubble { border-radius: 18px 18px 4px 18px; }
.composer { border-radius: 16px; }
.send-btn { border-radius: 50%; }
.nav-item.primary .plus { border-radius: 8px; }
.about-avatar { background: linear-gradient(135deg, #19b98d, #0b6e58); }
.hire-card { background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
@media (max-width: 820px) { .msg.assistant { padding-left: 0; } .msg.assistant::before { position: static; display: block; width: 24px; height: 24px; margin-bottom: 8px; } }
img.about-avatar { object-fit: cover; padding: 0; background: #0a1a3a; border: 2px solid var(--accent-soft); width: 64px; height: 64px; border-radius: 50%; }
/* logo v2 */
.msg.assistant::before { background-image: url(raselai-logo-v2.svg); }
.welcome .greet .spark, .spark-sm, .spark-anim { background: url(raselai-logo-v2.svg) center / contain no-repeat; }
.welcome .greet .spark svg, .spark-sm svg, .spark-anim svg { visibility: hidden; }
/* fonts v2: Sora (display) + Manrope (text) */
:root { --font-display: "Sora", "Hind Siliguri", system-ui, sans-serif; --font-sans: "Manrope", "Hind Siliguri", system-ui, sans-serif; --font-serif: "Manrope", "Hind Siliguri", system-ui, sans-serif; }
.brand-name { font-weight: 700; letter-spacing: -.03em; }
.welcome .greet { font-weight: 600; letter-spacing: -.045em; }
.prose { font-size: 15.5px; line-height: 1.75; }
.prose strong, .prose b { font-weight: 700; }