:root {
  --bg-deep: #03040a;
  --blue: #8b6bff;
  --blue-deep: #6b46ff;
  --purple: #b088ff;
  --purple-deep: #8b6bff;
  --magenta: #d858e0;
  --chat-bg: #0a0d18;
  --rail-bg: #1a1030;
  --panel-bg: #1a1030;
  --chat-input-bg: #131829;
  --user-bubble-bg: #0d1020;
  --chat-column-width: 912px;
  --chat-font-size: 14.5px;
  --font-chat: 'Plus Jakarta Sans', system-ui, sans-serif;
  --cyan: #22d3ee;
  --gradient: linear-gradient(135deg, #8b6bff 0%, #d858e0 100%);

  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(151, 116, 255, 0.16);
  --dropdown-bg: rgba(10, 13, 24, 0.96);

  --text: #e9e8f2;
  --text-muted: #9aa0bd;
  --text-faint: #5b6080;

  --like: #35d08a;
  --dislike: #fb7185;
  --danger: #f43f5e;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { scrollbar-width: thin; scrollbar-color: rgba(167, 139, 250, 0.45) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.45); border-radius: var(--radius-pill); }
*::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, 0.75); }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  overflow: hidden;
}

button, textarea, input { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: var(--radius-sm); }
.hidden { display: none !important; }
[lang="hi"], [lang="bn"] { font-family: 'Noto Sans Devanagari', 'Noto Sans Bengali', var(--font-body); }

/* --- Animated hazy background: slow drifting, color-shifting nebula glow behind frosted glass --- */
.bg-glow { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; animation: hue-drift 55s ease-in-out infinite; }
.orb { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.38; }
.orb-a { width: 28vw; height: 28vw; top: -8%; left: -6%; background: radial-gradient(circle, var(--blue) 0%, transparent 65%); opacity: 0.28; animation: drift-a 34s ease-in-out infinite; }
.orb-b { width: 36vw; height: 36vw; top: 28%; right: -12%; background: radial-gradient(circle, var(--purple) 0%, transparent 70%); animation: drift-b 40s ease-in-out infinite; }
.orb-c { width: 32vw; height: 32vw; bottom: -14%; left: 22%; background: radial-gradient(circle, var(--purple-deep) 0%, transparent 70%); animation: drift-c 46s ease-in-out infinite; }
@keyframes drift-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vw, 4vh) scale(1.12); } }
@keyframes drift-b { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-5vw, 6vh) scale(0.92); } }
@keyframes drift-c { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(4vw, -5vh) scale(1.08); } }
@keyframes hue-drift {
  0%, 100% { filter: hue-rotate(-10deg) brightness(0.8); }
  50% { filter: hue-rotate(16deg) brightness(0.72); }
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.8rem;
  letter-spacing: -0.01em;
  margin: 0;
  background: linear-gradient(135deg, #fff, var(--blue) 60%, var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wordmark-small { font-size: 1.15rem; }
.wordmark-row { display: flex; align-items: center; gap: 0.5rem; }
.wordmark-logo { height: 34px; width: auto; display: block; }
.wordmark-logo-small { height: 22px; }

.glass-panel, .glass-panel-flat {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
}
.glass-panel-flat { border-width: 0 0 1px 0; }
.glass-card {
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 44px rgba(0, 0, 0, 0.45);
}

/* --- Homepage: split layout, content left, login right, founder section below --- */
.login-screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 3rem 6vw;
  overflow-y: auto;
}
.login-top-row { display: flex; align-items: center; justify-content: center; gap: 4vw; width: 100%; max-width: 1100px; }
.hero-content { max-width: 540px; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 1rem 0 0.75rem;
}
.hero-sub { color: var(--text-muted); margin: 0 0 1rem; font-size: 0.95rem; }
.hero-lang { color: var(--cyan); font-size: 1.15rem; font-weight: 600; margin: 0 0 1.5rem; text-shadow: 0 0 24px rgba(34, 211, 238, 0.35); }

.hero-highlight { margin: 0 0 1.5rem; }
.hero-highlight-cursive {
  display: block;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-highlight-rest { display: block; color: var(--text-muted); font-size: 0.95rem; margin-top: 0.25rem; }

/* Visually hidden but available to screen readers -- the marquee below is decorative/aria-hidden */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Marquee: "Why Mayazoo" now scrolls slowly near the bottom instead of a static section --- */
.marquee-wrap {
  position: fixed;
  bottom: 14px;
  left: 0;
  width: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee-scroll 70s linear infinite; }
.marquee-text { white-space: nowrap; font-size: 0.78rem; color: var(--text-faint); padding-right: 3rem; }
@keyframes marquee-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.login-side { flex-shrink: 0; }
.login-card {
  max-width: 320px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 2.4rem 2rem;
  border-color: rgba(167, 139, 250, 0.32);
  box-shadow: 0 0 70px rgba(56, 189, 248, 0.16), 0 10px 50px rgba(0, 0, 0, 0.5);
}
.login-card-eyebrow { margin: 0; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.login-status { min-height: 1.2em; font-size: 0.8rem; color: var(--text-faint); margin: 0; }
.version-tag { font-size: 0.68rem; color: var(--text-faint); margin: 0; opacity: 0.6; text-align: center; }

/* --- Founder section --- */
.founder-section { display: flex; align-items: center; gap: 1.3rem; max-width: 1100px; width: 100%; }
.founder-photo-frame {
  width: 108px;
  height: 108px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--glass-border), 0 8px 30px rgba(0, 0, 0, 0.45);
  animation: founder-morph 16s ease-in-out infinite;
}
.founder-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  display: block;
  transform: scale(1.3);
  transform-origin: 50% 18%;
}
@keyframes founder-morph {
  0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
  25% { border-radius: 58% 42% 38% 62% / 45% 55% 48% 52%; }
  50% { border-radius: 40% 60% 55% 45% / 60% 40% 58% 42%; }
  75% { border-radius: 50% 50% 42% 58% / 38% 62% 45% 55%; }
}
.founder-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0; }
.founder-title { color: var(--text-muted); font-size: 0.85rem; margin: 0.15rem 0 0; }
.founder-org { color: var(--cyan); font-size: 0.78rem; margin: 0.1rem 0 0.4rem; }
.founder-creds { color: var(--text-faint); font-size: 0.76rem; margin: 0; line-height: 1.5; }

@media (max-width: 900px) {
  .login-top-row { flex-direction: column; }
  .founder-section { flex-direction: column; text-align: center; }
}

/* --- Buttons --- */
.btn { border-radius: var(--radius-pill); border: none; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--glass-border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-google {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; justify-content: center;
  padding: 0.85rem 1.3rem;
  font-size: 0.95rem;
  animation: cta-glow 2.8s ease-in-out infinite;
}
@keyframes cta-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25); }
  50% { box-shadow: 0 0 0 7px rgba(56, 189, 248, 0.13), 0 4px 30px rgba(124, 58, 237, 0.45); }
}
.btn-block { width: 100%; margin-bottom: 0.65rem; }

.icon-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.95rem; width: 28px; height: 28px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--glass-strong); color: var(--text); }

.tool-link { background: transparent; border: none; color: var(--text-muted); font-size: 0.78rem; font-weight: 500; cursor: pointer; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); }
.tool-link:hover { color: var(--text); background: var(--glass); }
.tool-link-danger { color: var(--dislike); }
.tool-link-danger:hover { color: var(--danger); background: rgba(244, 63, 94, 0.1); }

/* --- App shell --- */
.app-shell { position: relative; z-index: 1; display: flex; height: 100vh; flex-direction: row; background: var(--chat-bg); }
@media (max-width: 768px) { .app-shell { flex-direction: column; } }

/* =========================================================
   SIDEBAR -- rebuilt to match the mockup exactly. Real IDs
   (window-list, box-floating-popover, rail-*-btn, etc.) are
   kept so app.js's existing logic works unchanged; only the
   visual layer is new.
   ========================================================= */
.sidebar {
  width: 258px; flex-shrink: 0; position: relative;
  transition: width 0.2s ease;
  background: #0f1322;
  border-right: 1px solid var(--glass-border);
}
.sidebar.collapsed { width: 76px; }
@media (max-width: 768px) {
  .sidebar { width: 100%; max-height: 50vh; }
  .sidebar.collapsed { width: 100%; max-height: 0; display: none; }
}
.sidebar-expand-btn { display: none !important; }

.sidebar-rail {
  width: 258px; height: 100%;
  display: flex; flex-direction: column;
  padding: 12px 10px; gap: 2px;
  overflow: hidden;
  transition: width 0.2s ease;
}
.sidebar.collapsed .sidebar-rail { width: 76px; }

.sidebar-rail svg { width: 17px; height: 17px; flex-shrink: 0; }
.rail-logo-img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }

.sidebar-top-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 9px; overflow: hidden; cursor: pointer; }
.sidebar-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: #fff; white-space: nowrap; }

.rail-icon-btn {
  width: 34px; height: 34px; border-radius: 10px; background: transparent; border: none;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background .15s ease, color .15s ease;
}
.rail-icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.rail-icon-btn.active { color: var(--text); }
.rail-spacer { flex: 1; min-height: 4px; }

/* Cluster boxes: admin-managed super-project sections (ICSE, exams, etc.) -- UI only for now */
.collapsed-star-btn { display: none; color: var(--magenta); }
.cluster-list { display: flex; flex-direction: column; gap: 5px; padding: 0 2px; margin-bottom: 2px; flex-shrink: 0; }
.cluster-box {
  border: 1px solid rgba(139, 107, 255, 0.4);
  background: linear-gradient(135deg, rgba(139,107,255,.10), rgba(216,88,224,.06));
  border-radius: 10px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--text);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.cluster-box:hover { border-color: var(--purple); background: linear-gradient(135deg, rgba(139,107,255,.18), rgba(216,88,224,.10)); }
.cluster-box .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); flex-shrink: 0; }
.cluster-more { font-size: 11.5px; color: var(--text-faint); font-weight: 600; padding: 2px 8px 6px; cursor: pointer; flex-shrink: 0; }
.cluster-more:hover { color: var(--text-muted); }

/* Section header row: icon + label, used for Boxes / Documents accordions */
.sidebar-section-header {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 10px; border-radius: 9px; cursor: pointer;
  background: transparent; border: none; color: var(--text); font-weight: 600; font-size: 13.5px;
  text-align: left; height: auto;
}
.sidebar-section-header:hover { background: rgba(255, 255, 255, 0.06); }
.sidebar-section-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The box/docs panel: inline, always visible when expanded, stretches to fill the sidebar */
.rail-box-trigger { position: static; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sidebar:not(.collapsed) #rail-boxes-btn { display: none; }
.box-floating-popover {
  display: none;
  position: static; width: 100%; max-height: none;
  background: transparent; border-radius: 0; box-shadow: none;
  padding: 2px 4px 6px 4px;
  flex-direction: column; gap: 6px; min-height: 0;
}
.box-floating-popover.pinned-open { display: flex; }
#box-floating-popover.pinned-open { flex: 1; }

.select-all-row { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.checkbox-wrap { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; color: var(--text-muted); opacity: 0; transition: opacity .12s ease; }
.window-row:hover .checkbox-wrap, .checkbox-wrap.is-checked { opacity: 1; }
.checkbox-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-box { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.06); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.checkbox-wrap input:checked + .checkbox-box { background: var(--purple); border-color: transparent; }
.checkbox-wrap input:checked + .checkbox-box::after { content: '\2713'; color: #fff; font-size: 9px; line-height: 1; }

/* Delete/select UI hidden here for now -- will live inside the box window later, not the sidebar */
#select-all-row, .window-delete-btn, .checkbox-wrap { display: none !important; }

.window-list {
  overflow-y: auto; display: flex; flex-direction: column; gap: 1px; min-height: 50px; flex: 1;
}
.box-group { margin-top: 3px; padding-bottom: 4px; border-bottom: 1px solid var(--glass-border); }
.box-group:last-child { border-bottom: none; }
.box-header { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px; gap: 6px; }
.box-header-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; background: transparent; border: none; cursor: pointer; text-align: left; padding: 2px 0; color: var(--text); font-weight: 600; font-size: 13px; }
.box-header-name:hover { color: var(--purple-deep); }
.box-header-icon { display: inline-flex; flex-shrink: 0; color: var(--purple); }
.box-header-icon svg { width: 13px; height: 13px; }
.box-header-add { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; flex-shrink: 0; }
.box-header-add:hover { color: var(--text); }

.new-chat-fab-float {
  position: absolute; top: 72px; left: 18px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(139, 107, 255, .4);
  transition: transform .15s ease, filter .15s ease;
}
.new-chat-fab-float svg { width: 15px; height: 15px; }
.new-chat-fab-float:hover { filter: brightness(1.1); transform: scale(1.06); }

.window-row { display: flex; align-items: center; gap: 6px; border-radius: 8px; padding-left: 2px; }
.window-row::before { content: '\2192'; color: var(--text-faint); font-size: 11px; margin-right: 1px; }
.window-row:hover { background: rgba(255, 255, 255, 0.05); }
.window-row.active { background: rgba(139, 107, 255, 0.14); }
.window-item { flex: 1; text-align: left; background: transparent; border: none; color: var(--text-muted); padding: 6px 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.window-row.active .window-item { color: var(--text); font-weight: 600; }
.window-row:hover .window-item { color: var(--text); }
.window-delete-btn { background: transparent; border: none; color: var(--text-faint); cursor: pointer; padding: 5px 8px; font-size: 13px; opacity: 0; transition: opacity .12s ease; }
.window-row:hover .window-delete-btn { opacity: 1; }
.window-delete-btn:hover { color: var(--danger); }

.panel-hover-add { opacity: .6; transition: opacity .12s ease; color: var(--text-muted); font-size: 12.5px; }
.panel-hover-add:hover { opacity: 1; }

.hint-note { color: var(--text-faint); font-size: 13px; padding: 0 .5rem; }

.panel-view-title { margin: 0; font-weight: 600; font-family: var(--font-display); font-size: .95rem; color: var(--text); }

.radio-widget {
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 9px 10px; margin: 2px 0 4px; flex-shrink: 0;
  position: relative;
}
.sidebar.collapsed .radio-widget { display: none; }
.radio-widget-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; }
.radio-widget-head svg { width: 14px; height: 14px; }

.radio-channel-select { position: relative; margin-bottom: 8px; }
.radio-channel-current {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); border-radius: 10px;
  color: var(--text); font-size: 12.5px; font-weight: 600;
  padding: 8px 11px; cursor: pointer;
}
.radio-channel-current:hover { border-color: var(--purple); }
.radio-chevron { width: 9px; height: 9px; flex-shrink: 0; color: var(--text-faint); transition: transform .15s ease; }
.radio-channel-select.open .radio-chevron { transform: rotate(180deg); }
.radio-channel-dropdown {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 6;
  background: var(--dropdown-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border); border-radius: 12px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
  max-height: 220px; overflow-y: auto;
}
.radio-channel-option {
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: transparent; border: none; border-radius: 8px;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  padding: 8px 10px; cursor: pointer;
}
.radio-channel-option:hover { background: rgba(255,255,255,.06); color: var(--text); }
.radio-channel-option.active { background: rgba(139,107,255,.16); color: var(--text); }
.radio-channel-option.active::before { content: '\25B6'; font-size: 8px; color: var(--magenta); }

.radio-eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; margin-bottom: 6px; opacity: .35; transition: opacity .2s ease; }
.radio-eq.playing { opacity: 1; }
.radio-eq span { width: 3px; background: var(--gradient); border-radius: 2px; height: 30%; }
.radio-eq.playing span { animation: radio-eq-bounce 1s ease-in-out infinite; }
.radio-eq span:nth-child(1) { animation-delay: -0.9s; } .radio-eq span:nth-child(2) { animation-delay: -0.7s; }
.radio-eq span:nth-child(3) { animation-delay: -1.1s; } .radio-eq span:nth-child(4) { animation-delay: -0.3s; }
.radio-eq span:nth-child(5) { animation-delay: -0.6s; } .radio-eq span:nth-child(6) { animation-delay: -0.2s; }
.radio-eq span:nth-child(7) { animation-delay: -0.8s; } .radio-eq span:nth-child(8) { animation-delay: -0.4s; }
@keyframes radio-eq-bounce { 0%, 100% { height: 25%; } 50% { height: 100%; } }

.radio-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 5px; }
.radio-ctrl-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.radio-ctrl-btn:hover { color: var(--text); }
.radio-ctrl-btn svg { width: 13px; height: 13px; }
.radio-play-btn {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; border: none; cursor: pointer;
  background: var(--gradient); color: #fff; display: flex; align-items: center; justify-content: center;
}
.radio-play-btn:disabled { opacity: .4; cursor: default; }
.radio-play-btn svg { width: 12px; height: 12px; }
.radio-now-playing-label { font-size: 11px; color: var(--text-faint); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Utility rows: radio widget, usage ring, settings, profile */
.sidebar-utility-row { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 9px; flex-shrink: 0; width: 100%; text-align: left; }
.sidebar-utility-row:hover { background: rgba(255, 255, 255, 0.06); }
.sidebar-utility-label { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; }

.rail-usage-ring-btn { position: relative; background: transparent; border: none; cursor: pointer; display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.header-usage-ring-btn { padding: 0; }
.usage-ring-shell { position: relative; width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.usage-ring-svg { position: absolute; inset: 0; width: 34px; height: 34px; transform: rotate(-90deg); }
.usage-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 3; }
.usage-ring-fg { fill: none; stroke: var(--magenta); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.usage-ring-label { position: relative; font-size: .58rem; font-weight: 700; color: var(--text); }

.rail-avatar-btn { padding: 4px 10px; width: 100%; justify-content: flex-start; gap: 9px; }
.rail-avatar-btn .avatar { width: 30px; height: 30px; flex-shrink: 0; }
.sidebar-user-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.profile-chip { position: relative; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--gradient); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; object-fit: cover; }

.dropdown-menu {
  position: absolute; bottom: 0; left: calc(100% + 8px); min-width: 170px; z-index: 5;
  background: var(--dropdown-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
  padding: 0.4rem;
  display: flex; flex-direction: column; gap: 0.1rem;
}
.dropdown-item { background: transparent; border: none; color: var(--text-muted); text-align: left; padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.83rem; cursor: pointer; }
.dropdown-item:hover { background: var(--glass); color: var(--text); }
.dropdown-item-danger { color: var(--dislike); }
.dropdown-item-danger:hover { background: rgba(244, 63, 94, 0.1); color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--glass-border); margin: 0.25rem 0.2rem; }

.sidebar-tools { display: flex; gap: 0.3rem; }

/* Collapsed state: icons only, sidebar never fully vanishes */
.sidebar.collapsed .sidebar-brand-name,
.sidebar.collapsed .cluster-list,
.sidebar.collapsed .cluster-more,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .box-header-add,
.sidebar.collapsed .sidebar-utility-label,
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .select-all-label,
.sidebar.collapsed #box-floating-popover,
.sidebar.collapsed #global-docs-floating-popover
{ display: none; }
.sidebar.collapsed .sidebar-top-row { justify-content: flex-start; gap: 4px; }
.sidebar.collapsed .collapsed-star-btn { display: flex; }

/* =========================================================
   THREAD PANE / TOPBAR / MESSAGE SCROLL
   ========================================================= */
.thread-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
.thread-header {
  height: 58px; padding: 0 20px; display: flex; align-items: center; gap: 12px;
  background: rgba(15, 19, 34, .5) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid var(--glass-border) !important;
}
.thread-title { margin: 0; font-weight: 600; font-family: var(--font-display); font-size: 15px; flex: 1; color: var(--text); }

.message-scroll {
  flex: 1; overflow-y: auto; width: 100%;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}
.message-scroll.is-scrolling { scrollbar-color: rgba(139, 107, 255, 0.5) transparent; }
.message-scroll::-webkit-scrollbar { width: 5px; }
.message-scroll::-webkit-scrollbar-track { background: transparent; }
.message-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; transition: background 0.3s ease; }
.message-scroll.is-scrolling::-webkit-scrollbar-thumb { background: rgba(139, 107, 255, 0.55); }

.message-list {
  width: 100%; max-width: var(--chat-column-width); margin: 0 auto;
  padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem;
  font-family: var(--font-chat); font-size: var(--chat-font-size);
}
.message-row { display: flex; flex-direction: column; gap: 0.3rem; max-width: 85%; }
.message-row.user { align-self: flex-end; align-items: flex-end; }
.message-row.assistant { align-self: flex-start; align-items: flex-start; }
@media (max-width: 768px) { .message-row { max-width: 92%; } }

.bubble { padding: 0.7rem 1rem; border-radius: var(--radius-md); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.message-row.user .bubble { background: var(--user-bubble-bg); color: var(--text); border-bottom-right-radius: 6px; }
.message-row.assistant .bubble { background: none; border: none; backdrop-filter: none; padding-left: 0; padding-right: 0; white-space: normal; color: var(--text-muted); }

/* --- Rendered markdown inside assistant answers: grey body, white emphasis, #b76fc9 for structure/highlights --- */
.bubble p { margin: 0 0 0.6em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  color: #b76fc9;
  font-weight: 700;
  line-height: 1.3;
  margin: 0.8em 0 0.4em;
}
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }
.bubble h1 { font-size: 1.25em; }
.bubble h2 { font-size: 1.15em; }
.bubble h3, .bubble h4 { font-size: 1.05em; }
.bubble strong { color: var(--text); font-weight: 700; }
.bubble em { font-style: italic; color: var(--text-muted); }
.bubble u { text-decoration: underline; }
.bubble a { color: #b76fc9; text-decoration: underline; }
.bubble blockquote {
  margin: 0.6em 0;
  padding-left: 0.8em;
  border-left: 2px solid #b76fc9;
  color: #b76fc9;
  font-style: italic;
  text-decoration: underline;
}
.bubble ul, .bubble ol { margin: 0.4em 0; padding-left: 1.3em; }
.bubble li { margin: 0.2em 0; }
.bubble li::marker { color: #b76fc9; }
.bubble hr { border: none; border-top: 1px solid var(--glass-border); margin: 0.8em 0; }

.callout-block {
  margin: 0.7em 0;
  padding: 0.8em 1em;
  background: #2d134c;
  border-radius: var(--radius-md);
  color: var(--text);
  line-height: 1.5;
}
.callout-block p:last-child { margin-bottom: 0; }

.judge-notes-block {
  margin: 0.7em 0;
  padding: 0.7em 0.9em;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-left: 2px solid #b76fc9;
  border-radius: var(--radius-sm);
  font-size: 0.92em;
}
.judge-notes-block p { margin: 0; color: var(--text-muted); }
.judge-notes-label { font-weight: 700; color: #b76fc9; margin: 0 0 0.3em !important; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.03em; }

.draft-block { margin-bottom: 0.4rem; }
.draft-toggle {
  display: flex; align-items: center; gap: 0.4rem;
  background: transparent; border: none; color: var(--text-faint);
  font-size: 0.78rem; cursor: pointer; padding: 0.15rem 0;
}
.draft-toggle:hover { color: var(--text-muted); }
.draft-block .thought-chevron { font-size: 0.65rem; transition: transform 0.15s ease; display: inline-block; }
.draft-block.expanded .thought-chevron { transform: rotate(180deg); }
.draft-content {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  font-size: 0.8rem; color: var(--text-faint);
  white-space: pre-wrap;
  padding-left: 0.9rem;
  border-left: 2px solid var(--glass-border);
  margin-top: 0.3rem;
}
.draft-block.expanded .draft-content { max-height: 220px; opacity: 1; overflow-y: auto; }
.debate-note { font-size: 0.78rem; color: var(--text-faint); margin: 0 0 0.4rem; }

/* --- Debate mode (Think Deeper) live status panel --- */
.debate-status {
  margin-bottom: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  max-width: 320px;
  transition: opacity 0.3s ease;
}
.debate-progress-bar {
  position: relative;
  height: 4px;
  background: var(--glass-strong);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.debate-progress-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 35%;
  background: var(--gradient);
  border-radius: var(--radius-pill);
  /* Indeterminate, not an ETA estimate -- loops forever so it never visibly
     freezes no matter how long the real wait turns out to be. Stopped and
     snapped to a solid full bar by JS the moment a real answer starts. */
  animation: debate-progress-slide 1.4s ease-in-out infinite;
}
@keyframes debate-progress-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}
.debate-progress-fill.complete { animation: none; left: 0; width: 100%; }
.debate-stage-label { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.debate-model-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; color: var(--text-faint);
  padding: 0.2rem 0;
}
.debate-model-row span:nth-child(2) { color: var(--text-muted); min-width: 78px; }
.debate-model-row .debate-model-status { margin-left: auto; }
.debate-model-row.done .presence-dot { animation: none; opacity: 1; background: var(--like); }
.debate-model-row.done .debate-model-status { color: var(--like); }

/* --- Stage log: the accumulating "what the backend is actually doing right
   now" trace (presentation planning, format/domain detection, etc.) --
   entries stay visible once done rather than being wiped by the next one,
   so the whole sequence is inspectable, not just the current step. --- */
.stage-log {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--glass-border);
}
.stage-log-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  line-height: 1.3;
}
.stage-log-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.stage-log-entry.active .stage-log-dot {
  background: var(--gradient);
  animation: presence-pulse 1.5s ease-in-out infinite;
}
.stage-log-entry.active .stage-log-text { color: var(--text-muted); }
.stage-log-entry.done .stage-log-dot { background: var(--like); }
.stage-log-entry.done .stage-log-text { color: var(--text-faint); }

.bubble code {
  font-family: var(--font-chat);
  background: var(--glass-strong);
  color: var(--text);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.95em;
}

.code-block-wrap { position: relative; margin: 0.7em 0; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--glass-border); }
.code-block-wrap pre {
  background: #0c0f1c;
  border: none;
  border-radius: 0;
  padding: 1em 1.1em;
  max-height: 320px;
  overflow: auto;
  margin: 0;
}
.code-block-wrap pre code {
  background: none; padding: 0; color: var(--text-muted); font-size: 0.86em;
  font-family: var(--font-mono); line-height: 1.7; white-space: pre;
}
.code-block-wrap .hljs { background: none; }
.copy-btn {
  position: absolute; top: 0.5em; right: 0.5em;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(139, 107, 255, 0.12);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
}
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn.copied { color: var(--like); border-color: var(--like); }

.bubble table { border-collapse: collapse; margin: 0.6em 0; font-size: 0.95em; width: 100%; }
.bubble img { max-width: 260px; max-height: 220px; width: auto; height: auto; border-radius: var(--radius-md); margin: 0.5em 0; display: block; object-fit: cover; }
.bubble th, .bubble td { border: 1px solid var(--glass-border); padding: 0.4em 0.7em; text-align: left; }
.bubble th { color: var(--text); font-weight: 700; background: var(--glass); }
.bubble td { color: var(--text-muted); }

.chart-block {
  margin: 0.8em 0;
  padding: 0.8em;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  max-width: 420px;
}
.chart-block canvas { max-height: 280px; }

.feedback-row { display: flex; gap: 0.5rem; opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.message-row:hover .feedback-row { opacity: 1; pointer-events: auto; }
.feedback-btn { background: transparent; border: none; color: var(--text-faint); padding: 0.15rem; cursor: pointer; display: inline-flex; align-items: center; }
.feedback-btn:hover { color: var(--text); }
.feedback-btn.active-like { color: var(--like); }
.feedback-btn.active-dislike { color: var(--dislike); }
.feedback-btn svg { width: 14px; height: 14px; }

.thinking-row { display: flex; align-items: center; gap: 0.5rem; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gradient); display: inline-block; animation: presence-pulse 1.5s ease-in-out infinite; flex-shrink: 0; }

/* --- Thought process (live reasoning, collapsible) --- */
.thought-block { margin-bottom: 0.5rem; max-width: 100%; }
.thought-toggle {
  display: flex; align-items: center; gap: 0.4rem;
  background: transparent; border: none; color: var(--text-faint);
  font-size: 0.78rem; cursor: pointer; padding: 0.15rem 0;
}
.thought-toggle:hover { color: var(--text-muted); }
.thought-chevron { font-size: 0.65rem; transition: transform 0.15s ease; display: inline-block; }
.thought-block.expanded .thought-chevron { transform: rotate(180deg); }
.thought-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  font-size: 0.8rem;
  color: var(--text-faint);
  font-style: italic;
  white-space: pre-wrap;
  padding-left: 0.9rem;
  border-left: 2px solid var(--glass-border);
  margin-top: 0.3rem;
}
.thought-block.expanded .thought-content { max-height: 220px; opacity: 1; overflow-y: auto; }
@keyframes presence-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.05); } }
.thinking-text { font-size: 0.82rem; color: var(--text-faint); }

.summary-label { font-size: 0.72rem; color: var(--text-faint); margin: 0 0 0.1rem; align-self: flex-start; }

/* --- Composer --- */
.message-form {
  display: flex; justify-content: center;
  padding: 14px 24px 20px;
  background: var(--chat-bg);
}
.composer-box {
  width: 100%; max-width: var(--chat-column-width);
  background: var(--chat-input-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  transition: border-color .15s ease;
}
.composer-box:focus-within { border-color: rgba(139, 107, 255, 0.55); }
.message-input {
  width: 100%;
  resize: none;
  background: transparent;
  border: none;
  border-radius: 20px 20px 0 0;
  padding: 14px 16px 8px;
  font-family: var(--font-chat);
  font-size: var(--chat-font-size);
  line-height: 1.6;
  display: block;
  max-height: 260px;
  overflow-y: auto;
}
.message-input:focus { outline: none; }
.composer-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px 10px;
}
.composer-toolbar-left, .composer-toolbar-right { display: flex; align-items: center; gap: 8px; }

.composer-icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 50%;
  color: var(--text-muted); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.composer-icon-btn svg { width: 16px; height: 16px; }
.composer-icon-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }

.mode-selector { position: relative; }
.mode-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); border-radius: 20px;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; cursor: pointer;
}
.mode-btn:hover { color: var(--text); border-color: var(--purple); }
.mode-chevron { font-size: .6rem; }
.mode-dropdown { bottom: calc(100% + 8px); top: auto; left: 0; right: auto; min-width: 150px; }

.btn-send { width: 34px; height: 34px; padding: 0; border-radius: 50%; flex-shrink: 0; font-size: 1rem; background: var(--gradient); border: none; color: #fff; transition: filter .15s ease, transform .15s ease; }
.btn-send:hover { filter: brightness(1.12); transform: scale(1.04); }

/* --- Modals --- */
.modal-overlay { position: fixed; inset: 0; z-index: 10; background: rgba(2, 3, 8, 0.6); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-card { width: 100%; max-width: 320px; padding: 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; }
.modal-title { margin: 0; font-weight: 600; font-family: var(--font-display); }
.modal-body { margin: 0; color: var(--text-muted); font-size: 0.88rem; }
.modal-input { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* --- Toasts --- */
.toast-container { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.toast { padding: 0.6rem 1rem; border-radius: var(--radius-pill); font-size: 0.82rem; background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--glass-border); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); animation: toast-in 0.18s ease; }
.toast.toast-error { border-color: rgba(251, 113, 133, 0.4); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.thread-title-input { font-family: var(--font-display); font-weight: 600; font-size: 1em; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.2rem 0.5rem; flex: 1; }

/* --- Waitlist (shown instead of the Google button when at capacity) --- */
.waitlist-blurb { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1rem; line-height: 1.55; }
.waitlist-form { display: flex; flex-direction: column; gap: 0.7rem; }

/* --- Edit message (branch from here) --- */
.edit-textarea {
  width: 100%;
  min-width: 220px;
  resize: vertical;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: inherit;
}
.edit-actions { display: flex; gap: 0.4rem; margin-top: 0.3rem; }

/* --- Send/Stop button icon sizing --- */
.btn-send svg { width: 14px; height: 14px; fill: currentColor; }

/* --- Documents modal (Phase 1 RAG) --- */
.documents-modal-card { max-width: 440px; }
.modal-subtitle { margin: -0.4rem 0 0; font-size: 0.8rem; color: var(--text-faint); }
.document-add-row { display: flex; gap: 0.6rem; }
.document-add-row .modal-input { flex: 1; }
.document-status { font-size: 0.8rem; color: var(--text-faint); min-height: 1.1em; margin: 0; }
.documents-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; }
.document-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.document-row-icon { flex-shrink: 0; color: var(--text-faint); }
.document-row-info { flex: 1; min-width: 0; }
.document-row-name { margin: 0; font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-row-meta { margin: 0; font-size: 0.72rem; color: var(--text-faint); }
.document-delete-btn { background: transparent; border: none; color: var(--text-faint); cursor: pointer; flex-shrink: 0; display: inline-flex; padding: 0.2rem; }
.document-delete-btn:hover { color: var(--dislike); }
.document-delete-btn svg { width: 14px; height: 14px; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

/* --- Storage usage sidebar link --- */
.storage-usage-link { width: 100%; text-align: left; }

/* --- Box detail pane: shown instead of thread-pane when a box is selected --- */
.box-detail-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.box-icon-btn {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); cursor: pointer; flex-shrink: 0;
}
.box-icon-btn:hover { background: var(--glass-strong); }
.box-icon-btn svg { width: 16px; height: 16px; }
.box-detail-title { cursor: text; outline: none; }
.box-detail-title:focus { box-shadow: 0 0 0 2px var(--glass-border); border-radius: var(--radius-sm); }
.icon-picker {
  position: absolute; top: 56px; left: 60px; display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem; padding: 0.5rem; width: auto; z-index: 12;
}
.icon-picker-option {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.icon-picker-option:hover, .icon-picker-option.selected { background: var(--glass-strong); color: var(--text); }
.icon-picker-option svg { width: 16px; height: 16px; }

.box-detail-scroll { flex: 1; overflow-y: auto; padding: 1.5rem; max-width: 760px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 1.5rem; }
.box-description-input {
  width: 100%; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem; color: var(--text); font-family: inherit; font-size: 0.9rem; resize: vertical;
}
.box-detail-section { display: flex; flex-direction: column; gap: 0.6rem; }
.box-detail-section-header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.box-detail-section-title { margin: 0; font-weight: 600; font-family: var(--font-display); font-size: 0.95rem; }

.box-chats-list { display: flex; flex-direction: column; gap: 0.4rem; }
.box-chat-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  cursor: pointer; text-align: left; width: 100%; color: var(--text); font: inherit;
}
.box-chat-row:hover { background: var(--glass-strong); }
.box-chat-row-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; }
.box-chat-row-stats { font-size: 0.72rem; color: var(--text-faint); flex-shrink: 0; }
.box-totals { font-size: 0.78rem; color: var(--text-faint); margin: 0.2rem 0 0; }

/* --- Search mode: sources favicon strip + image gallery --- */
.search-sources-block { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.6rem 0; }
.search-sources-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.search-source-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  padding: 0.3rem 0.65rem 0.3rem 0.4rem; font-size: 0.78rem; color: var(--text-muted);
  text-decoration: none; max-width: 200px;
}
.search-source-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-source-chip:hover { background: var(--glass-strong); color: var(--text); }
.search-source-favicon { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; object-fit: contain; }
.search-source-favicon-fallback { background: var(--glass-strong); display: inline-block; }
.search-images-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.search-image { max-width: 200px; max-height: 160px; border-radius: var(--radius-md); object-fit: cover; }

/* --- Inline "presentation ready" download card --- */
.presentation-card {
  display: flex; align-items: center; gap: 0.7rem; margin: 0.6rem 0;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
}
.presentation-card-icon { color: var(--purple); flex-shrink: 0; display: flex; }
.presentation-card-info { flex: 1; min-width: 0; }
.presentation-card-title { margin: 0; font-weight: 600; font-size: 0.88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presentation-card-meta { margin: 0; font-size: 0.76rem; color: var(--text-faint); }

/* --- Inline document-attachment card (shown while a file uploads into chat) --- */
.attachment-row { margin: 0.4rem 0; }
.attachment-card {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem; max-width: 360px;
}
.attachment-card-icon { color: var(--blue); flex-shrink: 0; display: flex; }
.attachment-card[data-status="error"] .attachment-card-icon { color: var(--red, #e05656); }
.attachment-card-info { flex: 1; min-width: 0; }
.attachment-card-name { margin: 0; font-weight: 600; font-size: 0.88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-card-meta { margin: 0; font-size: 0.76rem; color: var(--text-faint); display: flex; align-items: center; gap: 0.35rem; }
.attachment-card-spinner {
  width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--glass-strong); border-top-color: var(--purple);
  animation: attachment-spin 0.7s linear infinite;
}
@keyframes attachment-spin { to { transform: rotate(360deg); } }
.attachment-card[data-status="done"] .attachment-card-status { color: var(--text); }
.attachment-card[data-status="error"] .attachment-card-status { color: var(--red, #e05656); }

/* --- Interactive choice prompts (slide count, style choices) --- */
.choice-prompt { display: flex; flex-direction: column; gap: 0.7rem; margin: 0.6rem 0; }
.choice-group { display: flex; flex-direction: column; gap: 0.4rem; }
.choice-group-label { margin: 0; font-size: 0.78rem; color: var(--text-faint); font-weight: 600; }
.choice-group-options { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.choice-btn {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  color: var(--text-muted); padding: 0.45rem 1rem; font-size: 0.85rem; cursor: pointer;
}
.choice-btn:hover { background: var(--glass-strong); color: var(--text); }
.choice-btn.selected { background: var(--gradient); color: #fff; border-color: transparent; }
.choice-btn:disabled, .choice-text-input:disabled { opacity: 0.5; cursor: not-allowed; }
.choice-text-input { margin-top: 0.3rem; max-width: 260px; }
.choice-continue-btn { align-self: flex-start; }

/* --- Slide preview panel (right side): big main view + thumbnail strip --- */
.slide-preview-panel {
  width: 900px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--chat-bg); border-left: 1px solid var(--glass-border);
  height: 100vh;
}
.slide-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--glass-border); flex-shrink: 0;
}
.slide-preview-title { margin: 0; font-weight: 600; font-size: 0.92rem; color: var(--text); }

.slide-preview-main { flex: 1; min-height: 0; padding: 1.2rem; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slide-preview-main-frame {
  position: relative; width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  border-radius: var(--radius-md); overflow: hidden; background: #000;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center;
}
.slide-preview-main-frame iframe, .slide-preview-main-frame .slide-preview-code { position: absolute; top: 0; left: 0; border: none; transform-origin: top left; }
.slide-preview-main-label { position: absolute; top: 10px; left: 12px; font-size: 0.72rem; color: rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.45); padding: 0.15rem 0.6rem; border-radius: var(--radius-pill); z-index: 5; }

.slide-preview-code {
  width: 100%; height: 100%; margin: 0; padding: 1rem; overflow-y: auto; box-sizing: border-box;
  background: #0a0e14; color: #8fd6a8; font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.78rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
}

.slide-preview-thumbs { display: flex; gap: 0.6rem; padding: 0.8rem 1rem; overflow-x: auto; flex-shrink: 0; border-top: 1px solid var(--glass-border); }
.slide-preview-thumb {
  flex-shrink: 0; width: 110px; height: 62px; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; border: 2px solid transparent; background: #000; position: relative;
}
.slide-preview-thumb.active { border-color: var(--purple); }
.slide-preview-thumb iframe { position: absolute; top: 0; left: 0; border: none; transform-origin: top left; pointer-events: none; }
.slide-preview-thumb-label { position: absolute; bottom: 2px; right: 4px; font-size: 0.6rem; color: rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.55); padding: 0 0.3rem; border-radius: 3px; z-index: 2; }
.slide-preview-thumb-pending { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.4); font-size: 0.65rem; }

.slide-preview-footer { padding: 1rem; border-top: 1px solid var(--glass-border); flex-shrink: 0; }

/* Below ~1500px there's no room for a fixed side-by-side layout, but the
   preview must still be reachable -- confirmed real bug: the panel was
   previously just display:none below this width, meaning on an ordinary
   laptop screen the actual slide preview was never visible at all, only
   the eventual downloaded file. Now it becomes a large centered overlay
   instead of disappearing. */
@media (max-width: 1500px) {
  .slide-preview-panel {
    position: fixed; inset: 0; width: 100%; z-index: 200;
    border-left: none;
  }
}
@media (max-width: 640px) {
  .slide-preview-thumbs { padding: 0.5rem 0.6rem; }
  .slide-preview-thumb { width: 84px; height: 48px; }
}
